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

Add trp man torsions analysis to mk5 #112

Open
wants to merge 2 commits into
base: mk5_changes
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
2 changes: 1 addition & 1 deletion data/linkage_torsions/privateer_torsion_database.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

24 changes: 22 additions & 2 deletions src/privateer/cpp/clipper-glyco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4999,6 +4999,7 @@ void MGlycan::Linkage::calculate_and_set_zscore(float Phi, float Psi, clipper::S
"NAG-1,3-FUC",
"MAN-1,2-NAG",
"NAG-1,4-GAL",
"TRP-1,1-MAN",
};
std::string linkage_name = donor_sugar + "-" + acceptor_position + "," + donor_position + "-" + acceptor_sugar;

Expand Down Expand Up @@ -5523,13 +5524,32 @@ void MGlycology::init ( const clipper::MiniMol& mmol, const clipper::MAtomNonBon
aa_atom_bravo.coord_orth() );


if ( psi < 0 )
psi = clipper::Util::twopi() + psi;
//if ( psi < 0 )
// psi = clipper::Util::twopi() + psi;


mg.set_glycosylation_torsions ( clipper::Util::rad2d(phi), clipper::Util::rad2d(psi) );
mg.add_torsions_for_detected_linkages(clipper::Util::rad2d(phi), clipper::Util::rad2d(psi), potential_c_roots[i].first.type().trim(), cd1, sugar.type().trim(), c1, potential_c_roots[i].first.seqnum(), sugar.seqnum());

if(!torsions_zscore_database.database_array.empty())
{
mg.set_protein_sugar_linkage_zscore_attempt_to_calculate(true);
std::string amino_acid = potential_c_roots[i].first.type().trim();
std::string donor_position = std::regex_replace(cd1.name().trim(), std::regex(R"([^\d])"), "");
std::string first_sugar = sugar.type().trim();
std::string acceptor_position = std::regex_replace(c1.name().trim(), std::regex(R"([^\d])"), "");
auto search_result_in_torsions_zscore_db = std::find_if(torsions_zscore_database.database_array.begin(), torsions_zscore_database.database_array.end(), [amino_acid, donor_position, acceptor_position, first_sugar](privateer::json::TorsionsZScoreDatabase& element)
{
return amino_acid == element.donor_sugar && donor_position == element.donor_end && acceptor_position == element.acceptor_end && first_sugar == element.acceptor_sugar;
});
if(search_result_in_torsions_zscore_db != std::end(torsions_zscore_database.database_array))
{
privateer::json::TorsionsZScoreDatabase& found_torsion_description = *search_result_in_torsions_zscore_db;
float linkage_score = mg.calculate_zscore(clipper::Util::rad2d(phi), clipper::Util::rad2d(psi), found_torsion_description);
mg.set_protein_sugar_linkage_zscore(linkage_score);
}
}

if ( linked[j].second.monomer()+3 < mmol[linked[j].second.polymer()].size() )
// Make sure that checks for consensus sequence do not occur outside the array, therefore causing segfaults.
{
Expand Down
15 changes: 14 additions & 1 deletion src/privateer/cpp/privateer-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,7 @@ bool privateer::util::do_report_linkage(std::string d_pos, std::string d_atom, s
"NAG-1,3-FUC",
"MAN-1,2-NAG",
"NAG-1,4-GAL",
"TRP-1,1-MAN",
};

std::string name = d_pos + "-" + d_atom + "," + a_atom + "-" + a_pos ;
Expand Down Expand Up @@ -2450,7 +2451,7 @@ bool privateer::glycanbuilderplot::Plot::plot_glycan ( clipper::MGlycan glycan )

const clipper::MGlycan::Node node = glycan.get_node ( 0 ); // get the first node

if(glycan.get_type() == "n-glycan")
if(glycan.get_type() == "n-glycan" || glycan.get_type() == "c-glycan")
{
if (node.get_sugar().type().trim() == "NAG" && glycan.get_root().first.type().trim() == "ASN")
{
Expand All @@ -2464,6 +2465,18 @@ bool privateer::glycanbuilderplot::Plot::plot_glycan ( clipper::MGlycan glycan )
add_shaded_link(new_shaded_bond);
}
}
else if (node.get_sugar().type().trim() == "MAN" && glycan.get_root().first.type().trim() == "TRP")
{
float link_zscore = glycan.get_protein_sugar_linkage_zscore();
if(link_zscore < -1 && link_zscore != 42069 && glycan.get_protein_sugar_linkage_zscore_attempt_to_calculate())
{
std::ostringstream os;
os << "Linkage Z-Score = " << std::setprecision(3) << link_zscore << "\nWarning: Sample size is small. Check torsion plot to validate.";
std::string message = os.str();
shadedBond * new_shaded_bond = new shadedBond( 2800, 1015, side, message, "shadedbond", mmdbsel );
add_shaded_link(new_shaded_bond);
}
}
else
{
if (glycan.get_protein_sugar_linkage_zscore_attempt_to_calculate())
Expand Down