Skip to content

Commit

Permalink
More parsing fixes, #305
Browse files Browse the repository at this point in the history
  • Loading branch information
josemduarte committed Jul 27, 2015
1 parent 55af360 commit 6f70909
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
Expand Up @@ -510,6 +510,8 @@ private void initResSerialsMap(Chain c) {
logger.warn("No SEQRES groups found in chain {}, will use residue numbers as given (no insertion codes, not necessarily aligned). "
+ "Make sure your structure has SEQRES records and that you use FileParsingParameters.setAlignSeqRes(true)",
c.getChainID());
// we add a explicit null to the map so that we flag it as unavailable for this chain
chains2pdbResNums2ResSerials.put(c.getChainID(), null);
return;
}

Expand Down
Expand Up @@ -1718,4 +1718,17 @@ public static boolean isChainWaterOnly(Chain c) {
return waterOnly;
}

/**
* Returns true if the given chain is composed of non-polymeric groups only
* @param c
* @return
*/
public static boolean isChainPureNonPolymer(Chain c) {

for (Group g: c.getAtomGroups()) {
if (g.getType() == GroupType.AMINOACID || g.getType() == GroupType.NUCLEOTIDE) return false;

}
return true;
}
}
Expand Up @@ -2139,6 +2139,10 @@ private void pdb_MODEL_Handler(String line) {
logger.warn("Chain {} ({} atom groups) is composed of water molecules only. Removing it.",
c.getChainID(), c.getAtomGroups().size());
it.remove();
} else if (StructureTools.isChainPureNonPolymer(c)) {
logger.warn("Chain {} ({} atom groups) is composed of non-polymer molecules only. Removing it.",
c.getChainID(), c.getAtomGroups().size());
it.remove();
}
}
structure.addModel(current_model);
Expand Down Expand Up @@ -2922,6 +2926,10 @@ private void triggerEndFileChecks(){
logger.warn("Chain {} ({} atom groups) is composed of water molecules only. Removing it.",
c.getChainID(), c.getAtomGroups().size());
it.remove();
} else if (StructureTools.isChainPureNonPolymer(c)) {
logger.warn("Chain {} ({} atom groups) is composed of non-polymer molecules only. Removing it.",
c.getChainID(), c.getAtomGroups().size());
it.remove();
}
}
structure.addModel(current_model);
Expand Down
Expand Up @@ -748,14 +748,12 @@ public void documentEnd() {
it = pdbChains.iterator();
while (it.hasNext()) {
Chain chain = it.next();
GroupType predominantGroupType = StructureTools.getPredominantGroupType(chain);
if (StructureTools.isChainWaterOnly(chain)) {
it.remove();
logger.warn("Chain with chain id {} (asym id {}) and {} residues, contains only waters. Will ignore the chain because it doesn't fit into the BioJava structure data model.",
chain.getChainID(),chain.getInternalChainID(),chain.getAtomGroups().size());
}
else if (predominantGroupType != GroupType.AMINOACID &&
predominantGroupType!=GroupType.NUCLEOTIDE ) {
else if (StructureTools.isChainPureNonPolymer(chain) ) {
logger.warn("Chain with chain id {} (asym id {}) and {} residues, does not seem to be polymeric. Will ignore the chain because it doesn't fit into the BioJava structure data model.",
chain.getChainID(),chain.getInternalChainID(),chain.getAtomGroups().size());
it.remove();
Expand Down

0 comments on commit 6f70909

Please sign in to comment.