56 #include <basic/Tracer.hh>
66 #include <numeric/random/random.hh>
69 #include <utility/LexicographicalIterator.hh>
70 #include <utility/OrderedTuple.hh>
71 #include <utility/string_util.hh>
78 #include <utility/vector1.hh>
86 static basic::Tracer
TR(
"protocols.match.Matcher" );
87 static numeric::random::RandomGenerator
RG(6527);
91 same_build_resids_for_all_csts_( true ),
92 n_geometric_constraints_( 0 ),
93 read_gridlig_file_( false ),
94 use_input_sc_( false ),
95 dynamic_grid_refinement_( false ),
96 output_matches_as_singular_downstream_positioning_( false ),
97 check_potential_dsbuilder_incompatibility_( false )
114 runtime_assert( orientation_atoms.size() == 3 );
144 std::list< Size > uniq_resids;
153 uniq_resids.unique();
201 runtime_assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ cst_id ].
get() ) );
204 prot_sc_builder->add_build_set( build_set );
220 runtime_assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ cst_id ].
get() ) );
238 assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ cst_id ].
get() ) );
252 Size const exgeom_id,
253 bool enumerate_ligand_rotamers ,
257 TR <<
" Adding Classical Match Algorithm with geometry samples: " << std::endl;
295 runtime_assert( upstream_launch_atoms.size() == 3 );
296 runtime_assert( downstream_3atoms.size() == 3 );
302 cst_id, restype, upstream_launch_atoms,
303 downstream_3atoms, enumerate_ligand_rotamers, catalytic_bond );
306 runtime_assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
309 static_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ cst_id ].
get() ));
315 match_algorithm->set_residue_type( restype );
323 runtime_assert( dynamic_cast< downstream::ClassicMatchAlgorithm * > ( & build_set.
algorithm() ) );
329 upstream_launch_atoms[ 1 ],
330 upstream_launch_atoms[ 2 ],
331 upstream_launch_atoms[ 3 ],
341 Size target_geom_cst_id,
351 using namespace downstream;
353 runtime_assert( candidate_atids.size() == 3 );
354 runtime_assert( target_atids.size() == 3 );
359 runtime_assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
362 static_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ geom_cst_id ].
get() ));
366 if ( ! build_set.has_algorithm() ) {
368 =
new SecondaryMatcherToUpstreamResidue( geom_cst_id );
369 build_set.set_downstream_algorithm( secondary_match_algorithm );
370 secondary_match_algorithm->set_target_geomcst_id( target_geom_cst_id );
376 runtime_assert( dynamic_cast< downstream::SecondaryMatcherToUpstreamResidue * > ( & build_set.algorithm() ) );
394 = SecMatchEvaluatorFactory::create_SecMatchResiduePairEvaluatorOP( *mcfi, target_atids, candidate_atids,
395 SecMatchStr, upstream_pose );
413 using namespace downstream;
415 runtime_assert( candidate_atids.size() == 3 );
416 runtime_assert( target_atids.size() == 3 );
421 runtime_assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
424 static_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ geom_cst_id ].
get() ));
428 if ( ! build_set.has_algorithm() ) {
430 =
new SecondaryMatcherToDownstreamResidue(
upstream_pose_, geom_cst_id );
431 build_set.set_downstream_algorithm( secondary_match_algorithm );
432 secondary_match_algorithm->set_downstream_restype( downstream_restype );
436 if ( catalytic_bond ) {
438 catalytic_atoms[ 1 ] = candidate_atids[ 2 ];
439 catalytic_atoms[ 2 ] = candidate_atids[ 1 ];
441 catalytic_atoms[ 3 ] = target_atids[ 1 ];
442 catalytic_atoms[ 4 ] = target_atids[ 2 ];
443 secondary_match_algorithm->set_catalytic_atoms( catalytic_atoms );
447 runtime_assert( dynamic_cast< downstream::SecondaryMatcherToDownstreamResidue * > ( & build_set.algorithm() ) );
461 = SecMatchEvaluatorFactory::create_SecMatchResiduePairEvaluatorOP( *mcfi, target_atids, candidate_atids,
462 SecMatchStr, upstream_pose );
463 algorithm.
add_evaluator( secMatch_evaluator, mcfi->index() );
473 TR <<
"Set occupied space bounding box: Lower (";
474 TR << bb.lower().x() <<
", ";
475 TR << bb.lower().y() <<
", ";
476 TR << bb.lower().z() <<
") Upper (";
477 TR << bb.upper().x() <<
", ";
478 TR << bb.upper().y() <<
", ";
479 TR << bb.upper().z() <<
")" << std::endl;
511 bb_grid_->set_general_overlap_tolerance( permitted_overlap );
528 if ( read_gridlig_file_ ) {
550 runtime_assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ ii ].
get() ) );
552 static_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ ii ].
get() ));
557 for (
Size jj = 1; jj <= upres.size(); ++jj ) {
560 constraint_list->mcfis_for_upstream_restype( upres[ jj ] ));
562 for (
Size kk = 1; kk <= jj_mcfis.size(); ++kk ) {
564 prot_sc_builder->set_native_flag(jj_mcfis[ kk ]->native());
666 using namespace toolbox::match_enzdes_util;
670 TR <<
"Matcher::initialize_from_file: n geometric constraints: " << enz_data.
mcfi_lists_size() << std::endl;
675 TR <<
"Begin constraint" << ii << std::endl;
681 for (
Size jj = 1; jj <= upres.size(); ++jj ) {
685 constraint_list->mcfis_for_upstream_restype( upres[ jj ] ));
686 TR <<
" Upstream residue type " << upres[ jj ]->name() <<
" for geometric constraint #" << ii << std::endl;
688 for (
Size kk = 1; kk <= jj_mcfis.size(); ++kk ) {
693 bool secondary_matching(
false );
694 bool secondary_match_upstream_residue(
false );
695 Size secondary_match_upstream_geomcst_id( 0 );
701 std::map< std::string, utility::vector1< std::string > >
const &
702 alg_info( jj_mcfis[ kk ]->algorithm_inputs() );
703 if ( alg_info.find(
"match" ) != alg_info.end() ) {
707 for (
Size ll = 1; ll <= info.size(); ++ll ) {
709 std::istringstream llstream( llstr );
712 if( first ==
"MAX_DUNBRACK_ENERGY" ){
715 TR <<
"Setting dunbrack energy cutoff for restype " << upres[jj]->name() <<
" in constraint " << ii <<
" to " << cutoff <<
"." << std::endl;
718 else if ( first ==
"IGNORE_UPSTREAM_PROTON_CHI" ) {
721 for (
Size mm = 1; mm <= upres[ jj ]->n_proton_chi(); ++mm ) {
722 Size mmchi = upres[ jj ]->proton_chi_2_chi( mm );
723 if ( chi_sample_data_in_file[ mmchi ] ) {
724 TR <<
" WARNING:: Already encountered chi sampling strategy for proton chi " << mmchi <<
" and will NOT ignore this proton chi" << std::endl;
727 TR <<
" ALGORITHM_INFO:: match -- Ignoring proton chi for " << upres[ jj ]->name() <<
" chi # " << mmchi << std::endl;
728 chi_sample_data_in_file[ mmchi ] =
true;
731 }
else if ( first ==
"CHI_STRATEGY::" ) {
733 llstream >> chi_string;
734 if ( llstream.bad() ) {
735 utility_exit_with_message(
"Expected 'CHI' or 'AA' following CHI_STRATEGY:: on line '" + llstr +
"'" );
737 if ( chi_string ==
"AA" ) {
746 bool aa_matches_any =
false;
747 for (
Size mm = 1; mm <= upres.size(); ++mm ) {
748 if ( upres[ mm ]->aa() == aa ) {
749 aa_matches_any =
true;
753 if ( ! aa_matches_any ) {
754 std::cerr <<
"ERROR: amino acid " << aa3 <<
" on line\n" << llstr <<
"\nis not accessible for this geometric constraint." << std::endl;
755 std::cerr <<
"Available amino acids:";
756 for (
Size mm = 1; mm <= upres.size(); ++mm ) {
757 std::cerr <<
" " << upres[ mm ]->name();
759 std::cerr << std::endl;
760 utility_exit_with_message(
"Amino acid restriction in CHI_STRATEGY:: block is invalid" );
762 if ( aa != upres[ jj ]->aa() ) {
767 llstream >> chi_string;
770 if ( chi_string !=
"CHI" ) {
771 utility_exit_with_message(
"Expected 'CHI' following CHI_STRATEGY:: on line '" + llstr +
"'" );
774 llstream >> which_chi;
775 if ( which_chi > upres[ jj ]->nchi() ) {
776 TR <<
"WARNING: Ignoring rotamer sampling strategy data for chi # "
778 <<
" for residue type " << upres[ jj ]->name() <<
" because it only has " << upres[ jj ]->nchi() <<
" chi angles." << std::endl;
781 if ( chi_sample_data_in_file[ which_chi ] ) {
782 TR <<
" WARNING:: Repeat chi info for chi " << which_chi <<
" is being ignored!" << std::endl;
783 TR <<
" WARNING:: Ignoring: '" << llstr <<
"'" << std::endl;
786 chi_sample_data_in_file[ which_chi ] =
true;
787 if ( llstream.bad() ) {
788 utility_exit_with_message(
"Error parsing CHI_STRATEGY. Expected an "
789 "integer following 'CHI_STRATEGY::' on line '" + llstr );
792 llstream >> strategy;
799 TR <<
" ALGORITHM_INFO:: match -- chi sampling strategy " << strategy <<
" for chi # " << which_chi << std::endl;
801 }
else if ( strategy ==
"STEP_WITHIN_SD_RANGE" ) {
803 Real step_size( 1.0 ), sd_range( 1.0 );
806 if ( step !=
"STEP" ) {
807 std::cerr <<
"ERROR:: Bad line in CHI_STRATEGY: \"" << llstr <<
"\"" << std::endl;
808 utility_exit_with_message(
"While parsing CHI_STRATEGY:: STEP_WITHIN_SD_RANGE, expected \"STEP\" after \"STEP_WITHIN_SD_RANGE\"" );
810 if ( llstream.bad() ) {
811 std::cerr <<
"ERROR:: Bad line in CHI_STRATEGY: \"" << llstr <<
"\"" << std::endl;
812 utility_exit_with_message(
"While parsing CHI_STRATEGY:: STEP_WITHIN_SD_RANGE, unexpected EOF" );
814 llstream >> step_size;
815 if ( llstream.bad() ) {
816 std::cerr <<
"ERROR:: Bad line in CHI_STRATEGY: \"" << llstr <<
"\"" << std::endl;
817 utility_exit_with_message(
"While parsing CHI_STRATEGY:: STEP_WITHIN_SD_RANGE. Could not read step size" );
819 if ( step_size == 0.0 ) {
820 std::cerr <<
"ERROR:: Bad line in CHI_STRATEGY: \"" << llstr <<
"\"" << std::endl;
821 utility_exit_with_message(
"While parsing CHI_STRATEGY:: STEP_WITHIN_SD_RANGE. Invalid step size of 0.0" );
825 if ( range !=
"SD_RANGE" ) {
826 std::cerr <<
"ERROR:: Bad line in CHI_STRATEGY: \"" << llstr <<
"\"" << std::endl;
827 utility_exit_with_message(
"While parsing CHI_STRATEGY:: STEP_WITHIN_SD_RANGE. Expected to read SD_RANGE to specify the standard deviation range" );
829 llstream >> sd_range;
830 if ( llstream.bad() ) {
831 std::cerr <<
"ERROR:: Bad line in CHI_STRATEGY: \"" << llstr <<
"\"" << std::endl;
832 utility_exit_with_message(
"While parsing CHI_STRATEGY:: STEP_WITHIN_SD_RANGE. Could not read standard-deviation range" );
834 if ( sd_range <= 0.0 ) {
835 std::cerr <<
"ERROR:: Bad line in CHI_STRATEGY: \"" << llstr <<
"\"" << std::endl;
836 utility_exit_with_message(
"While parsing CHI_STRATEGY:: STEP_WITHIN_SD_RANGE. Invalid standard-deviation range (must be positive). Read: " + utility::to_string( sd_range ) );
848 TR <<
" ALGORITHM_INFO:: match -- chi sampling strategy STEP_WITHIN_SD_RANGE with step_size= " << step_size <<
" degrees across " << sd_range <<
" standard deviations for chi # " << which_chi << std::endl;
849 }
else if ( strategy ==
"NON_ROTAMERIC_CHI_EXPANSION" ) {
850 Size npossiblerots( 0 );
855 using namespace core::scoring;
856 using namespace core::pack::dunbrack;
860 if ( res_rotlib != 0 ) {
863 dynamic_cast< SingleResidueDunbrackLibrary const * >
864 ( res_rotlib.get() ));
866 if ( dun_rotlib == 0 ) {
867 utility_exit_with_message(
"Failed to retrieve a Dunbrack rotamer library for AA: " +
868 utility::to_string( upres[ jj ]->aa() ) +
" named " + upres[ jj ]->name() );
870 npossiblerots = dun_rotlib->n_rotamer_bins();
871 if ( npossiblerots == 0 ) {
872 std::cerr <<
"Error while reading line: " << llstr << std::endl;
873 utility_exit_with_message(
"Rotamer library for " + upres[ jj ]->name() +
" says it contains no rotamers" );
875 if ( which_chi != dun_rotlib->nchi() ) {
876 utility_exit_with_message(
"Cannot treat chi " + utility::to_string( which_chi ) +
877 " on residue " + upres[ jj ]->name() +
878 " as non-rotameric since there are " + utility::to_string( dun_rotlib->nchi() ) +
879 " chi in the library, and the last chi is the only one that could be non-rotameric" );
881 bool failed_cast =
false;
882 switch ( dun_rotlib->nchi() ) {
886 ( dun_rotlib.get() );
887 failed_cast = sr2 == 0;
892 ( dun_rotlib.get() );
893 failed_cast = sr3 == 0;
896 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
897 "All semi-rotameric libraries have 2 or 3 chi, but the library for "+
898 upres[ jj ]->name() +
" has " + utility::to_string( dun_rotlib->nchi() ) +
" chi." );
902 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
903 "Failed to find a semi-rotameric rotamer library for " + upres[ jj ]->name() +
904 " (Did you forget the -dun10 flag?)\n"
905 "The following amino acids define semi-rotameric rotamer libraries: DEFHNQ" );
908 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
909 "Failed to find a rotamer library for " + upres[ jj ]->name() );
914 if ( ! llstream.good() ) {
915 std::cerr <<
"Error reading line: " << llstr << std::endl;
916 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
917 "Expected to read N_SAMPLES after NON_ROTAMERIC_CHI_EXPANSIONbut reached an end of line");
920 if ( nsamps !=
"N_SAMPLES" ) {
921 std::cerr <<
"Error reading line: " << llstr << std::endl;
922 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
923 "Expected to read N_SAMPLES after NON_ROTAMERIC_CHI_EXPANSION but found '" + nsamps +
"'");
925 llstream >> nsamples;
927 std::cerr <<
"Error reading line: " << llstr << std::endl;
928 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
929 "Expected to read an integer following N_SAMPLES but could not" );
932 Real minprobability( 2.0 / npossiblerots );
934 if ( minprob !=
"" ) {
935 if ( minprob !=
"REQUISIT_PROBABILITY" ) {
936 std::cerr <<
"Error reading line: " << llstr << std::endl;
937 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
938 "Expected end-of-line or 'REQUISIT_PROBABILITY' after reading the number of samples, but found '" + minprob +
"'" );
940 if ( ! llstream.good() ) {
941 std::cerr <<
"Error reading line: " << llstr << std::endl;
942 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
943 "Expected to read a probability following the 'REQUISIT_PROBABILITY' string but found an end-of-line" );
945 llstream >> minprobability;
946 if ( llstream.bad() ) {
947 std::cerr <<
"Error reading line: " << llstr << std::endl;
948 utility_exit_with_message(
"While parsing CHI_STRATEGY::NON_ROTAMERIC_CHI_EXPANSION\n"
949 "Expected to read a probability following the 'REQUISIT_PROBABILITY' string but could not" );
955 stratdat.set_n_samples_per_side_of_nrchi_bin( nsamples );
956 stratdat.set_nrchi_prob_minimum_for_extra_samples( minprobability );
958 TR <<
" ALGORITHM_INFO:: match -- chi sampling strategy NON_ROTAMERIC_CHI_EXPANSION with nsteps= " << nsamples <<
" for rotamers with a probability better than " << minprobability << std::endl;
960 utility_exit_with_message(
"While parsing CHI_STRATEGY:: unsupported sample strategy: " + strategy +
" for chi " + utility::to_string( which_chi ) );
962 }
else if ( first ==
"SECONDARY_MATCH:" ) {
964 std::cerr <<
"ERROR Reading line " << llstr <<
" " <<
" for geometric constraint " << ii << std::endl;
965 utility_exit_with_message(
"Seconary matching cannot be chosen for the first geometric constraint!" );
968 utility_exit_with_message(
"While parsing SECONDARY_MATCH: line, exptected to read 'UPSTREAM_CST <int>' but reached an end-of-line" );
972 if ( second !=
"UPSTREAM_CST" && second !=
"DOWNSTREAM" ) {
973 std::cerr <<
"Error reading line: " << llstr << std::endl;
974 utility_exit_with_message(
"While parsing SECONDARY_MATCH: line, expected 'UPSTREAM_CST' or 'DOWNSTREAM' but encountered '" + second +
"'." );
976 if ( second ==
"UPSTREAM_CST" ) {
980 std::cerr <<
"Error reading line: " << llstr << std::endl;
981 utility_exit_with_message(
"While parsing SECONDARY_MATCH: line, read 'UPSTREAM_CST' and expected to read an integer following, but did not find one." );
983 if ( cst_id < 1 || cst_id >= ii ) {
984 std::cerr <<
"Error reading line: '" << llstr <<
"' for geometric constraint " << ii << std::endl;
985 utility_exit_with_message(
"Secondary match algorithm requested to an upstream residue "
986 "produced by an invalid geometric constraint " + utility::to_string( cst_id ) +
987 "\nThe geometric constraint ID must be less than the current geometric constraint id"
988 "and greater than 0" );
990 secondary_match_upstream_residue =
true;
991 secondary_match_upstream_geomcst_id = cst_id;
993 secondary_matching =
true;
997 }
else if ( first ==
"SCORING_SECMATCH::" ){
998 if( !secondary_matching ){
999 utility_exit_with_message(
"SCORING_SECMATCH line detected without previous SECONDARY_MATCH specifier.");
1001 SecMatchStr += llstr +
"\n";
1004 utility_exit_with_message(
"While parsing ALGORITHM:: match data. Command '" + first +
"' not supported on line '" + llstr +
"'");
1008 TR <<
" Did not locate ALGORITHM_INFO:: match for constraint " << ii << std::endl;
1012 Size const upstream_id = jj_mcfis[ kk ]->upstream_res();
1013 Size const downstream_id = jj_mcfis[ kk ]->downstream_res();
1016 if ( !secondary_matching ) {
1017 exgs = jj_mcfis[ kk ]->create_exgs();
1018 if ( exgs.get() == 0 ) {
1019 utility_exit_with_message(
"ERROR: could not define external geometry between upstream and downstream residues. All 6 parameters must be defined." );
1023 if ( jj_mcfis[ kk ]->allowed_restypes( downstream_id ).
size() == 0 ) {
1024 utility_exit_with_message(
"Input file lists no residue types for template residue " +
1025 utility::to_string( downstream_id ) +
" for geometric constraint " +
1026 utility::to_string( ii ) +
". There must be at least one." );
1029 for (
Size ll = 1; ll <= jj_mcfis[ kk ]->allowed_restypes( downstream_id ).size(); ++ll ) {
1036 for (
Size mm = 1; mm <= 3; ++mm ) downstream_3atoms[ mm ].rsd() = 1;
1040 for (
Size mm = 1; mm <= 3; ++mm ) up_ats[ mm ] = jj_mcfis[ kk ]->template_atom_inds( upstream_id, mm, *upres[ jj ] );
1041 for (
Size mm = 1; mm <= 3; ++mm ) down_ats[ mm ] = jj_mcfis[ kk ]->template_atom_inds( downstream_id, mm, *ll_downres );
1043 runtime_assert( up_ats[ 1 ].
size() == up_ats[ 2 ].
size() );
1044 runtime_assert( up_ats[ 1 ].
size() == up_ats[ 3 ].
size() );
1047 up_down_ncombs[ 1 ] = up_ats[ 1 ].size();
1048 up_down_ncombs[ 2 ] = down_ats[ 2 ].size();
1050 utility::LexicographicalIterator lex( up_down_ncombs );
1052 while ( ! lex.at_end() ) {
1053 for (
Size mm = 1; mm <= 3; ++mm ) upstream_launch_atoms[ mm ] = upres[ jj ]->atom_name( up_ats[ mm ][ lex[ 1 ] ] );
1054 for (
Size mm = 1; mm <= 3; ++mm ) downstream_3atoms[ mm ].atomno() = down_ats[ mm ][ lex[ 2 ] ];
1056 TR <<
" " << upres[ jj ]->name() <<
" " << ll_downres->name() << std::endl;
1058 TR <<
" U3: " << upstream_launch_atoms[ 3 ];
1059 TR <<
" U2: " << upstream_launch_atoms[ 2 ];
1060 TR <<
" U1: " << upstream_launch_atoms[ 1 ];
1061 TR <<
" D1: " << ll_downres->atom_name( down_ats[ 1 ][ lex[ 2 ] ] );
1062 TR <<
" D2: " << ll_downres->atom_name( down_ats[ 2 ][ lex[ 2 ] ] );
1063 TR <<
" D3: " << ll_downres->atom_name( down_ats[ 3 ][ lex[ 2 ] ] );
1066 if ( secondary_matching ) {
1069 for (
Size nn = 1; nn <= 3; ++nn ) {
1070 candidate_atids[ nn ] = up_ats[ nn ][ lex[ 1 ]];
1071 target_atids[ nn ] = down_ats[ nn ][ lex[ 2 ]];
1073 if ( secondary_match_upstream_residue ) {
1075 ii, secondary_match_upstream_geomcst_id, upres[ jj ],
1076 ll_downres, candidate_atids, target_atids,
1080 ii, upres[ jj ], ll_downres,
1081 candidate_atids, target_atids, jj_mcfis[ kk ], SecMatchStr, *
upstream_pose_,
1082 jj_mcfis[kk]->is_covalent() );
1086 ii, upres[ jj ], upstream_launch_atoms, downstream_3atoms, *exgs,
1087 jj_mcfis[ kk ]->index(),
1089 jj_mcfis[kk]->is_covalent() );
1130 if( (*ds_it)->hits_potentially_incompatible() ){
1138 TR <<
"Potential DownstreamBuilder hit incompatibilities have been detected. All possible hit combinations will be enumerated. This overrides the MatcherTask instruction to output matches with only a single downstream position." << std::endl;
1189 std::list< downstream::DownstreamAlgorithmCOP >
1192 std::list< downstream::DownstreamAlgorithmCOP > dsalgs;
1193 for ( std::list< downstream::DownstreamAlgorithmOP >::const_iterator
1196 iter != iter_end; ++iter ) {
1197 dsalgs.push_back( *iter );
1212 return hits_[ cst_id ];
1256 std::list< downstream::DownstreamBuilderOP >
const &
1262 std::list< downstream::DownstreamAlgorithmOP >
const &
1277 return hits_[ geom_cst_id ].begin();
1283 return hits_[ geom_cst_id ].end();
1289 Size geom_cst_id_for_hit,
1293 hits_[ geom_cst_id_for_hit ].erase( iter );
1294 if ( geom_cst_id_for_hit != dsalg.
geom_cst_id() ) {
1304 runtime_assert( dsalg.
geom_cst_id() > geom_cst_id_for_hit );
1367 for ( std::list< downstream::DownstreamBuilderOP >::const_iterator
1368 iter = all_downstream_builders_.begin(),
1369 iter_end = all_downstream_builders_.end();
1370 iter != iter_end; ++iter ) {
1371 (*iter)->set_occupied_space_hash( occ_space_hash_ );
1373 for ( std::list< DownstreamAlgorithmOP >::const_iterator
1374 iter = all_downstream_algorithms_.begin(),
1375 iter_end = all_downstream_algorithms_.end();
1376 iter != iter_end; ++iter ) {
1377 (*iter)->set_occupied_space_hash( occ_space_hash_ );
1406 for (
Size jj = 1; jj <= cst_id; ++jj ) {
1407 if ( jj == *iter )
continue;
1411 std::list< Size >::iterator iter_next( iter );
1419 bool hits_found(
hits_[cst_id].
size() != 0 );
1424 for ( std::list< downstream::DownstreamBuilderOP >::const_iterator
1427 iter != iter_end; ++iter ) {
1428 (*iter)->set_occupied_space_hash( 0 );
1445 TR <<
"WARNING: No build points were set in the matcher, could not initialize scaffold build points." << std::endl;
1452 TR <<
"WARNING: No build points for geomcst " << i <<
" were set in the matcher, could not initialize scaffold build points." << std::endl;
1461 "pos file contains position outside of valid range.");
1474 clock_t starttime = clock();
1475 TR <<
"Initializing BumpGrids... " << std::endl;
1492 for ( std::list< downstream::DownstreamBuilderOP >::const_iterator
1495 iter != iter_end; ++iter ) {
1498 for ( std::list< downstream::DownstreamAlgorithmOP >::const_iterator
1501 iter != iter_end; ++iter ) {
1507 iter != iter_end; ++iter ) {
1511 TR <<
"...done" << std::endl;
1512 clock_t stoptime = clock();
1513 TR <<
" TIMING: Bump grids took " << ((double) stoptime - starttime )/CLOCKS_PER_SEC <<
" seconds to compute" << std::endl;
1539 for ( std::list< std::pair< Size, Real > >::const_iterator
1542 iter != iter_end; ++iter ) {
1543 runtime_assert( iter->first <=
upstream_pose_->total_residue() );
1548 for ( std::list< std::pair< Size, Real > >::const_iterator
1551 iter != iter_end; ++iter ) {
1557 for ( std::list< downstream::DownstreamBuilderOP >::const_iterator
1560 iter != iter_end; ++iter ) {
1563 for ( std::list< downstream::DownstreamAlgorithmOP >::const_iterator
1566 iter != iter_end; ++iter ) {
1572 for ( std::list< downstream::DownstreamBuilderOP >::const_iterator
1575 iter != iter_end; ++iter ) {
1576 for ( std::list< core::id::AtomID >::const_iterator
1579 atid_iter != atid_iter_end; ++atid_iter ) {
1580 (*iter)->require_atom_to_reside_in_active_site( *atid_iter );
1624 bool enumerate_ligand_rotamers,
1628 runtime_assert( upstream_launch_atoms.size() == 3 );
1629 runtime_assert( downstream_3atoms.size() == 3 );
1635 runtime_assert( dynamic_cast< upstream::ProteinUpstreamBuilder * > (
upstream_builders_[ cst_id ].
get() ) );
1646 for (
Size ii = 1; ii <= 3; ++ii ) {
1647 runtime_assert( downstream_3atoms[ ii ].rsd() == 1 );
1648 runtime_assert( downstream_3atoms[ ii ].atomno() <=
downstream_pose_->residue( 1 ).natoms() );
1652 if ( ! enumerate_ligand_rotamers ) {
1655 rigid_builder->ignore_h_collisions(
true );
1656 rigid_builder->initialize_from_residue(
1657 downstream_3atoms[ 1 ].atomno(),
1658 downstream_3atoms[ 2 ].atomno(),
1659 downstream_3atoms[ 3 ].atomno(),
1665 if ( catalytic_bond ) {
1666 using namespace core::scoring::etable::count_pair;
1670 Size downstream_atom_id = downstream_3atoms[ 1 ].atomno();
1672 bond_list.push_back( std::make_pair( upstream_atom_id, downstream_atom_id ) );
1682 rigid_builder->initialize_upstream_residue( & build_set.
restype(), cpgen );
1684 rigid_builder->initialize_upstream_residue( & build_set.
restype() );
1686 builder = rigid_builder;
1689 ligand_rotamer_builder->ignore_h_collisions(
true );
1690 ligand_rotamer_builder->initialize_from_residue(
1691 downstream_3atoms[ 1 ].atomno(),
1692 downstream_3atoms[ 2 ].atomno(),
1693 downstream_3atoms[ 3 ].atomno(),
1708 ligand_rotamer_builder->determine_redundant_conformer_groups( relevant_atom_indices );
1712 if ( catalytic_bond ) {
1713 using namespace core::scoring::etable::count_pair;
1717 Size downstream_atom_id = downstream_3atoms[ 1 ].atomno();
1719 bond_list.push_back( std::make_pair( upstream_atom_id, downstream_atom_id ) );
1729 ligand_rotamer_builder->initialize_upstream_residue( & build_set.
restype(), cpgen );
1731 ligand_rotamer_builder->initialize_upstream_residue( & build_set.
restype() );
1734 builder = ligand_rotamer_builder;
1761 Size max_hits_per_us_hit(10);
1763 std::map< upstream_hit, std::set< Size > > us_hit_map;
1765 for(
Size jj = 1; jj <= n_hits_per_geomcst[ ii ]; ++jj ) {
1768 std::map< upstream_hit, std::set< Size > >::iterator hitmap_it(us_hit_map.find( this_us_hit ));
1769 if( hitmap_it == us_hit_map.end() ){
1770 std::set< Size > hits_this_us_hit;
1771 hits_this_us_hit.insert( jj );
1775 hitmap_it->second.insert( jj );
1780 n_hits_per_geomcst[ ii ] = 0;
1782 for( std::map<
upstream_hit, std::set< Size> >::const_iterator map_it( us_hit_map.begin() ), map_end( us_hit_map.end() );
1783 map_it != map_end; ++map_it ){
1785 for( std::set< Size >::const_iterator set_it( map_it->second.begin() ), set_end( map_it->second.end() );
1786 set_it != set_end; ++set_it ){
1788 ++n_hits_per_geomcst[ ii ];
1789 reps[ii].push_back( *set_it );
1790 if( counter >= max_hits_per_us_hit )
break;
1794 reps[ ii ].resize( n_hits_per_geomcst[ ii ] );
1795 for (
Size jj = 1; jj <= n_hits_per_geomcst[ ii ]; ++jj ) {
1796 reps[ ii ][ jj ] = jj;
1808 utility::LexicographicalIterator & lex,
1826 for (
Size jj = 1; jj < ii; ++jj ) {
1831 lex.continue_at_dimension( ii );
1837 lex.continue_at_dimension( ii );
1842 lex.continue_at_dimension( ii );
1858 utility::LexicographicalIterator & lex
1865 for (
Size jj = 1; jj < ii; ++jj ) {
1869 lex.continue_at_dimension( ii );
1892 utility::vector1< std::list< Hit const * >::const_iterator > & upstream_only_hit_iterators,
1893 Size & last_upstream_only_geomcst_advanced,
1901 bool incompatible(
false ), outstanding_list_increment(
false );
1903 Size ii_bp( m[ ii ].scaffold_build_id() );
1904 for (
Size jj = 1; jj < ii; ++jj ) {
1905 Size jj_bp( m[ jj ].scaffold_build_id() );
1911 incompatible =
true;
1916 incompatible =
true;
1922 if( !processor.
up_down_filt()->passes_hardsphere_filter( ii, jj, m[ii], m[jj] ) ) incompatible =
true;
1926 if( !processor.
up_coll_filt()->passes_hardsphere_filter( ii, jj, m[ii], m[jj] ) ) incompatible =
true;
1930 if ( incompatible ) {
1936 ++upstream_only_hit_iterators[ kk ];
1937 last_upstream_only_geomcst_advanced = kk;
1938 if ( upstream_only_hit_iterators[ kk ] == upstream_only_hits[ kk ]->val().end() ) {
1939 outstanding_list_increment =
true;
1941 outstanding_list_increment =
false;
1947 if ( outstanding_list_increment ) {
1949 last_upstream_only_geomcst_advanced = 0;
1964 utility::vector1< std::list< Hit const * >::const_iterator > & upstream_only_hit_iterators,
1965 Size & last_upstream_only_geomcst_advanced,
1973 bool incompatible(
false ), outstanding_list_increment(
false );
1976 for (
Size jj = 1; jj < ii; ++jj ) {
1983 incompatible =
true;
1988 incompatible =
true;
2002 if ( incompatible ) {
2008 ++upstream_only_hit_iterators[ kk ];
2009 last_upstream_only_geomcst_advanced = kk;
2010 if ( upstream_only_hit_iterators[ kk ] == upstream_only_hits[ kk ]->val().end() ) {
2011 outstanding_list_increment =
true;
2013 outstanding_list_increment =
false;
2019 if ( outstanding_list_increment ) {
2021 last_upstream_only_geomcst_advanced = 0;
2036 Size starting_point,
2037 utility::vector1< std::list< Hit const * >::const_iterator > & upstream_only_hit_iterators,
2038 Size & last_upstream_only_geomcst_advanced
2041 for (
Size ii = starting_point; ii >= 1; --ii ) {
2043 ++upstream_only_hit_iterators[ ii ];
2044 last_upstream_only_geomcst_advanced = ii;
2045 if ( upstream_only_hit_iterators[ ii ] != upstream_only_hits[ ii ]->val().
end() ) {
2064 for (
Size ii = 1; ii <=
hits_.size(); ++ii ) {
2069 finders[ii].initialize();
2070 finders[ii].add_hits(
hits_[ ii ] );
2072 clock_t starttime = clock();
2074 clock_t stoptime = clock();
2075 TR <<
"Found " << hit_ccs.size() <<
" connected component" << ( hit_ccs.size() != 1 ?
"s" :
"" ) <<
" in the hit neighbor graph in " << ((
double) stoptime - starttime ) / CLOCKS_PER_SEC <<
" seconds." << std::endl;
2078 for (
Size ii = 1; ii <= hit_ccs.size(); ++ii ) {
2082 ii_neighbor_hits[ 1 ] = hit_ccs[ ii ];
2083 for (
Size jj = 2; jj <=
hits_.size(); ++jj ) {
2085 ii_neighbor_hits[ jj ] = finders[ jj ].neighbor_hits( hit_ccs[ ii ] );
2102 output_stats += ii_outstats;
2107 TR <<
"Match enumeration statistics: ";
2121 Vector & good_euclidean_bin_widths,
2122 Vector & good_euler_bin_widths,
2126 Size const acceptable( 500000 );
2127 Size const take_it( 300000 );
2128 Size const bare_minimum( 20 );
2131 Size const initial_n_combos = n_combos;
2133 if ( n_combos > take_it ) {
2138 Size last_n_combos = n_combos;
2139 TR <<
"subsampling would produce " << n_combos <<
" matches down from " << initial_n_combos <<
" matches." << std::endl;
2141 Size count_refinement( 0 );
2142 bool found_acceptible(
false );
2143 while ( n_combos > take_it ) {
2145 Vector test_euclidean_bin_widths( good_euclidean_bin_widths ), test_euler_bin_widths( good_euler_bin_widths );
2146 test_euclidean_bin_widths *= 0.75;
2147 test_euler_bin_widths *= 0.75;
2148 subsamples =
subsample_hits( test_euclidean_bin_widths, test_euler_bin_widths, neighbor_hits );
2151 TR <<
"Grid refinement #" << count_refinement + 1 <<
" predicts " << n_combos <<
" matches." << std::endl;
2153 if ( n_combos > take_it ) {
2154 good_euclidean_bin_widths = test_euclidean_bin_widths;
2155 good_euler_bin_widths = test_euler_bin_widths;
2156 good_subsamples = subsamples;
2157 last_n_combos = n_combos;
2159 if ( n_combos < acceptable ) found_acceptible =
true;
2160 }
else if ( ! found_acceptible && n_combos > bare_minimum ) {
2163 good_euclidean_bin_widths = test_euclidean_bin_widths;
2164 good_euler_bin_widths = test_euler_bin_widths;
2165 good_subsamples = subsamples;
2166 last_n_combos = n_combos;
2168 }
else if ( ! found_acceptible ) {
2172 Vector test_euclidean_bin_widths2( good_euclidean_bin_widths ), test_euler_bin_widths2( good_euler_bin_widths );
2173 test_euclidean_bin_widths2 *= 0.9;
2174 test_euler_bin_widths2 *= 0.9;
2175 subsamples =
subsample_hits( test_euclidean_bin_widths2, test_euler_bin_widths2, neighbor_hits );
2178 TR <<
"(Partial) Grid refinement #" << count_refinement + 1 <<
" predicts " << n_combos <<
" matches." << std::endl;
2179 if ( n_combos > bare_minimum ) {
2180 good_euclidean_bin_widths = test_euclidean_bin_widths2;
2181 good_euler_bin_widths = test_euler_bin_widths2;
2182 good_subsamples = subsamples;
2183 last_n_combos = n_combos;
2186 TR <<
"Failed to refine grid to acceptible number of matches" << std::endl;
2190 TR <<
"Too fine a grid: " << n_combos <<
" matches predicted." << std::endl;
2193 TR <<
"Dynamic grid refinement predicts " << last_n_combos <<
" matches (down from an initial number of " << initial_n_combos <<
" matches) after " << count_refinement <<
" grid refinements" << std::endl;
2195 return good_subsamples;
2197 return neighbor_hits;
2200 return neighbor_hits;
2205 Vector const & euclidean_bin_widths,
2206 Vector const & euler_bin_widths,
2213 Vector half_width_euclid = 0.5 * euclidean_bin_widths;
2214 Vector half_width_euler = 0.5 * euler_bin_widths;
2226 for ( std::list< Hit const * >::const_iterator
2227 hit_iter = neighbor_hits[ ii ].begin(),
2228 hit_iter_end = neighbor_hits[ ii ].
end();
2229 hit_iter != hit_iter_end; ++hit_iter ) {
2234 for ( HitHasher::HitHash::const_iterator halfbin_iter = hit_hasher.
hit_hash_begin( 1 );
2235 halfbin_iter != hit_hasher.
hit_hash_end( 1 ); ++halfbin_iter ) {
2239 if ( matches[ ii ].begin() == matches[ ii ].end() )
continue;
2244 bool all_same(
true );
2245 for ( std::list< Hit const * >::const_iterator
2246 hit_iter = matches[ ii ].begin(), hit_iter_end = matches[ ii ].
end();
2247 hit_iter != hit_iter_end; ++hit_iter ) {
2248 if ( build_point == 0 ) {
2249 build_point = (*hit_iter)->first()[ 1 ];
2250 }
else if ( build_point != (*hit_iter)->first()[ 1 ] ) {
2256 Size len = matches[ ii ].size();
2258 subsamples[ ii ].push_back( * matches[ ii ].begin() );
2262 std::list< Hit const * >::const_iterator hit_iter = matches[ ii ].begin();
2263 Size nsteps =
static_cast< Size > (
RG.uniform() * len );
2264 for (
Size jj = 1; jj <= nsteps; ++jj ) ++hit_iter;
2265 subsamples[ ii ].push_back( * hit_iter );
2269 std::map< Size, std::list< Hit const * > > buildpos_hitmap;
2270 for ( std::list< Hit const * >::const_iterator
2271 hit_iter = matches[ ii ].begin(), hit_iter_end = matches[ ii ].
end();
2272 hit_iter != hit_iter_end; ++hit_iter ) {
2273 buildpos_hitmap[ (*hit_iter)->first()[ 1 ] ].push_back( *hit_iter );
2275 for ( std::map<
Size, std::list< Hit const * > >::const_iterator
2276 builditer = buildpos_hitmap.begin(), builditer_end = buildpos_hitmap.end();
2277 builditer != builditer_end; ++builditer ) {
2278 Size len = builditer->second.size();
2280 subsamples[ ii ].push_back( * builditer->second.begin() );
2284 std::list< Hit const * >::const_iterator hit_iter = builditer->second.begin();
2285 Size nsteps =
static_cast< Size > (
RG.uniform() * len );
2286 for (
Size jj = 1; jj <= nsteps; ++jj ) ++hit_iter;
2287 subsamples[ ii ].push_back( * hit_iter );
2299 Vector const & euclidean_bin_widths,
2300 Vector const & euler_bin_widths,
2302 Size accuracy_threshold
2305 assert( ! neighbor_hits[ 1 ].empty() );
2309 Real log_n_combos = std::log( (
double) neighbor_hits[ 1 ].
size() );
2310 TR <<
"predict_n_matches_for_hit_subsets with #hits for each geomcst: " << neighbor_hits[ 1 ].size();
2313 Size ii_nhits = neighbor_hits[ ii ].size();
2314 if ( ii_nhits == 0 ) {
TR << std::endl;
return 0; }
2315 log_n_combos += std::log( (
double) ii_nhits ) ;
2316 TR <<
" " << ii_nhits;
2321 if ( log_n_combos < std::log( (
double) accuracy_threshold ) )
return static_cast< Size > ( exp( log_n_combos )) + 1;
2329 Size count_non_upstream_only_hits( 0 );
2335 count_non_upstream_only_hits = 0;
2338 ++count_non_upstream_only_hits;
2339 match_counter.
add_hits( count_non_upstream_only_hits, neighbor_hits[ ii ] );
2370 for (
Size ii = 1; ii <= 64; ++ii ) {
2377 for ( std::list< Hit const * >::const_iterator iter = neighbor_hits[ jj ].begin(),
2378 iter_end = neighbor_hits[ jj ].
end(); iter != iter_end; ++iter ) {
2386 for ( HitHasher::HitHash::const_iterator
2389 iter != iter_end; ++iter ) {
2405 bool any_size_zero(
false );
2408 n_hits_per_geomcst[ jj ] = match_set[ jj ].size();
2409 any_size_zero |= n_hits_per_geomcst[ jj ] == 0;
2410 hit_vectors[ jj ].resize( n_hits_per_geomcst[ jj ] );
2411 std::copy( match_set[ jj ].begin(), match_set[ jj ].
end(), hit_vectors[ jj ].begin());
2413 n_hits_per_geomcst[ jj ] = 1;
2416 if ( any_size_zero )
continue;
2421 utility::LexicographicalIterator lex( n_hits_per_geomcst );
2424 while ( ! lex.at_end() ) {
2430 mlite[ jj ] = hit_vectors[ jj ][ reps[jj][lex[ jj ]] ];
2431 m[ jj ] = *(hit_vectors[ jj ][ reps[jj][lex[ jj ]] ] );
2434 else mlite[jj] = NULL;
2449 numeric::geometry::hashing::Bin6D lower_halfbin_spanned( 1 );
2452 numeric::geometry::hashing::Bin6D hit_halfbin = hit_hasher.
binner( ii ).halfbin6( m[ jj ].second() );
2453 for (
Size kk = 1; kk <= 6; ++kk ) {
2454 lower_halfbin_spanned[ kk ] *= hit_halfbin[ kk ];
2458 bool go_to_next_match(
false );
2459 for (
Size jj = 1; jj <= 6; ++jj ) {
2460 if ( lower_halfbin_spanned[ jj ] != 0 ) {
2462 go_to_next_match =
true;
2466 if ( go_to_next_match ) {
2480 Size last_upstream_only_geomcst_advanced( 0 );
2482 if ( last_upstream_only_geomcst_advanced != 0 ) {
2483 Size const lgca = last_upstream_only_geomcst_advanced;
2484 mlite[ lgca ] = *upstream_only_hit_iterators[ lgca ];
2485 m[ lgca ] = **upstream_only_hit_iterators[ lgca ];
2488 Size empty_hitlist_id( 0 );
2492 hits_to_include_with_partial_match( m1 );
2493 if ( upstream_only_hits[ jj ] == 0 ) {
2494 empty_hitlist_id = jj;
2497 upstream_only_hit_iterators[ jj ] = upstream_only_hits[ jj ]->val().begin();
2498 mlite[ jj ] = *upstream_only_hit_iterators[ jj ];
2499 m[ jj ] = **upstream_only_hit_iterators[ jj ];
2501 last_upstream_only_geomcst_advanced = jj;
2504 if ( empty_hitlist_id != 0 ) {
2508 upstream_only_hit_iterators, last_upstream_only_geomcst_advanced ) )
break;
2513 m, upstream_only_hits, upstream_only_hit_iterators,
2514 last_upstream_only_geomcst_advanced, processor ) ) {
2517 if ( last_upstream_only_geomcst_advanced == 0 )
break;
2527 upstream_only_hit_iterators,
2528 last_upstream_only_geomcst_advanced )) {
2548 typedef utility::fixedsizearray1< Size, 2 > Size2;
2549 typedef utility::OrderedTuple< Size2 > Size2Tuple;
2550 typedef std::map< Size2Tuple, Hit const * > UpstreamRotamerRepresentativeMap;
2551 typedef UpstreamRotamerRepresentativeMap::const_iterator UpRotRepMapConstIterator;
2557 for ( std::list< Hit >::const_iterator hititer =
hits_[ ii ].begin(),
2558 hititer_end =
hits_[ ii ].
end(); hititer != hititer_end; ++hititer ) {
2560 rotid[ 1 ] = hititer->scaffold_build_id();
2561 rotid[ 2 ] = hititer->upstream_conf_id();
2562 UpRotRepMapConstIterator representative = upstream_rotamer_representatives[ ii ].find( rotid );
2563 if ( representative == upstream_rotamer_representatives[ ii ].
end() ) {
2564 upstream_rotamer_representatives[ ii ][ rotid ] = & (*hititer);
2573 TR <<
"Begining match enumeration:" << std::endl;
2575 TR <<
"Geometric constraint " << ii <<
" produced " <<
hits_[ ii ].size() <<
" hits" << std::endl;
2578 TR <<
"Begining examination of each of the 64 definitions of the 6D-hash-grid origin:" << std::endl;
2582 for (
Size ii = 1; ii <=
hits_.size(); ++ii ) {
2586 finders[ii].initialize();
2587 finders[ii].add_hits(
hits_[ ii ] );
2590 TR <<
"CONNECTED COMPONENTS: " << hit_ccs.size() << std::endl;
2591 for (
Size ii = 1; ii <= hit_ccs.size(); ++ii ) {
2592 Size n_combos = hit_ccs[ ii ].size();
2593 std::cout <<
"CC " << ii <<
" num neighbors: 1: " << hit_ccs[ ii ].size();
2595 ii_neighbor_hits[ 1 ] = hit_ccs[ ii ];
2596 for (
Size jj = 2; jj <=
hits_.size(); ++jj ) {
2597 ii_neighbor_hits[ jj ] = finders[ jj ].neighbor_hits( hit_ccs[ ii ] );
2598 Size jj_nhits = ii_neighbor_hits[ jj ].size();
2600 std::cout <<
" " << jj <<
"= " << jj_nhits ;
2602 std::cout <<
" ncombos: " << n_combos << std::endl;
2623 for (
Size jj = 1; jj <= 64; ++jj ) {
2626 for ( std::list< Hit >::const_iterator iter =
hits_[ kk ].begin(), iter_end =
hits_[ kk ].
end();
2627 iter != iter_end; ++iter ) {
2629 hit_scaff_build_pts[ kk ][ iter->first()[ 1 ] ] =
true;
2634 for ( HitHasher::HitHash::const_iterator
2637 iter != iter_end; ++iter ) {
2652 bool any_size_zero(
false );
2655 n_hits_per_geomcst[ kk ] = match_set[ kk ].size();
2656 if ( n_hits_per_geomcst[ kk ] == 0 ) {
2657 any_size_zero =
true;
2660 hit_vectors[ kk ].resize( n_hits_per_geomcst[ kk ] );
2661 std::copy( match_set[ kk ].begin(), match_set[ kk ].
end(), hit_vectors[ kk ].begin());
2663 std::list< Hit const * > hit_representatives;
2664 for (
Size ll = 1; ll <= match_set[ kk ].size(); ++ll ) {
2665 Size2 upstream_rotamer;
2666 upstream_rotamer[ 1 ] = hit_vectors[ kk ][ ll ]->scaffold_build_id();
2667 upstream_rotamer[ 2 ] = hit_vectors[ kk ][ ll ]->upstream_conf_id();
2668 hit_representatives.push_back( upstream_rotamer_representatives[ kk ][ upstream_rotamer ] );
2670 hit_representatives.sort();
2671 hit_representatives.unique();
2672 n_unique_upstream_rots[ kk ] = hit_representatives.size();
2673 unique_hit_representatives[ kk ].resize( n_unique_upstream_rots[ kk ] );
2674 std::copy( hit_representatives.begin(), hit_representatives.end(), unique_hit_representatives[ kk ].begin() );
2676 n_unique_upstream_rots[ kk ] = 1;
2679 if ( any_size_zero )
continue;
2694 n_hits_to_enumerate[ ll ] = n_hits_per_geomcst[ ll ];
2696 n_hits_to_enumerate[ ll ] = n_unique_upstream_rots[ ll ];
2700 utility::LexicographicalIterator lex( n_hits_to_enumerate );
2702 while ( ! lex.at_end() ) {
2707 mlite[ ll ] = hit_vectors[ ll ][ lex[ll] ];
2711 m1.
dspos = hit_vectors[ ll ][ lex[ll] ]->second();
2713 mlite[ ll ] = unique_hit_representatives[ ll ][ lex[ll] ];
2715 m1.
upstream_hits[ ll ].copy_hit( *(unique_hit_representatives[ ll ][ lex[ll] ]) );
2727 Size last_upstream_only_geomcst_advanced( 0 );
2729 if ( last_upstream_only_geomcst_advanced != 0 ) {
2730 Size const lgca = last_upstream_only_geomcst_advanced;
2731 mlite[ lgca ] = *upstream_only_hit_iterators[ lgca ];
2735 Size empty_hitlist_id( 0 );
2739 hits_to_include_with_partial_match( m1 );
2740 if ( upstream_only_hits[ kk ] == 0 ) {
2741 empty_hitlist_id = kk;
2744 upstream_only_hit_iterators[ kk ] = upstream_only_hits[ kk ]->val().begin();
2745 mlite[ kk ] = *upstream_only_hit_iterators[ kk ];
2748 last_upstream_only_geomcst_advanced = kk;
2751 if ( empty_hitlist_id != 0 ) {
2754 upstream_only_hit_iterators, last_upstream_only_geomcst_advanced );
2758 m1, upstream_only_hits, upstream_only_hit_iterators,
2759 last_upstream_only_geomcst_advanced, processor ) ) {
2761 if ( last_upstream_only_geomcst_advanced == 0 )
break;
2776 upstream_only_hit_iterators,
2777 last_upstream_only_geomcst_advanced )) {
2787 std::cout <<
"." << std::flush;
2788 if ( jj % 20 == 0 ) std::cout << std::endl;
2791 std::cout << std::endl;