void SSfind::prep_search( const clipper::Xmap<float>& xmap, const double rhocut, const double radcut, const clipper::Coord_orth centre ) { // make list of results typedef clipper::Xmap<float>::Map_reference_index MRI; srctrn.clear(); double r2cut = ( radcut > 0.0 ) ? radcut*radcut : 1.0e20; clipper::Coord_frac cf = centre.coord_frac( xmap.cell() ); for ( MRI ix = xmap.first(); !ix.last(); ix.next() ) if ( xmap[ix] > rhocut ) { clipper::Coord_frac df = ix.coord().coord_frac( xmap.grid_sampling() ); df = df.symmetry_copy_near( xmap.spacegroup(), xmap.cell(), cf ) - cf; double r2 = df.lengthsq( xmap.cell() ); if ( r2 < r2cut ) srctrn.push_back( grid.index( ix.coord() ) ); } }
/*! A log-likelihood FFFear search is performed for the target in the given map. \param resultscr The best scores. \param resultrot The best rotations. \param resulttrn The best translations. \param xmap The map to search. \param rtops The oprientations to search. */ void LLK_map_target::search( clipper::Xmap<float>& resultscr, clipper::Xmap<int>& resultrot, clipper::Xmap<int>& resulttrn, const clipper::Xmap<float>& xmap, const std::vector<clipper::RTop_orth>& rtops ) const { // set up results const clipper::Spacegroup& spgr = xmap.spacegroup(); const clipper::Cell& cell = xmap.cell(); const clipper::Grid_sampling& grid = xmap.grid_sampling(); resultscr.init( spgr, cell, grid ); resultrot.init( spgr, cell, grid ); resulttrn.init( spgr, cell, grid ); resultscr = 1.0e20; // now search for ML target in each orientation in turn clipper::Xmap<float> resultp1( clipper::Spacegroup::p1(), cell, grid ); clipper::Xmap<float>::Map_reference_index i1(resultp1); clipper::Xmap<float>::Map_reference_coord ix(resultscr); // set up z scoring clipper::FFFear_fft<float> srch( xmap ); clipper::NX_operator nxop( xmap, target, rtops[0] ); srch( resultp1, target, weight, nxop ); clipper::Map_stats zstats( resultp1 ); // loop over orientations for ( int op = 0; op < rtops.size(); op++ ) { // do the fffear search clipper::NX_operator nxop( xmap, target, rtops[op].inverse() ); srch( resultp1, target, weight, nxop ); // store best scores for ( i1 = resultp1.first(); !i1.last(); i1.next() ) { ix.set_coord( i1.coord() ); float score = ( resultp1[i1] - zstats.mean() ) / zstats.std_dev(); if ( score < resultscr[ix] ) { resultscr[ix] = score; resultrot[ix] = op; resulttrn[ix] = grid.index( i1.coord() ); } } } }
/*! Search from scratch. Combined search, scoring and sorting of fragments. This version is for general use. \param frag The fragment to search for. \param nfrag The maximum number of fragments to return \param xmap The electron density map for scoring models. \param coords The coordinates of the model for use in clash scoring. \param wdense (optional) weight for the density score \param wclash (optional) weight for the clash score \param sig1 (optional) the sigma offset for density scores \param sig2 (optional) the sigma weight for density scores \param clashrad (optional) the radius for clash penalties \return A vector of chains, with the first chain representing the best score. */ std::vector<Chain> ProteinDBSearch::search( const Chain& frag, const int nfrag, const clipper::Xmap<float>& xmap, const std::vector<clipper::Coord_orth>& coords, double wdense, double wclash, double sig1, double sig2, double clashrad ) { ScoreDensity score_rho( xmap, sig1, sig2 ); ScoreClashes score_cls( coords, xmap.spacegroup(), xmap.cell(), clashrad ); return search( frag, nfrag, score_rho, score_cls, wdense, wclash ); }