Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for RosettaCM and branched glycans #221

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
39 changes: 28 additions & 11 deletions source/src/core/conformation/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

// Unit headers
#include <core/conformation/util.hh>
#include <core/conformation/carbohydrates/util.hh>

// Package headers
#include <core/conformation/Conformation.hh>
Expand Down Expand Up @@ -319,20 +320,36 @@ idealize_position(

if ( rsd.is_polymer() ) {
// add polymer nbrs?
if ( seqpos > 1 && !rsd.is_lower_terminus() && !conformation.fold_tree().is_cutpoint( seqpos-1 ) ) {
lower_connect = true;
ResidueOP prev_rsd( ResidueFactory::create_residue( conformation.residue( seqpos-1 ).type() ) );
idl.prepend_polymer_residue_before_seqpos( *prev_rsd, 1, true );
idl_pos = 2;
}
if ( rsd.is_carbohydrate() ) {
if ( seqpos > 1 && !rsd.is_lower_terminus() ) {
lower_connect = true;
core::Size parent_res_seqpos( conformation::carbohydrates::find_seqpos_of_saccharides_parent_residue( rsd ) );
ResidueOP prev_rsd( ResidueFactory::create_residue( conformation.residue( parent_res_seqpos ).type() ) );
idl.prepend_polymer_residue_before_seqpos( *prev_rsd, 1, true );
idl_pos = 2;
}

if ( seqpos < conformation.size() && !rsd.is_upper_terminus() && !conformation.fold_tree().is_cutpoint( seqpos ) ) {
upper_connect = true;
core::Size child_res_seqpos( conformation::carbohydrates::find_seqpos_of_saccharides_mainchain_child( rsd ) );
ResidueOP next_rsd( ResidueFactory::create_residue( conformation.residue( child_res_seqpos ).type() ) );
idl.append_polymer_residue_after_seqpos( *next_rsd, idl_pos, true );
}
} else {
if ( seqpos > 1 && !rsd.is_lower_terminus() && !conformation.fold_tree().is_cutpoint( seqpos-1 ) ) {
lower_connect = true;
ResidueOP prev_rsd( ResidueFactory::create_residue( conformation.residue( seqpos-1 ).type() ) );
idl.prepend_polymer_residue_before_seqpos( *prev_rsd, 1, true );
idl_pos = 2;
}

if ( seqpos < conformation.size() && !rsd.is_upper_terminus() && !conformation.fold_tree().is_cutpoint( seqpos ) ) {
upper_connect = true;
ResidueOP next_rsd( ResidueFactory::create_residue( conformation.residue( seqpos+1 ).type() ) );
idl.append_polymer_residue_after_seqpos( *next_rsd, idl_pos, true );
if ( seqpos < conformation.size() && !rsd.is_upper_terminus() && !conformation.fold_tree().is_cutpoint( seqpos ) ) {
upper_connect = true;
ResidueOP next_rsd( ResidueFactory::create_residue( conformation.residue( seqpos+1 ).type() ) );
idl.append_polymer_residue_after_seqpos( *next_rsd, idl_pos, true );
}
}
}

//// now set the torsion angles in the ideal conformation... This is to prepare for replacing rsd with
//// the idealized version

Expand Down
39 changes: 38 additions & 1 deletion source/src/protocols/hybridization/HybridizeProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

#include <core/conformation/Residue.hh>
#include <core/conformation/util.hh>
#include <core/conformation/carbohydrates/util.hh>

#include <core/kinematics/FoldTree.hh>
#include <core/kinematics/MoveMap.hh>
Expand Down Expand Up @@ -1292,12 +1293,48 @@ void HybridizeProtocol::apply( core::pose::Pose & pose )
for ( core::Size ires=1; ires <= templates_[initial_template_index]->size(); ++ires ) {
if ( templates_[initial_template_index]->pdb_info()->number(ires) > (int)nres_tgt ) {
TR.Debug << "Insert hetero residue: " << templates_[initial_template_index]->residue(ires).name3() << std::endl;
if ( templates_[initial_template_index]->residue(ires).is_polymer()
if ( templates_[initial_template_index]->residue(ires).is_carbohydrate() ) {
if ( !templates_[initial_template_index]->residue(ires).is_lower_terminus() ) {
core::Size offset = pose.size() + 1 - ires;
core::Size parent_res_seqpos( conformation::carbohydrates::find_seqpos_of_saccharides_parent_residue( templates_[initial_template_index]->residue(ires) ) );
int self_lower=0;
int parent_upper=0;
//self_lower = templates_[initial_template_index]->residue(ires).lower_connect_id();
//parent_upper = templates_[initial_template_index]->residue(parent_res_seqpos).connect_atom( templates_[initial_template_index]->residue(ires) );
for ( core::Size i(1); i <= templates_[initial_template_index]->residue(ires).connect_map_size(); ++i ) {
TR.Debug<<" "<<i<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_partner(i)<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_conn_id(i)<<std::endl;
if ( templates_[initial_template_index]->residue(ires).connect_map( i ).resid() == parent_res_seqpos ) {
//self_lower = templates_[initial_template_index]->residue(ires).connect_map( i ).connid();
self_lower = i;
parent_upper=templates_[initial_template_index]->residue(ires).connect_map( i ).connid();
//parent_upper=templates_[initial_template_index]->residue(ires).residue_connection_conn_id(i);
}
}
parent_res_seqpos += offset;
TR.Debug <<" appending by bond "<<pose.size()+1<<" lower "<<self_lower<<" anchor "<<parent_res_seqpos<<" parent upper "<<parent_upper<<std::endl;
pose.append_residue_by_bond(templates_[initial_template_index]->residue(ires), false, self_lower, parent_res_seqpos, parent_upper, false, false);
} else {
TR.Debug <<" appending by jump "<<ires<<" is Polymer "<<templates_[initial_template_index]->residue(ires).is_polymer()<<" is Lower "<<templates_[initial_template_index]->residue(ires).is_lower_terminus()<<" is Upper "<<pose.residue(pose.size()).is_upper_terminus()<<std::endl;
for ( core::Size i(1); i <= templates_[initial_template_index]->residue(ires).connect_map_size(); ++i ) {
TR.Debug<<" "<<i<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_partner(i)<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_conn_id(i)<<std::endl;
}
pose.append_residue_by_jump(templates_[initial_template_index]->residue(ires), 1);

}
} else if ( templates_[initial_template_index]->residue(ires).is_polymer()
&& !templates_[initial_template_index]->residue(ires).is_lower_terminus()
&& !pose.residue(pose.size()).is_upper_terminus() ) {
TR.Debug <<" appending by bond "<<ires<<std::endl;
pose.append_residue_by_bond(templates_[initial_template_index]->residue(ires));
for ( core::Size i(1); i <= templates_[initial_template_index]->residue(ires).connect_map_size(); ++i ) {
TR.Debug<<" "<<i<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_partner(i)<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_conn_id(i)<<std::endl;
}
} else {
TR.Debug <<" appending by jump "<<ires<<" is Polymer "<<templates_[initial_template_index]->residue(ires).is_polymer()<<" is Lower "<<templates_[initial_template_index]->residue(ires).is_lower_terminus()<<" is Upper "<<pose.residue(pose.size()).is_upper_terminus()<<std::endl;
pose.append_residue_by_jump(templates_[initial_template_index]->residue(ires), 1);
for ( core::Size i(1); i <= templates_[initial_template_index]->residue(ires).connect_map_size(); ++i ) {
TR.Debug<<" "<<i<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_partner(i)<<" "<<templates_[initial_template_index]->residue(ires).residue_connection_conn_id(i)<<std::endl;
}
}
hetatms.push_back( std::make_pair( ires, pose.size() ) );
}
Expand Down