Remember fileName in alignFrame
[jalview.git] / src / jalview / io / PIRFile.java
index 6d6e525..fa9a28b 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
@@ -26,17 +26,14 @@ import jalview.datamodel.*;
 public class PIRFile\r
     extends AlignFile\r
 {\r
+  public static boolean useModellerOutput = false;\r
+\r
   Vector words = new Vector(); //Stores the words in a line after splitting\r
 \r
   public PIRFile()\r
   {\r
   }\r
 \r
-  public PIRFile(String inStr)\r
-  {\r
-    super(inStr);\r
-  }\r
-\r
   public PIRFile(String inFile, String type)\r
       throws IOException\r
   {\r
@@ -47,6 +44,7 @@ public class PIRFile
   {\r
       StringBuffer sequence;\r
       String line = null;\r
+      ModellerDescription md;\r
 \r
       while ( (line = nextLine()) != null)\r
       {\r
@@ -93,8 +91,9 @@ public class PIRFile
           }\r
 \r
           seqs.addElement(newSeq);\r
-          ModellerDescription md = new ModellerDescription(newSeq.\r
-              getDescription());\r
+\r
+          md = new ModellerDescription(newSeq.\r
+                getDescription());\r
           md.updateSequenceI(newSeq);\r
         }\r
       }\r
@@ -111,17 +110,28 @@ public class PIRFile
     int len = 72;\r
     StringBuffer out = new StringBuffer();\r
     int i = 0;\r
+    ModellerDescription md;\r
 \r
     while ( (i < s.length) && (s[i] != null))\r
     {\r
       String seq = s[i].getSequence();\r
       seq = seq + "*";\r
 \r
+\r
       if (is_NA)\r
       {\r
-        // modeller doesn't really do nucleotides, so we don't do anything fancy\r
-        // Nucleotide sequence tags should have a >DL; prefix\r
-        out.append(">N1;" + s[i].getName() + "\n"); // JBPNote Should change >P to >N\r
+          // modeller doesn't really do nucleotides, so we don't do anything fancy\r
+          // Official tags area as follows, for now we'll use P1 and DL\r
+          // Protein (complete) P1\r
+          // Protein (fragment) F1\r
+          // DNA (linear) Dl\r
+          // DNA (circular) DC\r
+          // RNA (linear) RL\r
+          // RNA (circular) RC\r
+          // tRNA N3\r
+          // other functional RNA N1\r
+\r
+        out.append(">N1;" + s[i].getName() + "\n");\r
         if (s[i].getDescription() == null)\r
         {\r
           out.append(s[i].getName() + " " +\r
@@ -135,9 +145,23 @@ public class PIRFile
       }\r
       else\r
       {\r
-        out.append(">P1;" + s[i].getName() + "\n");\r
-        ModellerDescription md = new ModellerDescription(s[i]);\r
-        out.append(md.getDescriptionLine() + "\n");\r
+\r
+       if(useModellerOutput)\r
+       {\r
+         out.append(">P1;" + s[i].getName() + "\n");\r
+         md = new ModellerDescription(s[i]);\r
+         out.append(md.getDescriptionLine() + "\n");\r
+       }\r
+       else\r
+       {\r
+         out.append(">P1;" + printId(s[i]) + "\n");\r
+         if (s[i].getDescription() != null)\r
+           out.append(s[i].getDescription() + "\n");\r
+         else\r
+           out.append(s[i].getName() + " "\r
+                      + (s[i].getEnd() - s[i].getStart() + 1)\r
+                      + " residues\n");\r
+       }\r
       }\r
       int nochunks = (seq.length() / len) + 1;\r
 \r