From cbb5b519ea1986d0e2016a6472e7583ec98c5294 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 7 Jul 2011 10:10:57 +0100 Subject: [PATCH] extract sequence from DNA bases like 'DG' (JAL-866) --- src/MCview/PDBChain.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 5176b15..d5597de 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -243,6 +243,7 @@ public class PDBChain { int count = 0; Object symbol; + boolean deoxyn=false; boolean nucleotide = false; StringBuffer seq = new StringBuffer(); Vector resFeatures = new Vector(); @@ -297,8 +298,10 @@ public class PDBChain if ((symbol = ResidueProperties.getAA3Hash().get(tmpat.resName)) == null) { String nucname = tmpat.resName.trim(); + // use the aaIndex rather than call 'toLower' - which would take a bit more time. + deoxyn=nucname.length()==2 && ResidueProperties.aaIndex[nucname.charAt(0)]==ResidueProperties.aaIndex['D']; if (tmpat.name.equalsIgnoreCase("CA") - || ResidueProperties.nucleotideIndex[nucname.charAt(0)] == -1) + || ResidueProperties.nucleotideIndex[nucname.charAt((deoxyn ? 1 : 0))] == -1) { seq.append("X"); // System.err.println("PDBReader:Null aa3Hash for " + @@ -308,7 +311,7 @@ public class PDBChain { // nucleotide flag nucleotide = true; - seq.append(nucname.charAt(0)); + seq.append(nucname.charAt((deoxyn ? 1 : 0))); } } else -- 1.7.10.2