extract sequence from DNA bases like 'DG' (JAL-866)
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 7 Jul 2011 09:10:57 +0000 (10:10 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 7 Jul 2011 09:10:57 +0000 (10:10 +0100)
src/MCview/PDBChain.java

index 5176b15..d5597de 100755 (executable)
@@ -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