Commit 9e1fdea3 by Maarten L. Hekkelman

Write BEND and (optionally) OTHER

parent 969dfb17
......@@ -269,7 +269,7 @@ void writeDSSP(const mmcif::Structure& structure, const mmcif::DSSP& dssp, std::
// }
}
void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ostream& os)
void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, bool writeOther, std::ostream& os)
{
auto& db = structure.getFile().data();
......@@ -291,7 +291,6 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ost
auto st = dssp.begin(), lt = st;
auto lastSS = st->ss();
std::string id;
for (auto t = dssp.begin(); ; lt = t, ++t)
{
......@@ -299,52 +298,13 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ost
bool flush = (stop or t->ss() != lastSS);
if (flush and lastSS != mmcif::SecondaryStructureType::ssLoop)
if (flush and (writeOther or lastSS != mmcif::SecondaryStructureType::ssLoop))
{
auto& rb = st->residue();
auto& re = lt->residue();
structConf.emplace({
{ "conf_type_id", id },
{ "id", id + std::to_string(foundTypes[id]++) },
// { "pdbx_PDB_helix_id", vS(12, 14) },
{ "beg_label_comp_id", rb.compoundID() },
{ "beg_label_asym_id", rb.asymID() },
{ "beg_label_seq_id", rb.seqID() },
{ "pdbx_beg_PDB_ins_code", rb.authInsCode() },
{ "end_label_comp_id", re.compoundID() },
{ "end_label_asym_id", re.asymID() },
{ "end_label_seq_id", re.seqID() },
{ "pdbx_end_PDB_ins_code", re.authInsCode() },
{ "beg_auth_comp_id", rb.compoundID() },
{ "beg_auth_asym_id", rb.authAsymID() },
{ "beg_auth_seq_id", rb.authSeqID() },
{ "end_auth_comp_id", re.compoundID() },
{ "end_auth_asym_id", re.authAsymID() },
{ "end_auth_seq_id", re.authSeqID() }
// { "pdbx_PDB_helix_class", vS(39, 40) },
// { "details", vS(41, 70) },
// { "pdbx_PDB_helix_length", vI(72, 76) }
});
st = t;
}
if (lastSS != t->ss())
{
st = t;
lastSS = t->ss();
}
if (stop)
break;
if (not flush)
continue;
switch (t->ss())
std::string id;
switch (lastSS)
{
case mmcif::SecondaryStructureType::ssHelix_3:
id = "HELX_RH_3T_P";
......@@ -367,7 +327,7 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ost
break;
case mmcif::SecondaryStructureType::ssBend:
id = "TURN_P";
id = "BEND";
break;
case mmcif::SecondaryStructureType::ssBetabridge:
......@@ -375,14 +335,11 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ost
id = "STRN";
break;
default:
id.clear();
case mmcif::SecondaryStructureType::ssLoop:
id = "OTHER";
break;
}
if (id.empty())
continue;
if (foundTypes.count(id) == 0)
{
structConfType.emplace({
......@@ -391,6 +348,43 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ost
});
foundTypes[id] = 1;
}
structConf.emplace({
{ "conf_type_id", id },
{ "id", id + std::to_string(foundTypes[id]++) },
// { "pdbx_PDB_helix_id", vS(12, 14) },
{ "beg_label_comp_id", rb.compoundID() },
{ "beg_label_asym_id", rb.asymID() },
{ "beg_label_seq_id", rb.seqID() },
{ "pdbx_beg_PDB_ins_code", rb.authInsCode() },
{ "end_label_comp_id", re.compoundID() },
{ "end_label_asym_id", re.asymID() },
{ "end_label_seq_id", re.seqID() },
{ "pdbx_end_PDB_ins_code", re.authInsCode() },
{ "beg_auth_comp_id", rb.compoundID() },
{ "beg_auth_asym_id", rb.authAsymID() },
{ "beg_auth_seq_id", rb.authSeqID() },
{ "end_auth_comp_id", re.compoundID() },
{ "end_auth_asym_id", re.authAsymID() },
{ "end_auth_seq_id", re.authSeqID() }
// { "pdbx_PDB_helix_class", vS(39, 40) },
// { "details", vS(41, 70) },
// { "pdbx_PDB_helix_length", vI(72, 76) }
});
st = t;
}
if (lastSS != t->ss())
{
st = t;
lastSS = t->ss();
}
if (stop)
break;
}
}
......@@ -631,6 +625,8 @@ int pr_main(int argc, char* argv[])
("min-pp-stretch", po::value<short>(), "Minimal number of residues having PSI/PHI in range for a PP helix, default is 3")
("write-other", "If set, write the type OTHER for loops, default is to leave this out")
("verbose,v", "verbose output")
;
......@@ -703,6 +699,8 @@ int pr_main(int argc, char* argv[])
if (vm.count("min-pp-stretch"))
pp_stretch = vm["min-pp-stretch"].as<short>();
bool writeOther = vm.count("write-other");
std::string fmt;
if (vm.count("output-format"))
fmt = vm["output-format"].as<std::string>();
......@@ -748,14 +746,14 @@ int pr_main(int argc, char* argv[])
if (fmt == "dssp")
writeDSSP(structure, dssp, out);
else
annotateDSSP(structure, dssp, out);
annotateDSSP(structure, dssp, writeOther, out);
}
else
{
if (fmt == "dssp")
writeDSSP(structure, dssp, std::cout);
else
annotateDSSP(structure, dssp, std::cout);
annotateDSSP(structure, dssp, writeOther, std::cout);
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment