Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ ADD_BOND 3HN CN
#APPEND_MAINCHAIN_ATOM NM
#APPEND_MAINCHAIN_ATOM CN

SET_ICOOR NM -178.525514 65.210767 1.349313 C Ca O
SET_ICOOR CN 173.715548 58.286172 1.449020 NM C Ca
SET_ICOOR NM -178.525514 65.210767 1.349313 C CA O
SET_ICOOR CN 173.715548 58.286172 1.449020 NM C CA
SET_ICOOR 1HN -72.124155 68.240467 1.083554 CN NM C
SET_ICOOR 2HN 120.381913 70.210033 1.080230 CN NM 1HN
SET_ICOOR 3HN 119.184435 71.274589 1.081917 CN NM 2HN
Expand Down Expand Up @@ -368,8 +368,8 @@ ADD_BOND 3HN CN
#APPEND_MAINCHAIN_ATOM NM
#APPEND_MAINCHAIN_ATOM CN

SET_ICOOR NM -178.525514 65.210767 1.349313 C Ca O
SET_ICOOR CN 173.715548 58.286172 1.449020 NM C Ca
SET_ICOOR NM -178.525514 65.210767 1.349313 C CA O
SET_ICOOR CN 173.715548 58.286172 1.449020 NM C CA
SET_ICOOR 1HN -72.124155 68.240467 1.083554 CN NM C
SET_ICOOR 2HN 120.381913 70.210033 1.080230 CN NM 1HN
SET_ICOOR 3HN 119.184435 71.274589 1.081917 CN NM 2HN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ SET_ICOOR OCP -180.00 61.19 1.230 CP N CQ

# Need to prevent these from repacking
SET_BACKBONE_HEAVYATOM CP
ADD_ATOM CQ VIRT CT3 0.00 ## This is the methyl carbon of the acetyl group...
#ADD_ATOM CQ VIRT CT3 0.00 ## This is the methyl carbon of the acetyl group... # Already added above
#SET_BACKBONE_HEAVYATOM CQ
SET_BACKBONE_HEAVYATOM OCP

Expand Down
16 changes: 15 additions & 1 deletion source/src/core/chemical/PatchOperation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,21 @@ SetPolymerConnectAtom::apply( MutableResidueType & rsd ) const
bool
SetPolymerConnectAtom::changes_connections_on( ResidueType const & rsd_type, std::string const & atom ) const
{
return rsd_type.has( atom ) && rsd_type.has( atom_name_ ) && rsd_type.atom_index( atom ) == rsd_type.atom_index( atom_name_ );
if ( atom_name_ == "NONE" ) {
if ( upper_lower_ == -1 ) {
return rsd_type.lower_connect_id() != 0 && ( atom == "LOWER" || (
rsd_type.has( atom_name_ ) && rsd_type.atom_index( atom ) == rsd_type.lower_connect_atom() ) );
} else {
return rsd_type.upper_connect_id() != 0 && ( atom == "UPPER" || (
rsd_type.has( atom_name_ ) && rsd_type.atom_index( atom ) == rsd_type.upper_connect_atom() ) );
}
} else if ( atom == "LOWER" ) {
return upper_lower_ == -1;
} else if ( atom == "UPPER" ) {
return upper_lower_ != -1;
} else {
return rsd_type.has( atom ) && rsd_type.has( atom_name_ ) && rsd_type.atom_index( atom ) == rsd_type.atom_index( atom_name_ );
}
}


Expand Down
132 changes: 120 additions & 12 deletions source/src/core/chemical/ResidueTypeFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,12 @@ ResidueTypeCOPs
ResidueTypeFinder::apply_preferences_and_discouragements( ResidueTypeCOPs const & rsd_types ) const {
if ( rsd_types.empty() ) return rsd_types;

if ( preferred_properties_.empty() && discouraged_properties_.empty() && ! no_CCD_on_name3_match_ ) {
if ( preferred_properties_.empty() && discouraged_properties_.empty() && preferred_connects_.empty() && discouraged_connects_.empty() && ! no_CCD_on_name3_match_ ) {
return rsd_types; // nothing to do
}

if ( rsd_types.size() == 1 ) return rsd_types; // If there's only one possibility, we're going to be using it.

ResidueTypeCOPs current_type_list( rsd_types );
ResidueTypeCOPs new_type_list;

Expand Down Expand Up @@ -374,6 +376,46 @@ ResidueTypeFinder::apply_preferences_and_discouragements( ResidueTypeCOPs const
current_type_list = new_type_list;
}

if ( ! discouraged_connects_.empty() ) {
utility::vector1< core::Size > connect_counts;
for ( ResidueTypeCOP const & type: current_type_list ) {
core::Size count = 0;
for ( std::string const & connect_point: discouraged_connects_ ) {
if ( connect_point == "UPPER" && type->upper_connect_id() != 0 ) {
++count;
} else if ( connect_point == "LOWER" && type->lower_connect_id() != 0 ) {
++count;
} else if ( type->has(connect_point) && type->atom_forms_residue_connection( type->atom_index(connect_point) ) ) {
++count;
}
}
connect_counts.push_back(count);
}
debug_assert( ! connect_counts.empty() );
core::Size min_count = *std::min_element( connect_counts.begin(), connect_counts.end() );
new_type_list.clear();
for ( core::Size ii(1); ii <= current_type_list.size(); ++ii ) {
if ( connect_counts[ ii ] == min_count ) {
new_type_list.push_back( current_type_list[ ii ] );
}
}
if ( TR.Debug.visible() ) {
TR.Debug << "Discouraging " << discouraged_connects_.size() << " connection points, " <<
"going from " << current_type_list.size() << " types to " <<
new_type_list.size() << " types." << std::endl;
TR.Debug<< "Discouraged connections: " << discouraged_connects_ << std::endl;
TR.Debug<< "Going from ";
for ( auto rt: current_type_list ) { TR.Debug << " " << rt->name(); }
TR.Debug << std::endl;
TR.Debug << "To ";
for ( auto rt: new_type_list ) { TR.Debug << " " << rt->name(); }
TR.Debug << std::endl;
}

current_type_list = new_type_list;
}


if ( ! preferred_properties_.empty() ) {
utility::vector1< core::Size > property_counts;
for ( ResidueTypeCOP const & rsd_type: current_type_list ) {
Expand Down Expand Up @@ -409,6 +451,45 @@ ResidueTypeFinder::apply_preferences_and_discouragements( ResidueTypeCOPs const
current_type_list = new_type_list;
}

if ( ! preferred_connects_.empty() ) {
utility::vector1< core::Size > connect_counts;
for ( ResidueTypeCOP const & type: current_type_list ) {
core::Size count = 0;
for ( std::string const & connect_point: preferred_connects_ ) {
if ( connect_point == "UPPER" && type->upper_connect_id() != 0 ) {
++count;
} else if ( connect_point == "LOWER" && type->lower_connect_id() != 0 ) {
++count;
} else if ( type->has(connect_point) && type->atom_forms_residue_connection( type->atom_index(connect_point) ) ) {
++count;
}
}
connect_counts.push_back(count);
}
debug_assert( ! connect_counts.empty() );
core::Size max_count = *std::max_element( connect_counts.begin(), connect_counts.end() );
new_type_list.clear();
for ( core::Size ii(1); ii <= current_type_list.size(); ++ii ) {
if ( connect_counts[ ii ] == max_count ) {
new_type_list.push_back( current_type_list[ ii ] );
}
}
if ( TR.Debug.visible() ) {
TR.Debug << "Encouraging " << preferred_connects_.size() << " connection points, " <<
"going from " << current_type_list.size() << " types to " <<
new_type_list.size() << " types." << std::endl;
TR.Debug<< "Encouraged connections: " << preferred_connects_ << std::endl;
TR.Debug<< "Going from ";
for ( auto rt: current_type_list ) { TR.Debug << " " << rt->name(); }
TR.Debug << std::endl;
TR.Debug << "To ";
for ( auto rt: new_type_list ) { TR.Debug << " " << rt->name(); }
TR.Debug << std::endl;
}

current_type_list = new_type_list;
}

current_type_list = prioritize_rosetta_types_over_pdb_components( current_type_list );

return current_type_list;
Expand Down Expand Up @@ -774,23 +855,50 @@ ResidueTypeFinder::fixes_interchangeability_group( PatchCOP patch, ResidueTypeCO
}

////////////////////////////////////////////////////////////////////////////////////////////////////
bool
adds_connects_helper( PatchCOP patch, ResidueTypeCOP rsd_type, std::string const & atom ) {
if ( rsd_type->has(atom) ) {
// patch->changes_connections_on() should be whitespace padding insensitive.
if ( rsd_type->residue_connections_for_atom( rsd_type->atom_index(atom) ).empty() &&
patch->changes_connections_on( *rsd_type, atom ) ) {
return true;
}
} else {
// Don't have the atom -- get patches which may add the atom.
if ( patch->adds_atoms( *rsd_type ).has_value( atom ) ) {
return true;
}
}
return false;
}

bool
ResidueTypeFinder::fixes_connects( PatchCOP patch, ResidueTypeCOP rsd_type ) const {
if ( connect_atoms_.empty() ) return false; // Can't fix what isn't broken.

for ( std::string const & atom: connect_atoms_ ) {
if ( rsd_type->has(atom) ) {
// patch->changes_connections_on() should be whitespace padding insensitive.
if ( rsd_type->residue_connections_for_atom( rsd_type->atom_index(atom) ).empty() &&
patch->changes_connections_on( *rsd_type, atom ) ) {
return true;
}
if ( adds_connects_helper( patch, rsd_type, atom ) ) { return true; }
}

for ( std::string const & atom: preferred_connects_ ) {
if ( atom == "LOWER" && rsd_type->lower_connect_id() == 0 ) {
if ( patch->changes_connections_on( *rsd_type, atom ) ) { return true; }
} else if ( atom == "UPPER" && rsd_type->upper_connect_id() == 0 ) {
if ( patch->changes_connections_on( *rsd_type, atom ) ) { return true; }
} else {
// Don't have the atom -- get patches which may add the atom.
if ( patch->adds_atoms( *rsd_type ).has_value( atom ) ) {
return true;
}
if ( adds_connects_helper( patch, rsd_type, atom ) ) { return true; }
}
}

for ( std::string const & atom: discouraged_connects_ ) {
if ( atom == "LOWER" && rsd_type->lower_connect_id() != 0 ) {
if ( patch->changes_connections_on( *rsd_type, atom ) ) { return true; }
} else if ( atom == "UPPER" && rsd_type->upper_connect_id() != 0 ) {
if ( patch->changes_connections_on( *rsd_type, atom ) ) { return true; }
} else if ( rsd_type->has( atom ) && rsd_type->atom_forms_residue_connection( rsd_type->atom_index(atom) ) ) {
if ( patch->changes_connections_on( *rsd_type, atom ) ) { return true; }
}
}

return false;
}

Expand Down
18 changes: 18 additions & 0 deletions source/src/core/chemical/ResidueTypeFinder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ public:
return *this;
}

/// @brief The atom name (or UPPER/LOWER) of the connection points that should be preferred
/// Will not eliminate residues if those connection points are not present
ResidueTypeFinder &
preferred_connects( utility::vector1< std::string > const & setting ) {
preferred_connects_ = setting;
return *this;
}

/// @brief The atom name (or UPPER/LOWER) of the connection points that should be avoided
/// Will not eliminate residues if all possibilities have that connection point
ResidueTypeFinder &
discouraged_connects( utility::vector1< std::string > const & setting ) {
discouraged_connects_ = setting;
return *this;
}

ResidueTypeFinder &
patch_names( utility::vector1< std::string > const & setting ) {
patch_names_ = setting;
Expand Down Expand Up @@ -389,6 +405,8 @@ private:
utility::vector1< ResidueProperty > disallow_properties_; // Properties which must not be present
utility::vector1< ResidueProperty > preferred_properties_; // Does not affect filtering, but may cause additional patches to be applied
utility::vector1< ResidueProperty > discouraged_properties_; // Only affects filtering if alternatives are present.
utility::vector1< std::string > preferred_connects_; // Only affects filtering if alternatives are present
utility::vector1< std::string > discouraged_connects_; // Only affects filtering if alternatives are present
utility::vector1< std::string > patch_names_;

utility::vector1< std::string > connect_atoms_;
Expand Down
12 changes: 8 additions & 4 deletions source/src/core/io/pose_from_sfr/PoseFromSFRBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,7 @@ PoseFromSFRBuilder::get_rsd_type(
using utility::vector1;

vector1< ResidueProperty > preferred_properties, discouraged_properties;
vector1< std::string > preferred_connects, discouraged_connects;
vector1< VariantType > variants, disallow_variants;

std::string residue_base_name( "" ); // used when we have more information then just a 3-letter code
Expand All @@ -1982,19 +1983,20 @@ PoseFromSFRBuilder::get_rsd_type(
if ( known_connect_atoms_on_this_residue.contains( "P" ) || known_connect_atoms_on_this_residue.contains( "N" ) ) {
variants.push_back( CUTPOINT_UPPER );
} else {
preferred_properties.push_back( LOWER_TERMINUS );
discouraged_connects.push_back( "LOWER" );
}
} else {
discouraged_properties.push_back( LOWER_TERMINUS );
// Non-terminus probably means we need a polymeric connection ... probably
preferred_connects.push_back( "LOWER" );
}
if ( is_upper_terminus ) {
if ( known_connect_atoms_on_this_residue.contains( "O3'" ) || known_connect_atoms_on_this_residue.contains( "C" ) ) {
variants.push_back( CUTPOINT_LOWER );
} else {
preferred_properties.push_back( UPPER_TERMINUS );
discouraged_connects.push_back( "UPPER" );
}
} else {
discouraged_properties.push_back( UPPER_TERMINUS );
preferred_connects.push_back( "UPPER" );
}
if ( is_d_aa ) {
preferred_properties.push_back( D_AA );
Expand Down Expand Up @@ -2024,6 +2026,8 @@ PoseFromSFRBuilder::get_rsd_type(
.disallow_variants( disallow_variants )
.preferred_properties( preferred_properties )
.discouraged_properties( discouraged_properties )
.preferred_connects( preferred_connects )
.discouraged_connects( discouraged_connects )
.patch_names( patch_names )
.ignore_atom_named_H( is_lower_terminus )
.check_nucleic_acid_virtual_phosphates( true )
Expand Down
2 changes: 2 additions & 0 deletions source/test/core.test.settings
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,8 @@ testinputfiles = [
"io/pose_from_sfr/cyclic_pep_with_link.pdb",
"io/pose_from_sfr/1rgr_apo.pdb",
"io/pose_from_sfr/1IJ3_cleaned.pdb",
"io/pose_from_sfr/NOT_TES.params",
"io/pose_from_sfr/NOT_TES.pdb",
"io/pose_to_sfr/2_peptides_2_glycan_ligands.pdb",
"io/silent/cyclic_peptide_binary_silent.silent",
"io/silent/cyclic_peptide_binary_silent_duplicated_header.silent",
Expand Down
Loading