Skip to content
Snippets Groups Projects
Commit beef1852 authored by Marco Biasini's avatar Marco Biasini
Browse files

improve SEQRES import and AlignToSEQRES

This is based on exhaustive testing on the complete files of the PDB.
There are still a few unresolved issues. However it is not clear to me,
whether the problems are due to errors in the PDB files or our
misunderstanding.
parent 83d0cb91
No related branches found
No related tags found
No related merge requests found
...@@ -151,9 +151,12 @@ void PDBReader::ParseSeqRes(const StringRef& line, int line_num) ...@@ -151,9 +151,12 @@ void PDBReader::ParseSeqRes(const StringRef& line, int line_num)
conop::CompoundPtr compound=comp_lib->FindCompound(trimmed.str(), conop::CompoundPtr compound=comp_lib->FindCompound(trimmed.str(),
conop::Compound::PDB); conop::Compound::PDB);
if (!compound) { if (!compound) {
LOG_WARNING("unknown residue '" << trimmed << "' in SEQRES record. " if (rname!=StringRef("UNK", 3)) {
"Setting one-letter-code to X");
curr_seq.Append('X'); LOG_WARNING("unknown residue '" << trimmed << "' in SEQRES record. "
"Setting one-letter-code to '?'");
}
curr_seq.Append('?');
continue; continue;
} }
curr_seq.Append(compound->GetOneLetterCode()); curr_seq.Append(compound->GetOneLetterCode());
......
...@@ -17,14 +17,13 @@ def AlignToSEQRES(chain, seqres): ...@@ -17,14 +17,13 @@ def AlignToSEQRES(chain, seqres):
""" """
from ost import seq from ost import seq
from ost import mol from ost import mol
residues=chain.residues view=chain.Select('ligand=false and peptide=true')
residues=view.residues
if len(residues)==0: if len(residues)==0:
return None return seq.CreateAlignment()
fragments=[residues[0].one_letter_code] fragments=[residues[0].one_letter_code]
for r1, r2 in zip(residues[:-2], residues[1:]): for r1, r2 in zip(residues[:-2], residues[1:]):
if not r2.IsPeptideLinking() or r2.IsLigand(): if not mol.InSequence(r1.handle, r2.handle):
continue
if not mol.InSequence(r1, r2):
fragments.append('') fragments.append('')
fragments[-1]+=r2.one_letter_code fragments[-1]+=r2.one_letter_code
ss=str(seqres) ss=str(seqres)
...@@ -41,4 +40,4 @@ def AlignToSEQRES(chain, seqres): ...@@ -41,4 +40,4 @@ def AlignToSEQRES(chain, seqres):
seq.CreateSequence('atoms', aln_seq)) seq.CreateSequence('atoms', aln_seq))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment