last version stay many bugs ..
authorAnne Menard <menard.annec@gmail.com>
Tue, 14 Aug 2012 12:48:00 +0000 (14:48 +0200)
committerAnne Menard <menard.annec@gmail.com>
Tue, 14 Aug 2012 12:48:00 +0000 (14:48 +0200)
37 files changed:
src/MCview/PDBViewer.java
src/MCview/PDBfile.java
src/jalview/analysis/Rna.java
src/jalview/analysis/StructureFrequency.java
src/jalview/appletgui/AlignFrame.java
src/jalview/bin/Jalview.java
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/ext/varna/VarnaCommands.java
src/jalview/gui/AppVarna.java
src/jalview/gui/AppVarnaBinding.java
src/jalview/gui/AssociatePdbFileWithSeq.java
src/jalview/gui/PopupMenu.java
src/jalview/io/AlignFile.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/BLCFile.java
src/jalview/io/ClustalFile.java
src/jalview/io/FastaFile.java
src/jalview/io/FeaturesFile.java
src/jalview/io/IdentifyFile.java
src/jalview/io/JPredFile.java
src/jalview/io/MSFfile.java
src/jalview/io/PIRFile.java
src/jalview/io/PfamFile.java
src/jalview/io/PileUpfile.java
src/jalview/io/RnamlFile.java
src/jalview/io/SimpleBlastFile.java
src/jalview/io/StockholmFile.java
src/jalview/io/TCoffeeScoreFile.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/jbgui/GDesktop.java
src/jalview/renderer/AnnotationRenderer.java
src/jalview/schemes/RNAInteractionColourScheme.java
src/jalview/schemes/ResidueColourScheme.java
src/jalview/schemes/ResidueProperties.java
src/jalview/workers/StrucConsensusThread.java
src/jalview/ws/jws2/AAConsClient.java
test/jalview/io/TCoffeeScoreFileTest.java

index c726fde..714cbd1 100755 (executable)
@@ -28,6 +28,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 import jalview.gui.*;
@@ -58,7 +59,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
   String tmpPDBFile;
 
   public PDBViewer(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
-          AlignmentPanel ap, String protocol) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+          AlignmentPanel ap, String protocol) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
 
   {
     this.pdbentry = pdbentry;
index 048f639..fe2851a 100755 (executable)
@@ -29,6 +29,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 import jalview.io.FileParse;
@@ -46,12 +47,12 @@ public class PDBfile extends jalview.io.AlignFile
    */
   boolean VisibleChainAnnotation = false;
 
-  public PDBfile(String inFile, String inType) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PDBfile(String inFile, String inType) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, inType);
   }
 
-  public PDBfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PDBfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index c309dfc..800e70a 100644 (file)
@@ -54,11 +54,11 @@ public class Rna
     {
       char base = line.charAt(i);
 
-      if ((base == '<') || (base == '(') || (base == '{') || (base == '[')|| (base == 'A')|| (base == 'B')|| (base == 'C')|| (base == 'D'))
+      if ((base == '<') || (base == '(') || (base == '{') || (base == '[')|| (base == 'A')|| (base == 'B')|| (base == 'C')|| (base == 'D')|| (base == '1')|| (base == 'F')|| (base == 'G')|| (base == '2')|| (base == 'I')|| (base == 'J')|| (base == 'K')|| (base == 'L')|| (base == 'M')|| (base == 'N')|| (base == 'O')|| (base == 'P')|| (base == 'Q')|| (base == 'R')|| (base == 'S')|| (base == 'T')|| (base == 'U')|| (base == 'V')|| (base == 'W')|| (base == 'X')|| (base == 'Y')|| (base == 'Z'))
       {
         stack.push(i);
       }
-      else if ((base == '>') || (base == ')') || (base == '}')|| (base == ']')|| (base == 'a')|| (base == 'b')|| (base == 'c')|| (base == 'd'))
+      else if ((base == '>') || (base == ')') || (base == '}')|| (base == ']')|| (base == 'a')|| (base == 'b')|| (base == 'c')|| (base == 'd')|| (base == 'e')|| (base == 'f')|| (base == 'g')|| (base == 'h')|| (base == 'i')|| (base == 'j')|| (base == 'k')|| (base == 'l')|| (base == 'm')|| (base == 'n')|| (base == 'o')|| (base == 'p')|| (base == 'q')|| (base == 'r')|| (base == 's')|| (base == 't')|| (base == 'u')|| (base == 'v')|| (base == 'w')|| (base == 'x')|| (base == 'y')|| (base == 'z'))
       
       {
 
@@ -69,7 +69,8 @@ public class Rna
         }
         Object temp = stack.pop();
         pairs.addElement(temp);
-        pairs.addElement(i);        
+        pairs.addElement(i); 
+        //System.out.println(pairs);
       }
 
       i++;
index 67d8b9b..5095ce1 100644 (file)
@@ -58,11 +58,15 @@ public class StructureFrequency
    */
   public static int findPair(SequenceFeature[] pairs, int indice)
   {
+         System.out.print("indice"+indice+"    ");
     for (int i = 0; i < pairs.length; i++)
     {
       if (pairs[i].getBegin() == indice)
+        
       {
+         System.out.println(pairs[i].getEnd());
         return pairs[i].getEnd();
+        
       }
     }
     return -1;
@@ -83,15 +87,26 @@ public class StructureFrequency
           int end, Hashtable[] result, boolean profile,
           AlignmentAnnotation rnaStruc)
   {
+//     System.out.println("longueur="+sequences.length);
+//     for(int l=0;l<=(sequences.length-1);l++){  
+//     System.out.println("sequences "+l+":"+sequences[l].getSequenceAsString());
+//     }
+//     System.out.println("start="+start);
+       System.out.println("end="+end);
+//     System.out.println("result="+result.length);
+//
+//     System.out.println("profile="+profile);
+//     System.out.println("rnaStruc="+rnaStruc);
     Hashtable residueHash;
     String maxResidue;
-    char[] seq, struc = rnaStruc.getRNAStruc().toCharArray();
+    char[] struc = rnaStruc.getRNAStruc().toCharArray();
     SequenceFeature[] rna = rnaStruc._rnasecstr;
     char c, s, cEnd;
-    int count, nonGap = 0, i, bpEnd = -1, j, jSize = sequences.length;
+    int count = 0, nonGap = 0, i, bpEnd = -1, j, jSize = sequences.length;
     int[] values;
     int[][] pairs;
     float percentage;
+    boolean wooble = true;
 
     for (i = start; i < end; i++) // foreach column
     {
@@ -100,9 +115,11 @@ public class StructureFrequency
       values = new int[255];
       pairs = new int[255][255];
       bpEnd = -1;
+      //System.out.println("s="+struc[i]);
       if (i < struc.length)
       {
         s = struc[i];
+        
       }
       else
       {
@@ -113,7 +130,7 @@ public class StructureFrequency
         s = '-';
       }
 
-      if (s != '(')
+      if (s != '(' && s != '[')
       {
         if (s == '-')
         {
@@ -122,7 +139,10 @@ public class StructureFrequency
       }
       else
       {
+        
+         
         bpEnd = findPair(rna, i);
+       
         if (bpEnd>-1)
         {
         for (j = 0; j < jSize; j++) // foreach row
@@ -134,7 +154,8 @@ public class StructureFrequency
             continue;
           }
           c = sequences[j].getCharAt(i);
-          {
+          //System.out.println("c="+c);
+          
 
             // standard representation for gaps in sequence and structure
             if (c == '.' || c == ' ')
@@ -148,15 +169,30 @@ public class StructureFrequency
               continue;
             }
             cEnd = sequences[j].getCharAt(bpEnd);
-            if (checkBpType(c, cEnd))
+         
+         
+            System.out.println("pairs ="+c+","+cEnd);
+            if (checkBpType(c, cEnd)==true)
             {
               values['(']++; // H means it's a helix (structured)
+              maxResidue = "(";
+              wooble=true;
+              System.out.println("It's a pair wc");
+              
             }
-            pairs[c][cEnd]++;
-
-            maxResidue = "(";
-          }
-        }
+            if (checkBpType(c, cEnd)==false)
+            {
+              wooble =false;
+              values['[']++; // H means it's a helix (structured)
+              maxResidue = "[";
+              System.out.println("It's an pair non canonic");
+              System.out.println(sequences[j].getRNA());
+              System.out.println(rnaStruc.getRNAStruc().charAt(i));
+            }
+            pairs[c][cEnd]++;  
+           
+          
+               }
         }
         // nonGap++;
       }
@@ -169,9 +205,14 @@ public class StructureFrequency
 
         residueHash.put(PAIRPROFILE, pairs);
       }
-
+      if (wooble==true)
+      {
       count = values['('];
-
+      }
+      if (wooble==false)
+      {
+      count = values['['];
+      }
       residueHash.put(MAXCOUNT, new Integer(count));
       residueHash.put(MAXRESIDUE, maxResidue);
 
@@ -186,12 +227,19 @@ public class StructureFrequency
       }
       if (bpEnd > 0)
       {
-        values[')'] = values['('];
+       values[')'] = values['('];
+        values[']'] = values['['];
         values['('] = 0;
-
+        values['['] = 0;
         residueHash = new Hashtable();
-        maxResidue = ")";
-
+        if (wooble==true){
+               System.out.println(maxResidue+","+wooble);
+               maxResidue = ")";
+        }
+        if(wooble==false){
+               System.out.println(maxResidue+","+wooble);
+               maxResidue = "]";
+        }
         if (profile)
         {
           residueHash.put(PROFILE, new int[][]
@@ -208,6 +256,7 @@ public class StructureFrequency
         residueHash.put(PID_GAPS, new Float(percentage));
 
         result[bpEnd] = residueHash;
+        
       }
     }
   }
index 494e8fe..01227a6 100644 (file)
@@ -100,6 +100,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;\r
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;\r
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;\r
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;\r
 \r
 public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemListener, KeyListener\r
 {\r
@@ -3649,8 +3650,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
  * @throws ExceptionLoadingFailed \r
  * @throws ExceptionPermissionDenied \r
  * @throws InterruptedException \r
+ * @throws ExceptionUnmatchedClosingParentheses \r
    */\r
-  public boolean loadScoreFile( String source ) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException {\r
+  public boolean loadScoreFile( String source ) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {\r
 \r
     TCoffeeScoreFile file = new TCoffeeScoreFile(source, AppletFormatAdapter.checkProtocol(source));\r
          if( !file.isValid()) {\r
index 272250e..772f99e 100755 (executable)
  */
 package jalview.bin;
 
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -67,6 +71,7 @@ public class Jalview
       }
     });
   }
+  protected static boolean proteine;
 
   /**
    * main class for Jalview application
@@ -507,8 +512,28 @@ public class Jalview
     // We'll only open the default file if the desktop is visible.
     // And the user
     // ////////////////////
+  
+    JFrame Typechooser =new JFrame("choose molecule type"); 
+    FlowLayout fl = new FlowLayout();
+    Typechooser.setLayout(fl);
+    Typechooser.setSize(400,400);
+    Typechooser.setDefaultCloseOperation(Typechooser.DISPOSE_ON_CLOSE);
+    JLabel label = new JLabel("What would you open ? ");
+    JButton rnabutton = new JButton("RNA molecule");
+    JButton pbutton = new JButton("Proteine molecule");
+    
+    pbutton.addActionListener(new pbuttonlistener());
+    rnabutton.addActionListener(new rnabuttonlistener());
+    Typechooser.getContentPane().add(label);
+    Typechooser.getContentPane().add(rnabutton);
+    Typechooser.getContentPane().add(pbutton);
+    Typechooser.setVisible(true);
+    
+    
+
+    
     if (!headless && file == null && vamsasImport == null
-            && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
+            && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true) && proteine == true)
     {
       file = jalview.bin.Cache.getDefault("STARTUP_FILE",
               jalview.bin.Cache.getDefault("www.jalview.org", "http://www.jalview.org")+"/examples/exampleFile_2_7.jar");
@@ -576,7 +601,8 @@ public class Jalview
       desktop.setInBatchMode(false);
     }
   }
-
+  
+  
   private static void startUsageStats(final Desktop desktop)
   {
     /**
@@ -883,6 +909,21 @@ public class Jalview
  * @author Andrew Waterhouse and JBP documented.
  * 
  */
+
+class rnabuttonlistener  implements ActionListener{
+         public void actionPerformed(ActionEvent arg0) {
+                 System.out.println("Good idea ! ");
+
+         }
+}
+
+class pbuttonlistener  implements ActionListener{
+         public void actionPerformed(ActionEvent arg0) {
+               
+         
+         }
+}
+
 class ArgsParser
 {
   Vector vargs = null;
@@ -1021,4 +1062,7 @@ class FeatureFetcher
   {
     return queued == 0 && running == 0;
   }
+  
+  
+  
 };
index 1196d05..1962423 100755 (executable)
@@ -242,8 +242,37 @@ public class AlignmentAnnotation
       else
       // Check for RNA secondary structure
       {
-        if (annotations[i].secondaryStructure == 'S'
-                       || annotations[i].secondaryStructure == 'C')
+         //System.out.println(annotations[i].secondaryStructure);
+        if (annotations[i].secondaryStructure == '('
+                       || annotations[i].secondaryStructure == '['
+                       || annotations[i].secondaryStructure == '<'
+                       || annotations[i].secondaryStructure == '{'
+                       || annotations[i].secondaryStructure == 'A'
+                       || annotations[i].secondaryStructure == 'B'
+                       || annotations[i].secondaryStructure == 'C'
+                       || annotations[i].secondaryStructure == 'D'
+                       || annotations[i].secondaryStructure == '1'
+                       || annotations[i].secondaryStructure == 'F'
+                       || annotations[i].secondaryStructure == 'G'
+                       || annotations[i].secondaryStructure == '2'
+                       || annotations[i].secondaryStructure == 'I'
+                       || annotations[i].secondaryStructure == 'J'
+                       || annotations[i].secondaryStructure == 'K'
+                       || annotations[i].secondaryStructure == 'L'
+                       || annotations[i].secondaryStructure == 'M'
+                       || annotations[i].secondaryStructure == 'N'
+                       || annotations[i].secondaryStructure == 'O'
+                       || annotations[i].secondaryStructure == 'P'
+                       || annotations[i].secondaryStructure == 'Q'
+                       || annotations[i].secondaryStructure == 'R'
+                       || annotations[i].secondaryStructure == 'S'
+                       || annotations[i].secondaryStructure == 'T'
+                       || annotations[i].secondaryStructure == 'U'
+                       || annotations[i].secondaryStructure == 'V'
+                       || annotations[i].secondaryStructure == 'W'
+                       || annotations[i].secondaryStructure == 'X'
+                       || annotations[i].secondaryStructure == 'Y'
+                       || annotations[i].secondaryStructure == 'Z')
         {
           hasIcons |= true;
           isrna |= true;
@@ -276,7 +305,36 @@ public class AlignmentAnnotation
                 firstChar != ' '
                 && firstChar != 'H'
                 && firstChar != 'E'
+                && firstChar != '('
+                && firstChar != '['
+                && firstChar != '>'
+                && firstChar != '{'
+                && firstChar != 'A'
+                && firstChar != 'B'
+                && firstChar != 'C'
+                && firstChar != 'D'
+                && firstChar != '1'
+                && firstChar != 'F'
+                && firstChar != 'G'
+                && firstChar != '2'
+                && firstChar != 'I'
+                && firstChar != 'J'
+                && firstChar != 'K'
+                && firstChar != 'L'
+                && firstChar != 'M'
+                && firstChar != 'N'
+                && firstChar != 'O'
+                && firstChar != 'P'
+                && firstChar != 'Q'
+                && firstChar != 'R'
                 && firstChar != 'S'
+                && firstChar != 'T'
+                && firstChar != 'U'
+                && firstChar != 'V'
+                && firstChar != 'W'
+                && firstChar != 'X'
+                && firstChar != 'Y'
+                && firstChar != 'Z'
                 && firstChar != '-'
                 && firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
         {
@@ -493,7 +551,7 @@ public class AlignmentAnnotation
       {
         if (annotations[i] != null)
         {
-          annotations[i].displayCharacter = "";
+          annotations[i].displayCharacter = "X";
         }
       }
     }
index 9d57969..60c1912 100644 (file)
@@ -30,6 +30,7 @@ public class VarnaCommands
    */\r
   public static String[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment)\r
   {\r
+       \r
     ArrayList<String> str = new ArrayList<String>();\r
     StringBuffer command = new StringBuffer();\r
   \r
index dd970f6..00670aa 100644 (file)
@@ -73,32 +73,35 @@ public class AppVarna extends JInternalFrame implements
 
   AlignmentPanel ap;
 
-  public AppVarna(String sname, SequenceI seq, String strucseq, RNA struc,
+  public AppVarna(String sname, SequenceI seq, String strucseq, String struc,
           String name, AlignmentPanel ap)
   {
-        
-
+         System.out.println("je suis là (AppVarna!!");
+         System.out.println("1:"+sname);
+         System.out.println("2:"+seq);
+         System.out.println("3:"+strucseq);
+         System.out.println("4:"+struc);
+         System.out.println("5:"+name);
+         System.out.println("6:"+ap);
     this.ap = ap;
     ArrayList<RNA> rnaList = new ArrayList<RNA>();
-    System.out.println(struc);
-    RNA rna1 = new RNA(struc);
-    rna1.setName(name);
-    rna1.restrictTo(strucseq);
-    /*try
+    RNA rna1 = new RNA(name);
+    try
     {
-      System.err.println(struc + "->" + replaceOddGaps(struc));
+    System.out.println("ou ici ?");
       rna1.setRNA(strucseq, replaceOddGaps(struc));
-     
+      System.out.println("La séquence est :"+rna1.getSeq());
+      System.out.println("La séquence est :"+struc);
+      System.out.println("La séquence est :"+replaceOddGaps(struc).toString());
     } catch (ExceptionUnmatchedClosingParentheses e2)
     {
       e2.printStackTrace();
     } catch (ExceptionFileFormatOrSyntax e3)
     {
       e3.printStackTrace();
-    }*/
+    }
     
     RNA trim = trimRNA(rna1, "trimmed "+sname);
-    //TODO: Use RNA.selectTo instead...
     rnaList.add(trim);
     rnaList.add(rna1);
     
@@ -132,7 +135,7 @@ public class AppVarna extends JInternalFrame implements
 
   public void initVarna()
   {
-         
+         System.out.println("initialisation VANRA");
     // vab.setFinishedInit(false);
     varnaPanel = vab.get_varnaPanel();
     setBackground(Color.white);
@@ -147,7 +150,7 @@ public class AppVarna extends JInternalFrame implements
             getBounds().width, getBounds().height);
     this.pack();
     showPanel(true);
-    
+    System.out.println("Sortie initialisation VANRA");
   }
 
   public String replaceOddGaps(String oldStr)
index 32022a3..0bc84ce 100644 (file)
@@ -153,7 +153,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
 
   public AppVarnaBinding(ArrayList<RNA> rnaList)
   {
-;
+
     // super("VARNA in Jalview");
     initVarnaEdit(rnaList);
   }
@@ -810,7 +810,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
 
   public void onUINewStructure(VARNAConfig v, RNA r)
   {
-    //_rnaList.add(v, r, "", true);
+    _rnaList.add(v, r, "", true);
   }
 
   public void onWarningEmitted(String s)
index ade341d..3bd21b5 100644 (file)
@@ -25,6 +25,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.Sequence;
@@ -50,8 +51,9 @@ public class AssociatePdbFileWithSeq
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
  */
-  public PDBEntry associatePdbWithSeq(String choice, String protocol, SequenceI sequence, boolean prompt) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PDBEntry associatePdbWithSeq(String choice, String protocol, SequenceI sequence, boolean prompt) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     PDBEntry entry = new PDBEntry();
     try
index f6c1379..0e83c6e 100644 (file)
@@ -30,6 +30,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import MCview.*;
 import jalview.analysis.*;
@@ -293,10 +294,12 @@ public class PopupMenu extends JPopupMenu
                 
                        //System.out.println("3:"+seq.getSequenceAsString());
                        System.out.println("3:strucseq"+rnastruc);
-                       System.out.println("4:struc"+seq.getRNA());
+                       //System.out.println("4:struc"+seq.getRNA());
                        System.out.println("5:name"+seq.getName());
                        System.out.println("6:ap"+ap);
-                new AppVarna(seq.getName(),seq,rnastruc,seq.getRNA(), seq.getName(), ap);
+                       new AppVarna(structureLine, seq, seq.getSequenceAsString(), rnastruc, seq
+                            .getName(), ap);
+                       //new AppVarna(seq.getName(),seq,rnastruc,seq.getRNA(), seq.getName(), ap);
                        System.out.println("end");
               }
             });
@@ -324,8 +327,9 @@ public class PopupMenu extends JPopupMenu
                 {
                   // TODO: VARNA does'nt print gaps in the sequence
                 
-                  new AppVarna(seq.getName()+" structure",seq,rnastruc,seq.getRNA(), 
-                                 seq.getName(), ap);
+                  //new AppVarna(seq.getName()+" structure",seq,rnastruc,seq.getRNA(), seq.getName(), ap);
+                  new AppVarna(seq.getName()+" structure",seq,seq.getSequenceAsString(), rnastruc, seq
+                          .getName(), ap);
                 }
               });
               viewStructureMenu.add(menuItem);
@@ -1049,6 +1053,9 @@ public class PopupMenu extends JPopupMenu
                } catch (InterruptedException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
+               } catch (ExceptionUnmatchedClosingParentheses e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
                }
       }
     });
@@ -1908,7 +1915,7 @@ public class PopupMenu extends JPopupMenu
     oal = null;
   }
 
-  public void pdbFromFile_actionPerformed() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public void pdbFromFile_actionPerformed() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
             jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
index 86696d7..837fee0 100755 (executable)
@@ -34,6 +34,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 /**
  * DOCUMENT ME!
@@ -90,8 +91,9 @@ public abstract class AlignFile extends FileParse
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public AlignFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public AlignFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
     initData();
@@ -114,8 +116,9 @@ public abstract class AlignFile extends FileParse
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public AlignFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public AlignFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
     initData();
@@ -265,8 +268,9 @@ public abstract class AlignFile extends FileParse
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public abstract void parse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException;
+  public abstract void parse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses;
 
   /**
    * Print out in alignment file format the Sequences in the seqs Vector.
index 3084027..d4831d7 100755 (executable)
@@ -52,7 +52,7 @@ public class AppletFormatAdapter
    * that are writable by the application.
    */
   public static final String[] WRITABLE_EXTENSIONS = new String[]
-  { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar" };
+  { "fa,faa,fasta,fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar" };
 
   /**
    * List of writable formats by the application. Order must correspond with the
@@ -66,7 +66,7 @@ public class AppletFormatAdapter
    * corresponding to READABLE_FNAMES
    */
   public static final String[] READABLE_EXTENSIONS = new String[]
-  { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
+  { "fa,faa,fasta,fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
       "sto,stk","xml" }; // ,
 
   // ".blast"
index 6b59d02..6611f1e 100755 (executable)
@@ -27,6 +27,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 
@@ -63,13 +64,14 @@ public class BLCFile extends AlignFile
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public BLCFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public BLCFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public BLCFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public BLCFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 3cd7bc1..8a1cf05 100755 (executable)
@@ -27,6 +27,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 import jalview.util.*;
@@ -38,12 +39,12 @@ public class ClustalFile extends AlignFile
   {
   }
 
-  public ClustalFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public ClustalFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public ClustalFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public ClustalFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index f3d3e5b..deca926 100755 (executable)
@@ -26,6 +26,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 
@@ -67,13 +68,14 @@ public class FastaFile extends AlignFile
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public FastaFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public FastaFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public FastaFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public FastaFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 9fc04b4..ad2cfd7 100755 (executable)
@@ -27,6 +27,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;\r
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;\r
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;\r
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;\r
 \r
 import jalview.analysis.SequenceIdMatcher;\r
 import jalview.datamodel.*;\r
@@ -73,13 +74,14 @@ public class FeaturesFile extends AlignFile
  * @throws ExceptionLoadingFailed \r
  * @throws ExceptionPermissionDenied \r
  * @throws InterruptedException \r
+ * @throws ExceptionUnmatchedClosingParentheses \r
    */\r
-  public FeaturesFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException\r
+  public FeaturesFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses\r
   {\r
     super(inFile, type);\r
   }\r
 \r
-  public FeaturesFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException\r
+  public FeaturesFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses\r
   {\r
     super(source);\r
   }\r
index 6475497..e90e0ef 100755 (executable)
@@ -133,10 +133,10 @@ public class IdentifyFile
           break;
         }
         
-        if ((data.indexOf(">") > -1))
+        if ((data.indexOf("<") > -1))
         {
           reply = "RNAML";
-          System.out.println("This is a RNAML format");
+          
           break;
         }
 
index d9836c1..444d0e0 100755 (executable)
@@ -32,6 +32,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 
@@ -80,13 +81,14 @@ public class JPredFile extends AlignFile
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public JPredFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public JPredFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public JPredFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public JPredFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
@@ -367,8 +369,9 @@ public class JPredFile extends AlignFile
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public static void main(String[] args) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public static void main(String[] args) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     try
     {
index 616c90b..161634c 100755 (executable)
@@ -27,6 +27,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 import jalview.util.*;
@@ -63,13 +64,14 @@ public class MSFfile extends AlignFile
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public MSFfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public MSFfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public MSFfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public MSFfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 358bcde..5e8c79d 100755 (executable)
@@ -27,6 +27,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 
@@ -40,12 +41,12 @@ public class PIRFile extends AlignFile
   {
   }
 
-  public PIRFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PIRFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public PIRFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PIRFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index f9da5de..20e8b98 100755 (executable)
@@ -27,6 +27,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 import jalview.util.*;
@@ -38,12 +39,12 @@ public class PfamFile extends AlignFile
   {
   }
 
-  public PfamFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PfamFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public PfamFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PfamFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index d120ac3..4fb4ee7 100755 (executable)
@@ -41,6 +41,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 import jalview.util.*;
@@ -71,13 +72,14 @@ public class PileUpfile extends MSFfile
  * @throws ExceptionLoadingFailed 
  * @throws ExceptionPermissionDenied 
  * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public PileUpfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PileUpfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public PileUpfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public PileUpfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 69786fb..b1589b6 100644 (file)
@@ -36,6 +36,7 @@ import com.stevesoft.pat.Regex;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 import fr.orsay.lri.varna.factories.RNAFactory;
 import fr.orsay.lri.varna.factories.RNAFactory.RNAFileType;
 import fr.orsay.lri.varna.models.rna.RNA;
@@ -55,13 +56,13 @@ public class RnamlFile extends AlignFile
                
          }
         
-        public RnamlFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+        public RnamlFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
          {
            super(inFile, type);
            
          }
 
-         public RnamlFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+         public RnamlFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
          {
            super(source);
            
@@ -89,68 +90,73 @@ public class RnamlFile extends AlignFile
        }
        
        
+       @SuppressWarnings("unchecked")
        public void parse() throws FileNotFoundException, ExceptionPermissionDenied, ExceptionLoadingFailed, ExceptionFileFormatOrSyntax
        {
                 FileReader fr = null;
                  fr = new FileReader(inFile); 
                  
                  BufferedReader r = new BufferedReader (fr);
-                Hashtable seqhash = new Hashtable();
-                 Vector headers = new Vector();
+       
                  //ArrayList<String> seq =new ArrayList();
                  //System.out.println(r);
                   
                  
                 result = RNAFactory.loadSecStrRNAML(r);
                  
-                System.out.println("this is the secondary scructure:" +result.toArray());
+                System.out.println("this is the secondary scructure:" +result.size());
                  //System.out.println("this is the secondary scructure:" +result.toString());
                  //System.out.println("this is the secondary scructure:" +result.size());
-                       for(int i=0;i<result.size();i++)
-                       {
-                 //System.out.println(result.get(0).getSeq());
-                 //System.out.println(result.get(0).getStructBPSEQ());
-                 //System.out.println(result.get(0).getStructDBN(true));
-                 String rna1 =result.get(0).getStructDBN(true);
-                 //System.out.println(result.get(0).getAnnotations());
-                 String seq = result.get(0).getSeq();
+                SequenceI[] seqs = new SequenceI[result.size()];
                  System.out.println(type); //the type is "File"
                  System.out.println(inFile );//inFile is the path
+                 
+                for(int i=0;i<result.size();i++)
+                       {
+                        RNA current = result.get(i);
+                 System.out.println(current.getSeq());
+                 //System.out.println(result.get(i).getStructBPSEQ());
+                 System.out.println(result.get(i).getStructDBN(true));
+                 System.out.println(i);
+                 String rna =current.getStructDBN(true);
+                 //System.out.println(result.get(0).getAnnotations());
+                 String seq = current.getSeq();
+       
                  int begin=0;
                  int end = seq.length()-1;
-                 SequenceI[] seqs = new SequenceI[1];
+                 
                  id = safeName(getDataName());
-                 seqs[0] = new Sequence(id, seq, begin, end);
-                 SequenceFeature feat = new SequenceFeature(type, "",5, 13, 0f, null);
-                 seqs[0].addSequenceFeature(feat);
-                 this.setSeqs(seqs);
+                 seqs[i] = new Sequence(id, seq, begin, end);
+                 //System.out.println(seq);
+                 System.out.println("Rna is still "+rna);
+                 //SequenceFeature feat = new SequenceFeature(type, "",5, 13, 0f, null);
+                 //seqs[i].addSequenceFeature(feat);
                  
-                 String[] annot=new String[10000] ;
-                 Annotation[] ann = new Annotation[1000];
-                 for(int j=0;j<rna1.length();j++)
+                 String[] annot=new String[rna.length()] ;
+                 Annotation[] ann = new Annotation[rna.length()];
+               
+                 for(int j=0;j<rna.length();j++)
                        {
-                 annot[j] =rna1.substring(j,j+1);
-                 System.out.println(annot[j]);
+                         annot[j] =rna.substring(j,j+1);
+                 
                        }
                  
-                 for(int k=0;k<rna1.length();k++)
+                 for(int k=0;k<rna.length();k++)
                {
-                         ann[k] = new Annotation(annot[k], "", ' ', 0f);
-                         
-                         ann[k].secondaryStructure = jalview.schemes.ResidueProperties.getRNASecStrucState(annot[k]).charAt(0);
-                         
+                         ann[k] = new Annotation(annot[k], "", jalview.schemes.ResidueProperties.getRNASecStrucState(annot[k]).charAt(0), 0f);
+                                                 
                }
-                 AlignmentAnnotation align = new AlignmentAnnotation("Secondary structure","",ann);
-                 seqs[0].addAlignmentAnnotation(align);
-                 seqs[0].setRNA(result.get(begin));
-                 this.annotations.addElement(align);
-                 
+                 AlignmentAnnotation align = new AlignmentAnnotation("Sec. str.",current.getID(),ann);
                  
+                 seqs[i].addAlignmentAnnotation(align);
+                 seqs[i].setRNA(result.get(i));
+                 this.annotations.addElement(align);
                }
+         this.setSeqs(seqs);
+                
+                
                
-               //Annotate3D tintin = new Annotate3D();
-                 
-               //System.out.println(tintin);  
+
        }
          
        
@@ -360,4 +366,3 @@ public class RnamlFile extends AlignFile
                  return annotations;
          }
 }
-
index 8aac8f7..5c2b2f3 100644 (file)
@@ -27,6 +27,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 import jalview.datamodel.*;
 import jalview.util.*;
@@ -54,12 +55,12 @@ public class SimpleBlastFile extends AlignFile
   {
   }
 
-  public SimpleBlastFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public SimpleBlastFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public SimpleBlastFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public SimpleBlastFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index be1992e..77e29bb 100644 (file)
@@ -32,6 +32,9 @@ import com.stevesoft.pat.*;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;\r
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;\r
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;\r
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;\r
+import fr.orsay.lri.varna.factories.RNAFactory;\r
+import fr.orsay.lri.varna.models.rna.RNA;\r
 import jalview.datamodel.*;\r
 import jalview.analysis.Rna;\r
 \r
@@ -52,17 +55,19 @@ import jalview.analysis.Rna;
 public class StockholmFile extends AlignFile\r
 {\r
   // static Logger logger = Logger.getLogger("jalview.io.StockholmFile");\r
-\r
+  protected ArrayList<RNA> result;\r
+  public String id;\r
+  \r
   public StockholmFile()\r
   {\r
   }\r
 \r
-  public StockholmFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException\r
+  public StockholmFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses\r
   {\r
     super(inFile, type);\r
   }\r
 \r
-  public StockholmFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException\r
+  public StockholmFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses\r
   {\r
     super(source);\r
   }\r
@@ -78,457 +83,487 @@ public class StockholmFile extends AlignFile
    * \r
    * @throws IOException\r
    *           If there is an error with the input file\r
+ * @throws ExceptionUnmatchedClosingParentheses \r
    */\r
-  public void parse() throws IOException\r
+  public void parse() throws IOException, ExceptionUnmatchedClosingParentheses\r
   {\r
-    StringBuffer treeString = new StringBuffer();\r
-    String treeName = null;\r
-    // --------------- Variable Definitions -------------------\r
-    String line;\r
-    String version;\r
-    // String id;\r
-    Hashtable seqAnn = new Hashtable(); // Sequence related annotations\r
-    Hashtable seqs = new Hashtable();\r
-    Regex p, r, rend, s, x;\r
-\r
-    // Temporary line for processing RNA annotation\r
-    // String RNAannot = "";\r
-\r
-    // ------------------ Parsing File ----------------------\r
-    // First, we have to check that this file has STOCKHOLM format, i.e. the\r
-    // first line must match\r
-    r = new Regex("# STOCKHOLM ([\\d\\.]+)");\r
-    if (!r.search(nextLine()))\r
-    {\r
-      throw new IOException(\r
-              "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'");\r
-    }\r
-    else\r
-    {\r
-      version = r.stringMatched(1);\r
-      // logger.debug("Stockholm version: " + version);\r
-    }\r
-\r
-    // We define some Regexes here that will be used regularily later\r
-    rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment\r
-    p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in\r
-    // id/from/to\r
-    s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype\r
-    r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line\r
-    x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence\r
-\r
-    // Convert all bracket types to parentheses (necessary for passing to VARNA)\r
-    Regex openparen = new Regex("(<|\\[)", "(");\r
-    Regex closeparen = new Regex("(>|\\])", ")");\r
-\r
-    // Detect if file is RNA by looking for bracket types\r
-    Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
-\r
-    rend.optimize();\r
-    p.optimize();\r
-    s.optimize();\r
-    r.optimize();\r
-    x.optimize();\r
-    openparen.optimize();\r
-    closeparen.optimize();\r
-\r
-    while ((line = nextLine()) != null)\r
-    {\r
-      if (line.length() == 0)\r
-      {\r
-        continue;\r
-      }\r
-      if (rend.search(line))\r
-      {\r
-        // End of the alignment, pass stuff back\r
-\r
-        this.noSeqs = seqs.size();\r
-        // logger.debug("Number of sequences: " + this.noSeqs);\r
-        Enumeration accs = seqs.keys();\r
-        while (accs.hasMoreElements())\r
-        {\r
-          String acc = (String) accs.nextElement();\r
-          // logger.debug("Processing sequence " + acc);\r
-          String seq = (String) seqs.remove(acc);\r
-          if (maxLength < seq.length())\r
-          {\r
-            maxLength = seq.length();\r
-          }\r
-          int start = 1;\r
-          int end = -1;\r
-          String sid = acc;\r
-          /*\r
-           * Retrieve hash of annotations for this accession\r
-           * Associate Annotation with accession\r
-           */\r
-          Hashtable accAnnotations = null;\r
-\r
-          if (seqAnn != null && seqAnn.containsKey(acc))\r
-          {\r
-            accAnnotations = (Hashtable) seqAnn.remove(acc);\r
-            //TODO: add structures to sequence\r
-          }\r
-\r
-          // Split accession in id and from/to\r
-          if (p.search(acc))\r
-          {\r
-            sid = p.stringMatched(1);\r
-            start = Integer.parseInt(p.stringMatched(2));\r
-            end = Integer.parseInt(p.stringMatched(3));\r
-          }\r
-          // logger.debug(sid + ", " + start + ", " + end);\r
-\r
-          Sequence seqO = new Sequence(sid, seq, start, end);\r
-          // Add Description (if any)\r
-          if (accAnnotations != null && accAnnotations.containsKey("DE"))\r
-          {\r
-            String desc = (String) accAnnotations.get("DE");\r
-            seqO.setDescription((desc == null) ? "" : desc);\r
-          }\r
-          // Add DB References (if any)\r
-          if (accAnnotations != null && accAnnotations.containsKey("DR"))\r
-          {\r
-            String dbr = (String) accAnnotations.get("DR");\r
-            if (dbr != null && dbr.indexOf(";") > -1)\r
-            {\r
-              String src = dbr.substring(0, dbr.indexOf(";"));\r
-              String acn = dbr.substring(dbr.indexOf(";") + 1);\r
-              jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);\r
-              // seqO.addDBRef(dbref);\r
-            }\r
-          }        \r
-          if (accAnnotations != null && accAnnotations.containsKey("SS"))\r
-          {\r
-                 Vector v = (Vector) accAnnotations.get("SS");\r
-                 \r
-                 for (int i = 0; i < v.size(); i++)\r
-                   {\r
-                         AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i);\r
-                         seqO.addAlignmentAnnotation(an);\r
-                         //annotations.add(an);\r
-                   }\r
-          }\r
-        \r
-          Hashtable features = null;\r
-          // We need to adjust the positions of all features to account for gaps\r
-          try\r
-          {\r
-            features = (Hashtable) accAnnotations.remove("features");\r
-          } catch (java.lang.NullPointerException e)\r
-          {\r
-            // loggerwarn("Getting Features for " + acc + ": " +\r
-            // e.getMessage());\r
-            // continue;\r
-          }\r
-          // if we have features\r
-          if (features != null)\r
-          {\r
-            int posmap[] = seqO.findPositionMap();\r
-            Enumeration i = features.keys();\r
-            while (i.hasMoreElements())\r
-            {\r
-              // TODO: parse out secondary structure annotation as annotation\r
-              // row\r
-              // TODO: parse out scores as annotation row\r
-              // TODO: map coding region to core jalview feature types\r
-              String type = i.nextElement().toString();\r
-              Hashtable content = (Hashtable) features.remove(type);\r
-              Enumeration j = content.keys();\r
-              while (j.hasMoreElements())\r
-              {\r
-                String desc = j.nextElement().toString();\r
-                String ns = content.get(desc).toString();\r
-                char[] byChar = ns.toCharArray();\r
-                for (int k = 0; k < byChar.length; k++)\r
-                {\r
-                  char c = byChar[k];\r
-                  if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM\r
-                  // uses\r
-                  // '.'\r
-                  // for\r
-                  // feature\r
-                  // background\r
-                  {\r
-                    int new_pos = posmap[k]; // look up nearest seqeunce\r
-                    // position to this column\r
-                    SequenceFeature feat = new SequenceFeature(type, desc,\r
-                            new_pos, new_pos, 0f, null);\r
-\r
-                    seqO.addSequenceFeature(feat);\r
-                  }\r
-                }\r
-              }\r
-\r
-            }\r
-\r
-          }\r
-          // garbage collect\r
-\r
-          // logger.debug("Adding seq " + acc + " from " + start + " to " + end\r
-          // + ": " + seq);\r
-          this.seqs.addElement(seqO);\r
-        }\r
-        return; // finished parsing this segment of source\r
-      }\r
-      else if (!r.search(line))\r
-      {\r
-        // System.err.println("Found sequence line: " + line);\r
-\r
-        // Split sequence in sequence and accession parts\r
-        if (!x.search(line))\r
-        {\r
-          // logger.error("Could not parse sequence line: " + line);\r
-          throw new IOException("Could not parse sequence line: " + line);\r
-        }\r
-        String ns = (String) seqs.get(x.stringMatched(1));\r
-        if (ns == null)\r
-        {\r
-          ns = "";\r
-        }\r
-        ns += x.stringMatched(2);\r
-\r
-        seqs.put(x.stringMatched(1), ns);\r
-      }\r
-      else\r
-      {\r
-        String annType = r.stringMatched(1);\r
-        String annContent = r.stringMatched(2);\r
-\r
-        // System.err.println("type:" + annType + " content: " + annContent);\r
-\r
-        if (annType.equals("GF"))\r
-        {\r
-          /*\r
-           * Generic per-File annotation, free text Magic features: #=GF NH\r
-           * <tree in New Hampshire eXtended format> #=GF TN <Unique identifier\r
-           * for the next tree> Pfam descriptions: 7. DESCRIPTION OF FIELDS\r
-           * \r
-           * Compulsory fields: ------------------\r
-           * \r
-           * AC Accession number: Accession number in form PFxxxxx.version or\r
-           * PBxxxxxx. ID Identification: One word name for family. DE\r
-           * Definition: Short description of family. AU Author: Authors of the\r
-           * entry. SE Source of seed: The source suggesting the seed members\r
-           * belong to one family. GA Gathering method: Search threshold to\r
-           * build the full alignment. TC Trusted Cutoff: Lowest sequence score\r
-           * and domain score of match in the full alignment. NC Noise Cutoff:\r
-           * Highest sequence score and domain score of match not in full\r
-           * alignment. TP Type: Type of family -- presently Family, Domain,\r
-           * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM\r
-           * Alignment Method The order ls and fs hits are aligned to the model\r
-           * to build the full align. // End of alignment.\r
-           * \r
-           * Optional fields: ----------------\r
-           * \r
-           * DC Database Comment: Comment about database reference. DR Database\r
-           * Reference: Reference to external database. RC Reference Comment:\r
-           * Comment about literature reference. RN Reference Number: Reference\r
-           * Number. RM Reference Medline: Eight digit medline UI number. RT\r
-           * Reference Title: Reference Title. RA Reference Author: Reference\r
-           * Author RL Reference Location: Journal location. PI Previous\r
-           * identifier: Record of all previous ID lines. KW Keywords: Keywords.\r
-           * CC Comment: Comments. NE Pfam accession: Indicates a nested domain.\r
-           * NL Location: Location of nested domains - sequence ID, start and\r
-           * end of insert.\r
-           * \r
-           * Obsolete fields: ----------- AL Alignment method of seed: The\r
-           * method used to align the seed members.\r
-           */\r
-          // Let's save the annotations, maybe we'll be able to do something\r
-          // with them later...\r
-          Regex an = new Regex("(\\w+)\\s*(.*)");\r
-          if (an.search(annContent))\r
-          {\r
-            if (an.stringMatched(1).equals("NH"))\r
-            {\r
-              treeString.append(an.stringMatched(2));\r
-            }\r
-            else if (an.stringMatched(1).equals("TN"))\r
-            {\r
-              if (treeString.length() > 0)\r
-              {\r
-                if (treeName == null)\r
-                {\r
-                  treeName = "Tree " + (getTreeCount() + 1);\r
-                }\r
-                addNewickTree(treeName, treeString.toString());\r
-              }\r
-              treeName = an.stringMatched(2);\r
-              treeString = new StringBuffer();\r
-            }\r
-            setAlignmentProperty(an.stringMatched(1), an.stringMatched(2));\r
-          }\r
-        }\r
-        else if (annType.equals("GS"))\r
-        {\r
-          // Generic per-Sequence annotation, free text\r
-          /*\r
-           * Pfam uses these features: Feature Description ---------------------\r
-           * ----------- AC <accession> ACcession number DE <freetext>\r
-           * DEscription DR <db>; <accession>; Database Reference OS <organism>\r
-           * OrganiSm (species) OC <clade> Organism Classification (clade, etc.)\r
-           * LO <look> Look (Color, etc.)\r
-           */\r
-          if (s.search(annContent))\r
-          {\r
-            String acc = s.stringMatched(1);\r
-            String type = s.stringMatched(2);\r
-            String content = s.stringMatched(3);\r
-            // TODO: store DR in a vector.\r
-            // TODO: store AC according to generic file db annotation.\r
-            Hashtable ann;\r
-            if (seqAnn.containsKey(acc))\r
-            {\r
-              ann = (Hashtable) seqAnn.get(acc);\r
-            }\r
-            else\r
-            {\r
-              ann = new Hashtable();\r
-            }\r
-            ann.put(type, content);\r
-            seqAnn.put(acc, ann);\r
-          }\r
-          else\r
-          {\r
-            throw new IOException("Error parsing " + line);\r
-          }\r
-        }\r
-        else if (annType.equals("GC"))\r
-        {\r
-          // Generic per-Column annotation, exactly 1 char per column\r
-          // always need a label.\r
-          if (x.search(annContent))\r
-          {\r
-            // parse out and create alignment annotation directly.\r
-            parseAnnotationRow(annotations, x.stringMatched(1),\r
-                    x.stringMatched(2));\r
-          }\r
-        }\r
-        else if (annType.equals("GR"))\r
-        {\r
-          // Generic per-Sequence AND per-Column markup, exactly 1 char per\r
-          // column\r
-          /*\r
-           * Feature Description Markup letters ------- -----------\r
-           * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface\r
-           * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane\r
-           * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15;\r
-           * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in\r
-           * or after) [0-2]\r
-           */\r
-          if (s.search(annContent))\r
-          {\r
-            String acc = s.stringMatched(1);\r
-            String type = s.stringMatched(2);\r
-            String seq = new String(s.stringMatched(3));\r
-            String description = null;\r
-            // Check for additional information about the current annotation\r
-            // We use a simple string tokenizer here for speed\r
-            StringTokenizer sep = new StringTokenizer(seq, " \t");\r
-            description = sep.nextToken();\r
-            if (sep.hasMoreTokens())\r
-            {\r
-              seq = sep.nextToken();\r
-            }\r
-            else\r
-            {\r
-              seq = description;\r
-              description = new String();\r
-            }\r
-            // sequence id with from-to fields\r
-\r
-            Hashtable ann;\r
-            // Get an object with all the annotations for this sequence\r
-            if (seqAnn.containsKey(acc))\r
-            {\r
-              // logger.debug("Found annotations for " + acc);\r
-              ann = (Hashtable) seqAnn.get(acc);\r
-            }\r
-            else\r
-            {\r
-              // logger.debug("Creating new annotations holder for " + acc);\r
-              ann = new Hashtable();\r
-              seqAnn.put(acc, ann);\r
-            }\r
-            //TODO test structure, call parseAnnotationRow with vector from hashtable for specific sequence\r
-            Hashtable features;\r
-            // Get an object with all the content for an annotation\r
-            if (ann.containsKey("features"))\r
-            {\r
-              // logger.debug("Found features for " + acc);\r
-              features = (Hashtable) ann.get("features");\r
-            }\r
-            else\r
-            {\r
-              // logger.debug("Creating new features holder for " + acc);\r
-              features = new Hashtable();\r
-              ann.put("features", features);\r
-            }\r
-\r
-            Hashtable content;\r
-            if (features.containsKey(this.id2type(type)))\r
-            {\r
-              // logger.debug("Found content for " + this.id2type(type));\r
-              content = (Hashtable) features.get(this.id2type(type));\r
-            }\r
-            else\r
-            {\r
-              // logger.debug("Creating new content holder for " +\r
-              // this.id2type(type));\r
-              content = new Hashtable();\r
-              features.put(this.id2type(type), content);\r
-            }\r
-            String ns = (String) content.get(description);\r
-            if (ns == null)\r
-            {\r
-              ns = "";\r
-            }\r
-            ns += seq;\r
-            content.put(description, ns);\r
-
-            if(type.equals("SS")){\r
-                Hashtable strucAnn;\r
-                if (seqAnn.containsKey(acc))\r
-                {\r
-                  strucAnn = (Hashtable) seqAnn.get(acc);\r
-                }\r
-                else\r
-                {\r
-                  strucAnn = new Hashtable();\r
-                }\r
-                \r
-                Vector newStruc=new Vector();\r
-                parseAnnotationRow(newStruc, type,ns);\r
-                \r
-                strucAnn.put(type, newStruc);\r
-                seqAnn.put(acc, strucAnn);\r
-             }\r
-          }\r
-          else\r
-          {\r
-            System.err\r
-                    .println("Warning - couldn't parse sequence annotation row line:\n"\r
-                            + line);\r
-            // throw new IOException("Error parsing " + line);\r
-          }\r
-        }\r
-        else\r
-        {\r
-          throw new IOException("Unknown annotation detected: " + annType\r
-                  + " " + annContent);\r
-        }\r
-      }\r
-    }\r
-    if (treeString.length() > 0)\r
-    {\r
-      if (treeName == null)\r
-      {\r
-        treeName = "Tree " + (1 + getTreeCount());\r
-      }\r
-      addNewickTree(treeName, treeString.toString());\r
-    }\r
+         FileReader fr = null;\r
+         fr = new FileReader(inFile); \r
+\r
+       BufferedReader r = new BufferedReader (fr);\r
+       result = RNAFactory.loadSecStrStockholm(r);\r
+       System.out.println("this is the secondary scructure:" +result.size());\r
+       SequenceI[] seqs = new SequenceI[result.size()];\r
+         System.out.println(type); //the type is "File"\r
+         System.out.println(inFile );//inFile is the path\r
+       for(int i=0;i<result.size();i++)\r
+       {\r
+               RNA current = result.get(i);\r
+       \r
+                 System.out.println(current.getSeq());\r
+                 //System.out.println(result.get(i).getStructBPSEQ());\r
+                 System.out.println(result.get(i).getStructDBN(true));\r
+                 System.out.println(i);\r
+               String rna =current.getStructDBN(true);\r
+                String seq = current.getSeq();\r
+                int begin=0;\r
+                 int end = seq.length()-1;\r
+                 id = safeName(getDataName());\r
+                 seqs[i] = new Sequence(id, seq, begin, end);\r
+                 String[] annot=new String[rna.length()] ;\r
+                 Annotation[] ann = new Annotation[rna.length()];\r
+                 for(int j=0;j<rna.length();j++)\r
+                       {\r
+                         annot[j] =rna.substring(j,j+1);\r
+                 \r
+                       }\r
+                 \r
+                 for(int k=0;k<rna.length();k++)\r
+               {\r
+                         ann[k] = new Annotation(annot[k], "", jalview.schemes.ResidueProperties.getRNASecStrucState(annot[k]).charAt(0), 0f);\r
+                                                 \r
+               }\r
+                 AlignmentAnnotation align = new AlignmentAnnotation("Sec. str.",current.getID(),ann);\r
+                 \r
+                 seqs[i].addAlignmentAnnotation(align);\r
+                 seqs[i].setRNA(result.get(i));\r
+                 this.annotations.addElement(align);\r
+               }\r
+         this.setSeqs(seqs);\r
+       \r
   }\r
-\r
+//    r = new Regex("# STOCKHOLM ([\\d\\.]+)");\r
+ //    if (!r.search(nextLine()))\r
+//    {\r
+//      throw new IOException(\r
+//              "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'");\r
+//    }\r
+//    else\r
+//    {\r
+//      version = r.stringMatched(1);\r
+//      // logger.debug("Stockholm version: " + version);\r
+//    }\r
+//\r
+//    // We define some Regexes here that will be used regularily later\r
+//    rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment\r
+//    p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in\r
+//    // id/from/to\r
+//    s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype\r
+//    r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line\r
+//    x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence\r
+//\r
+//    // Convert all bracket types to parentheses (necessary for passing to VARNA)\r
+//    Regex openparen = new Regex("(<|\\[)", "(");\r
+//    Regex closeparen = new Regex("(>|\\])", ")");\r
+//\r
+//    // Detect if file is RNA by looking for bracket types\r
+//    Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
+//\r
+//    rend.optimize();\r
+//    p.optimize();\r
+//    s.optimize();\r
+//    r.optimize();\r
+//    x.optimize();\r
+//    openparen.optimize();\r
+//    closeparen.optimize();\r
+//\r
+//    while ((line = nextLine()) != null)\r
+//    {\r
+//      if (line.length() == 0)\r
+//      {\r
+//        continue;\r
+//      }\r
+//      if (rend.search(line))\r
+//      {\r
+//        // End of the alignment, pass stuff back\r
+//\r
+//        this.noSeqs = seqs.size();\r
+//        // logger.debug("Number of sequences: " + this.noSeqs);\r
+//        Enumeration accs = seqs.keys();\r
+//        while (accs.hasMoreElements())\r
+//        {\r
+//          String acc = (String) accs.nextElement();\r
+//          // logger.debug("Processing sequence " + acc);\r
+//          String seq = (String) seqs.remove(acc);\r
+//          if (maxLength < seq.length())\r
+//          {\r
+//            maxLength = seq.length();\r
+//          }\r
+//          int start = 1;\r
+//          int end = -1;\r
+//          String sid = acc;\r
+//          /*\r
+//           * Retrieve hash of annotations for this accession\r
+//           * Associate Annotation with accession\r
+//           */\r
+//          Hashtable accAnnotations = null;\r
+//\r
+//          if (seqAnn != null && seqAnn.containsKey(acc))\r
+//          {\r
+//            accAnnotations = (Hashtable) seqAnn.remove(acc);\r
+//            //TODO: add structures to sequence\r
+//          }\r
+//\r
+//          // Split accession in id and from/to\r
+//          if (p.search(acc))\r
+//          {\r
+//            sid = p.stringMatched(1);\r
+//            start = Integer.parseInt(p.stringMatched(2));\r
+//            end = Integer.parseInt(p.stringMatched(3));\r
+//          }\r
+//          // logger.debug(sid + ", " + start + ", " + end);\r
+//\r
+//          Sequence seqO = new Sequence(sid, seq, start, end);\r
+//          // Add Description (if any)\r
+//          if (accAnnotations != null && accAnnotations.containsKey("DE"))\r
+//          {\r
+//            String desc = (String) accAnnotations.get("DE");\r
+//            seqO.setDescription((desc == null) ? "" : desc);\r
+//          }\r
+//          // Add DB References (if any)\r
+//          if (accAnnotations != null && accAnnotations.containsKey("DR"))\r
+//          {\r
+//            String dbr = (String) accAnnotations.get("DR");\r
+//            if (dbr != null && dbr.indexOf(";") > -1)\r
+//            {\r
+//              String src = dbr.substring(0, dbr.indexOf(";"));\r
+//              String acn = dbr.substring(dbr.indexOf(";") + 1);\r
+//              jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);\r
+//              // seqO.addDBRef(dbref);\r
+//            }\r
+//          }        \r
+//          if (accAnnotations != null && accAnnotations.containsKey("SS"))\r
+//          {\r
+//               Vector v = (Vector) accAnnotations.get("SS");\r
+//               \r
+//               for (int i = 0; i < v.size(); i++)\r
+//                 {\r
+//                       AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i);\r
+//                       seqO.addAlignmentAnnotation(an);\r
+//                       //annotations.add(an);\r
+//                 }\r
+//          }\r
+//        \r
+//          Hashtable features = null;\r
+//          // We need to adjust the positions of all features to account for gaps\r
+//          try\r
+//          {\r
+//            features = (Hashtable) accAnnotations.remove("features");\r
+//          } catch (java.lang.NullPointerException e)\r
+//          {\r
+//            // loggerwarn("Getting Features for " + acc + ": " +\r
+//            // e.getMessage());\r
+//            // continue;\r
+//          }\r
+//          // if we have features\r
+//          if (features != null)\r
+//          {\r
+//            int posmap[] = seqO.findPositionMap();\r
+//            Enumeration i = features.keys();\r
+//            while (i.hasMoreElements())\r
+//            {\r
+//              // TODO: parse out secondary structure annotation as annotation\r
+//              // row\r
+//              // TODO: parse out scores as annotation row\r
+//              // TODO: map coding region to core jalview feature types\r
+//              String type = i.nextElement().toString();\r
+//              Hashtable content = (Hashtable) features.remove(type);\r
+//              Enumeration j = content.keys();\r
+//              while (j.hasMoreElements())\r
+//              {\r
+//                String desc = j.nextElement().toString();\r
+//                String ns = content.get(desc).toString();\r
+//                char[] byChar = ns.toCharArray();\r
+//                for (int k = 0; k < byChar.length; k++)\r
+//                {\r
+//                  char c = byChar[k];\r
+//                  if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM\r
+//                  // uses\r
+//                  // '.'\r
+//                  // for\r
+//                  // feature\r
+//                  // background\r
+//                  {\r
+//                    int new_pos = posmap[k]; // look up nearest seqeunce\r
+//                    // position to this column\r
+//                    SequenceFeature feat = new SequenceFeature(type, desc,\r
+//                            new_pos, new_pos, 0f, null);\r
+//\r
+//                    seqO.addSequenceFeature(feat);\r
+//                  }\r
+//                }\r
+//              }\r
+//\r
+//            }\r
+//\r
+//          }\r
+//          // garbage collect\r
+//\r
+//          // logger.debug("Adding seq " + acc + " from " + start + " to " + end\r
+//          // + ": " + seq);\r
+//          this.seqs.addElement(seqO);\r
+//        }\r
+//        return; // finished parsing this segment of source\r
+//      }\r
+//      else if (!r.search(line))\r
+//      {\r
+//        // System.err.println("Found sequence line: " + line);\r
+//\r
+//        // Split sequence in sequence and accession parts\r
+//        if (!x.search(line))\r
+//        {\r
+//          // logger.error("Could not parse sequence line: " + line);\r
+//          throw new IOException("Could not parse sequence line: " + line);\r
+//        }\r
+//        String ns = (String) seqs.get(x.stringMatched(1));\r
+//        if (ns == null)\r
+//        {\r
+//          ns = "";\r
+//        }\r
+//        ns += x.stringMatched(2);\r
+//\r
+//        seqs.put(x.stringMatched(1), ns);\r
+//      }\r
+//      else\r
+//      {\r
+//        String annType = r.stringMatched(1);\r
+//        String annContent = r.stringMatched(2);\r
+//\r
+//        // System.err.println("type:" + annType + " content: " + annContent);\r
+//\r
+//        if (annType.equals("GF"))\r
+//        {\r
+//          /*\r
+//           * Generic per-File annotation, free text Magic features: #=GF NH\r
+//           * <tree in New Hampshire eXtended format> #=GF TN <Unique identifier\r
+//           * for the next tree> Pfam descriptions: 7. DESCRIPTION OF FIELDS\r
+//           * \r
+//           * Compulsory fields: ------------------\r
+//           * \r
+//           * AC Accession number: Accession number in form PFxxxxx.version or\r
+//           * PBxxxxxx. ID Identification: One word name for family. DE\r
+//           * Definition: Short description of family. AU Author: Authors of the\r
+//           * entry. SE Source of seed: The source suggesting the seed members\r
+//           * belong to one family. GA Gathering method: Search threshold to\r
+//           * build the full alignment. TC Trusted Cutoff: Lowest sequence score\r
+//           * and domain score of match in the full alignment. NC Noise Cutoff:\r
+//           * Highest sequence score and domain score of match not in full\r
+//           * alignment. TP Type: Type of family -- presently Family, Domain,\r
+//           * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM\r
+//           * Alignment Method The order ls and fs hits are aligned to the model\r
+//           * to build the full align. // End of alignment.\r
+//           * \r
+//           * Optional fields: ----------------\r
+//           * \r
+//           * DC Database Comment: Comment about database reference. DR Database\r
+//           * Reference: Reference to external database. RC Reference Comment:\r
+//           * Comment about literature reference. RN Reference Number: Reference\r
+//           * Number. RM Reference Medline: Eight digit medline UI number. RT\r
+//           * Reference Title: Reference Title. RA Reference Author: Reference\r
+//           * Author RL Reference Location: Journal location. PI Previous\r
+//           * identifier: Record of all previous ID lines. KW Keywords: Keywords.\r
+//           * CC Comment: Comments. NE Pfam accession: Indicates a nested domain.\r
+//           * NL Location: Location of nested domains - sequence ID, start and\r
+//           * end of insert.\r
+//           * \r
+//           * Obsolete fields: ----------- AL Alignment method of seed: The\r
+//           * method used to align the seed members.\r
+//           */\r
+//          // Let's save the annotations, maybe we'll be able to do something\r
+//          // with them later...\r
+//          Regex an = new Regex("(\\w+)\\s*(.*)");\r
+//          if (an.search(annContent))\r
+//          {\r
+//            if (an.stringMatched(1).equals("NH"))\r
+//            {\r
+//              treeString.append(an.stringMatched(2));\r
+//            }\r
+//            else if (an.stringMatched(1).equals("TN"))\r
+//            {\r
+//              if (treeString.length() > 0)\r
+//              {\r
+//                if (treeName == null)\r
+//                {\r
+//                  treeName = "Tree " + (getTreeCount() + 1);\r
+//                }\r
+//                addNewickTree(treeName, treeString.toString());\r
+//              }\r
+//              treeName = an.stringMatched(2);\r
+//              treeString = new StringBuffer();\r
+//            }\r
+//            setAlignmentProperty(an.stringMatched(1), an.stringMatched(2));\r
+//          }\r
+//        }\r
+//        else if (annType.equals("GS"))\r
+//        {\r
+//          // Generic per-Sequence annotation, free text\r
+//          /*\r
+//           * Pfam uses these features: Feature Description ---------------------\r
+//           * ----------- AC <accession> ACcession number DE <freetext>\r
+//           * DEscription DR <db>; <accession>; Database Reference OS <organism>\r
+//           * OrganiSm (species) OC <clade> Organism Classification (clade, etc.)\r
+//           * LO <look> Look (Color, etc.)\r
+//           */\r
+//          if (s.search(annContent))\r
+//          {\r
+//            String acc = s.stringMatched(1);\r
+//            String type = s.stringMatched(2);\r
+//            String content = s.stringMatched(3);\r
+//            // TODO: store DR in a vector.\r
+//            // TODO: store AC according to generic file db annotation.\r
+//            Hashtable ann;\r
+//            if (seqAnn.containsKey(acc))\r
+//            {\r
+//              ann = (Hashtable) seqAnn.get(acc);\r
+//            }\r
+//            else\r
+//            {\r
+//              ann = new Hashtable();\r
+//            }\r
+//            ann.put(type, content);\r
+//            seqAnn.put(acc, ann);\r
+//          }\r
+//          else\r
+//          {\r
+//            throw new IOException("Error parsing " + line);\r
+//          }\r
+//        }\r
+//        else if (annType.equals("GC"))\r
+//        {\r
+//          // Generic per-Column annotation, exactly 1 char per column\r
+//          // always need a label.\r
+//          if (x.search(annContent))\r
+//          {\r
+//            // parse out and create alignment annotation directly.\r
+//            parseAnnotationRow(annotations, x.stringMatched(1),\r
+//                    x.stringMatched(2));\r
+//          }\r
+//        }\r
+//        else if (annType.equals("GR"))\r
+//        {\r
+//          // Generic per-Sequence AND per-Column markup, exactly 1 char per\r
+//          // column\r
+//          /*\r
+//           * Feature Description Markup letters ------- -----------\r
+//           * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface\r
+//           * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane\r
+//           * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15;\r
+//           * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in\r
+//           * or after) [0-2]\r
+//           */\r
+//          if (s.search(annContent))\r
+//          {\r
+//            String acc = s.stringMatched(1);\r
+//            String type = s.stringMatched(2);\r
+//            String seq = new String(s.stringMatched(3));\r
+//            String description = null;\r
+//            // Check for additional information about the current annotation\r
+//            // We use a simple string tokenizer here for speed\r
+//            StringTokenizer sep = new StringTokenizer(seq, " \t");\r
+//            description = sep.nextToken();\r
+//            if (sep.hasMoreTokens())\r
+//            {\r
+//              seq = sep.nextToken();\r
+//            }\r
+//            else\r
+//            {\r
+//              seq = description;\r
+//              description = new String();\r
+//            }\r
+//            // sequence id with from-to fields\r
+//\r
+//            Hashtable ann;\r
+//            // Get an object with all the annotations for this sequence\r
+//            if (seqAnn.containsKey(acc))\r
+//            {\r
+//              // logger.debug("Found annotations for " + acc);\r
+//              ann = (Hashtable) seqAnn.get(acc);\r
+//            }\r
+//            else\r
+//            {\r
+//              // logger.debug("Creating new annotations holder for " + acc);\r
+//              ann = new Hashtable();\r
+//              seqAnn.put(acc, ann);\r
+//            }\r
+//            //TODO test structure, call parseAnnotationRow with vector from hashtable for specific sequence\r
+//            Hashtable features;\r
+//            // Get an object with all the content for an annotation\r
+//            if (ann.containsKey("features"))\r
+//            {\r
+//              // logger.debug("Found features for " + acc);\r
+//              features = (Hashtable) ann.get("features");\r
+//            }\r
+//            else\r
+//            {\r
+//              // logger.debug("Creating new features holder for " + acc);\r
+//              features = new Hashtable();\r
+//              ann.put("features", features);\r
+//            }\r
+//\r
+//            Hashtable content;\r
+//            if (features.containsKey(this.id2type(type)))\r
+//            {\r
+//              // logger.debug("Found content for " + this.id2type(type));\r
+//              content = (Hashtable) features.get(this.id2type(type));\r
+//            }\r
+//            else\r
+//            {\r
+//              // logger.debug("Creating new content holder for " +\r
+//              // this.id2type(type));\r
+//              content = new Hashtable();\r
+//              features.put(this.id2type(type), content);\r
+//            }\r
+//            String ns = (String) content.get(description);\r
+//            if (ns == null)\r
+//            {\r
+//              ns = "";\r
+//            }\r
+//            ns += seq;\r
+//            content.put(description, ns);\r
+//
+//            if(type.equals("SS")){\r
+//                Hashtable strucAnn;\r
+//                if (seqAnn.containsKey(acc))\r
+//                {\r
+//                  strucAnn = (Hashtable) seqAnn.get(acc);\r
+//                }\r
+//                else\r
+//                {\r
+//                  strucAnn = new Hashtable();\r
+//                }\r
+//                \r
+//                Vector newStruc=new Vector();\r
+//                parseAnnotationRow(newStruc, type,ns);\r
+//                \r
+//                strucAnn.put(type, newStruc);\r
+//                seqAnn.put(acc, strucAnn);\r
+//             }\r
+//          }\r
+//          else\r
+//          {\r
+//            System.err\r
+//                    .println("Warning - couldn't parse sequence annotation row line:\n"\r
+//                            + line);\r
+//            // throw new IOException("Error parsing " + line);\r
+//          }\r
+//        }\r
+//        else\r
+//        {\r
+//          throw new IOException("Unknown annotation detected: " + annType\r
+//                  + " " + annContent);\r
+//        }\r
+//      }\r
+//    }\r
+//    if (treeString.length() > 0)\r
+//    {\r
+//      if (treeName == null)\r
+//      {\r
+//        treeName = "Tree " + (1 + getTreeCount());\r
+//      }\r
+//      addNewickTree(treeName, treeString.toString());\r
+//    }\r
+//  }\r
+//\r
   protected static AlignmentAnnotation parseAnnotationRow(Vector annotation,\r
           String label, String annots)\r
   {\r
@@ -538,7 +573,7 @@ public class StockholmFile extends AlignFile
     Regex openparen = new Regex("(<|\\[)", "(");\r
     Regex closeparen = new Regex("(>|\\])", ")");\r
 \r
-    // Detect if file is RNA by looking for bracket types\r
+   // Detect if file is RNA by looking for bracket types\r
     Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
 \r
     convert1 = openparen.replaceAll(annots);\r
@@ -566,7 +601,7 @@ public class StockholmFile extends AlignFile
         if (detectbrackets.search(pos))\r
         {\r
           ann.secondaryStructure = jalview.schemes.ResidueProperties\r
-                  .getRNASecStrucState(pos).charAt(0);\r
+                 .getRNASecStrucState(pos).charAt(0);\r
         }\r
         else\r
         {\r
@@ -579,14 +614,14 @@ public class StockholmFile extends AlignFile
           ann.displayCharacter = ""; // null; // " ";\r
         }\r
         else\r
-        {\r
+       {\r
           ann.displayCharacter = " " + ann.displayCharacter;\r
         }\r
       }\r
 \r
       els[i] = ann;\r
     }\r
-    AlignmentAnnotation annot = null;\r
+   AlignmentAnnotation annot = null;\r
     Enumeration e = annotation.elements();\r
     while (e.hasMoreElements())\r
     {\r
@@ -601,16 +636,16 @@ public class StockholmFile extends AlignFile
       annotation.addElement(annot);\r
     }\r
     else\r
-    {\r
+   {\r
       Annotation[] anns = new Annotation[annot.annotations.length\r
               + els.length];\r
-      System.arraycopy(annot.annotations, 0, anns, 0,\r
-              annot.annotations.length);\r
+     System.arraycopy(annot.annotations, 0, anns, 0,\r
+             annot.annotations.length);\r
       System.arraycopy(els, 0, anns, annot.annotations.length, els.length);\r
       annot.annotations = anns;\r
       //System.out.println("else: ");\r
-    }\r
-    return annot;\r
+   }\r
+   return annot;\r
   }\r
 \r
   public static String print(SequenceI[] s)\r
@@ -691,5 +726,24 @@ public class StockholmFile extends AlignFile
    * \r
    * \r
    * return helicesAnnot; }\r
+   * \r
    */\r
+  /**\r
+   * make a friendly ID string.\r
+   * \r
+   * @param dataName\r
+   * @return truncated dataName to after last '/'\r
+   */\r
+  private String safeName(String dataName)\r
+  {\r
+    int b = 0;\r
+    while ((b = dataName.indexOf("/")) > -1 && b < dataName.length() )\r
+    {             \r
+       dataName = dataName.substring(b + 1).trim();\r
+       \r
+    }\r
+    int e = (dataName.length() - dataName.indexOf("."))+1;\r
+    dataName = dataName.substring(1,e).trim();\r
+    return dataName;\r
+  }\r
 }\r
index 45bfd43..9f26670 100644 (file)
@@ -26,6 +26,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 /**
  * A file parse for T-Coffee score ascii format. This file contains the alignment consensus 
@@ -82,13 +83,13 @@ import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
  */
 public class TCoffeeScoreFile extends AlignFile {
        
-  public TCoffeeScoreFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public TCoffeeScoreFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
     
   }
 
-  public TCoffeeScoreFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
+  public TCoffeeScoreFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 9b17d81..b53bcc3 100755 (executable)
@@ -813,6 +813,7 @@ public class GAlignFrame extends JInternalFrame
             });
     this.getContentPane().setLayout(borderLayout1);
     alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
+    alignFrameMenuBar.setBackground(Color.lightGray);
     statusBar.setBackground(Color.white);
     statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
     statusBar.setBorder(BorderFactory.createLineBorder(Color.black));
index 16fe9a9..2077d39 100755 (executable)
@@ -126,6 +126,7 @@ public class GDesktop extends JFrame
    */
   private void jbInit() throws Exception
   {
+        
     FileMenu.setText("File");
     HelpMenu.setText("Help");
     VamsasMenu.setText("Vamsas");
@@ -322,6 +323,7 @@ public class GDesktop extends JFrame
     desktopMenubar.add(VamsasMenu);
     desktopMenubar.add(HelpMenu);
     desktopMenubar.add(windowMenu);
+    desktopMenubar.setBackground(Color.lightGray);
     FileMenu.add(inputMenu);
     FileMenu.add(inputSequence);
     FileMenu.addSeparator();
index 8694ecd..b699543 100644 (file)
@@ -1,3 +1,4 @@
+
 package jalview.renderer;
 
 import jalview.analysis.AAFrequency;
@@ -129,16 +130,17 @@ public class AnnotationRenderer
   private int imgWidth;
 
   
-  public void drawNotCanonicalAnnot(Graphics g, Annotation[] row_annotations,
+  public void drawNotCanonicalAnnot(Graphics g, Color nonCanColor, Annotation[] row_annotations,
           int lastSSX, int x, int y, int iconOffset, int startRes,
           int column, boolean validRes, boolean validEnd)
   {
+       //System.out.println(nonCanColor);
        
-    g.setColor(NOTCANONICAL_COLOUR);
+    g.setColor(nonCanColor);
     int sCol = (lastSSX / charWidth) + startRes;
     int x1 = lastSSX;
     int x2 = (x * charWidth);
-    Regex closeparen = new Regex("(}|]|a|b|c|d)");
+    Regex closeparen = new Regex("}|]|<|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z");
     
     String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
             : row_annotations[column - 1].displayCharacter;
@@ -492,7 +494,8 @@ public class AnnotationRenderer
                                     .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter
                             .length() < 2 && row_annotations[column].secondaryStructure == ' ')))
             {
-              g.drawString(row_annotations[column].displayCharacter, x
+               g.drawString(row_annotations[column].displayCharacter
+                         , x
                       * charWidth + charOffset, y + iconOffset);
             }
             g.setFont(ofont);
@@ -501,25 +504,284 @@ public class AnnotationRenderer
         if (row.hasIcons)
         {
           char ss = validRes ? row_annotations[column].secondaryStructure
-                  : ' ';
+                  : '-';
           
-          if (ss == 'S')
+          if (ss == '(')
           {
             // distinguish between forward/backward base-pairing
             if (row_annotations[column].displayCharacter.indexOf(')') > -1)
             {
-              ss = 's';
+            
+              ss = ')';
               
             }
           }
-           if (ss == 'C')
+           if (ss == '[')
           {
-            if ((row_annotations[column].displayCharacter.indexOf(']') > -1) || (row_annotations[column].displayCharacter.indexOf('}') > -1))
+            if ((row_annotations[column].displayCharacter.indexOf(']') > -1))
             {
-                ss = 'c';
+                ss = ']';
+                
                 
             }
           }
+           if (ss == '{')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('}') > -1)
+             {
+               ss = '}';
+               
+               
+             }
+           }
+           if (ss == '<')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('<') > -1)
+             {
+               ss = '>';
+               
+               
+             }
+           }
+           if (ss == 'A')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('a') > -1)
+             {
+               ss = 'a';
+              
+               
+             }
+           }
+           
+           if (ss == 'B')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('b') > -1)
+             {
+               ss = 'b';
+               
+             }
+           }
+           
+           if (ss == 'C')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('c') > -1)
+             {
+               ss = 'c';
+               
+             }
+           }
+           if (ss == 'D')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('d') > -1)
+             {
+               ss = 'd';
+               
+             }
+           }
+           if (ss == '1')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('e') > -1)
+             {
+               ss = 'e';
+               
+             }
+           }
+           if (ss == 'F')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('f') > -1)
+             {
+               ss = 'f';
+               
+             }
+           }
+           if (ss == 'G')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('g') > -1)
+             {
+               ss = 'g';
+               
+             }
+           }
+           if (ss == '2')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('h') > -1)
+             {
+               ss = 'h';
+               
+             }
+           }
+           if (ss == 'I')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('i') > -1)
+             {
+               ss = 'i';
+               
+             }
+           }
+           if (ss == 'J')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('j') > -1)
+             {
+               ss = 'j';
+               
+             }
+           }
+           if (ss == 'K')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('k') > -1)
+             {
+               ss = 'k';
+               
+             }
+           }
+           if (ss == 'L')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('l') > -1)
+             {
+               ss = 'l';
+               
+             }
+           }
+           if (ss == 'M')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('m') > -1)
+             {
+               ss = 'm';
+               
+             }
+           }
+           if (ss == 'N')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('n') > -1)
+             {
+               ss = 'n';
+               
+             }
+           }
+           if (ss == 'O')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('o') > -1)
+             {
+               ss = 'o';
+               
+             }
+           }
+           if (ss == 'P')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('p') > -1)
+             {
+               ss = 'p';
+               
+             }
+           }
+           if (ss == 'Q')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('q') > -1)
+             {
+               ss = 'q';
+               
+             }
+           }
+           if (ss == 'R')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('r') > -1)
+             {
+               ss = 'r';
+               
+             }
+           }
+           if (ss == 'S')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('s') > -1)
+             {
+               ss = 's';
+               
+             }
+           }
+           if (ss == 'T')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('t') > -1)
+             {
+               ss = 't';
+               
+             }
+           }
+           if (ss == 'U')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('u') > -1)
+             {
+               ss = 'u';
+               
+             }
+           }
+           if (ss == 'V')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('v') > -1)
+             {
+               ss = 'v';
+               
+             }
+           }
+           if (ss == 'W')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('w') > -1)
+             {
+               ss = 'w';
+               
+             }
+           }
+           if (ss == 'X')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('x') > -1)
+             {
+               ss = 'x';
+               
+             }
+           }
+           if (ss == 'Y')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('y') > -1)
+             {
+               ss = 'y';
+               
+             }
+           }
+           if (ss == 'Z')
+           {
+             // distinguish between forward/backward base-pairing
+             if (row_annotations[column].displayCharacter.indexOf('z') > -1)
+             {
+               ss = 'z';
+               
+             }
+           }
           if (!validRes || (ss != lastSS))
           {
             if (x > -1)
@@ -536,14 +798,72 @@ public class AnnotationRenderer
                         column, validRes, validEnd);
                 break;
 
-              case 'S': // Stem case for RNA secondary structure
-              case 's': // and opposite direction
+              case '(': // Stem case for RNA secondary structure
+              case ')': // and opposite direction
                 drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
                         column, validRes, validEnd);
                 break;
+              case '{':
+              case '}':
+              case '[':
+              case ']':
+              case '>':
+              case '<':
+              case 'A':
+              case 'a':
+              case 'B':
+              case 'b':
               case 'C':
               case 'c':
-                 drawNotCanonicalAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+              case 'D':
+              case 'd':
+              case '1':
+              case 'e':
+              case 'F':
+              case 'f':
+              case 'G':
+              case 'g':
+              case '2':
+              case 'h':
+              case 'I':
+              case 'i':
+              case 'J':
+              case 'j':
+              case 'K':
+              case 'k':
+              case 'L':
+              case 'l':
+              case 'M':
+              case 'm':
+              case 'N':
+              case 'n':
+              case 'O':
+              case 'o':
+              case 'P':
+              case 'p':
+              case 'Q':
+              case 'q':
+              case 'R':
+              case 'r':
+              case 'S':
+              case 's':
+              case 'T':
+              case 't':
+              case 'U':
+              case 'u':
+              case 'V':
+              case 'v':
+              case 'W':
+              case 'w':
+              case 'X':
+              case 'x':
+              case 'Y':
+              case 'y':
+              case 'Z':
+              case 'z':
+                 //System.out.println(lastSS);
+                 Color nonCanColor= getNotCanonicalColor(lastSS);
+                 drawNotCanonicalAnnot(g, nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes,
                           column, validRes, validEnd);
                  break;
               default:
@@ -610,9 +930,65 @@ public class AnnotationRenderer
           drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
                   column, validRes, validEnd);
           break;
+        case '{':
+        case '}':
+        case '[':
+        case ']':
+        case '>':
+        case '<':
+        case 'A':
+        case 'a':
+        case 'B':
+        case 'b':
+        case 'C':
         case 'c':
-        case 'C': 
-         drawNotCanonicalAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+        case 'D':
+        case 'd':
+        case '1':
+        case 'e':
+        case 'F':
+        case 'f':
+        case 'G':
+        case 'g':
+        case '2':
+        case 'h':
+        case 'I':
+        case 'i':
+        case 'J':
+        case 'j':
+        case 'K':
+        case 'k':
+        case 'L':
+        case 'l':
+        case 'M':
+        case 'm':
+        case 'N':
+        case 'n':
+        case 'O':
+        case 'o':
+        case 'P':
+        case 'p':
+        case 'Q':
+        case 'q':
+        case 'R':
+        case 'r':
+        case 'T':
+        case 't':
+        case 'U':
+        case 'u':
+        case 'V':
+        case 'v':
+        case 'W':
+        case 'w':
+        case 'X':
+        case 'x':
+        case 'Y':
+        case 'y':
+        case 'Z':
+        case 'z':
+               //System.out.println(lastSS);
+          Color nonCanColor = getNotCanonicalColor(lastSS);
+         drawNotCanonicalAnnot(g,nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes,
                     column, validRes, validEnd);
          break;
         default:
@@ -696,7 +1072,7 @@ public class AnnotationRenderer
 
   private final Color STEM_COLOUR = Color.blue;
   
-  private final Color NOTCANONICAL_COLOUR = Color.red;
+  private  Color sdNOTCANONICAL_COLOUR;
 
   public void drawGlyphLine(Graphics g, Annotation[] row,
           int lastSSX, int x, int y, int iconOffset, int startRes,
@@ -1076,4 +1452,135 @@ public class AnnotationRenderer
       x += charWidth;
     }
   }
+
+  
+  Color getNotCanonicalColor(char lastss)
+       {
+         switch (lastss)
+      {
+         case '{':  
+             case '}':
+                 return Color.cyan;
+                
+             case '[':
+             case ']':
+                 return Color.green;
+                
+             case '>':
+             case '<':
+                 return Color.magenta;
+                 
+             case 'A':
+             case 'a':
+                 return Color.orange;
+               
+             case 'B':
+             case 'b':
+                 return Color.pink;
+                 
+             case 'C':
+             case 'c':
+                 return Color.red;
+                
+             case 'D':
+             case 'd':
+                 return Color.yellow;
+                 
+             case '1':
+             case 'e':
+                 return Color.black;
+                
+             case 'F':
+             case 'f':
+                 return Color.darkGray;
+                
+             case 'G':
+             case 'g':
+                 return Color.gray;
+               
+             case '2':
+             case 'h':
+                 return Color.lightGray;
+                 
+             case 'I':
+             case 'i':
+                 return Color.white;
+                
+             case 'J':
+             case 'j':
+                 return Color.cyan;
+                 
+             case 'K':
+             case 'k':
+                 return Color.magenta;
+               
+             case 'L':
+             case 'l':
+                 return Color.orange;
+       
+             case 'M':
+             case 'm':
+                 return Color.red;
+               
+             case 'N':
+             case 'n':
+                 return Color.yellow;
+                 
+             case 'O':
+             case 'o':
+                 return Color.pink;
+               
+             case 'P':
+             case 'p':
+                 return Color.black;
+               
+             case 'Q':
+             case 'q':
+                 return Color.blue;
+       
+             case 'R':
+             case 'r':
+                 return Color.cyan;
+       
+             case 'S':
+             case 's':
+                 return Color.magenta;
+               
+             case 'T':
+             case 't':
+                 return Color.darkGray;
+                
+             case 'U':
+             case 'u':
+                 return Color.yellow;
+                 
+             case 'V':
+             case 'v':
+                 return Color.blue;
+                
+             case 'W':
+             case 'w':
+                 return Color.orange;
+                 
+             case 'X':
+             case 'x':
+                 return Color.magenta;
+                
+             case 'Y':
+             case 'y':
+                 return Color.blue;
+                 
+             case 'Z':
+             case 'z':
+                 return Color.blue;
+                
+       default :
+               System.out.println("This is not a interaction");
+               return null;
+               
+      }
+       }
 }
+
+       
+       
index 3197caf..08e699b 100644 (file)
@@ -8,7 +8,7 @@ import java.awt.Color;
 public class RNAInteractionColourScheme extends ResidueColourScheme{
         public RNAInteractionColourScheme()
          {
-           super(ResidueProperties.nucleotide, 0);
+           super();
          }
 
          /**
index 666834e..b54f64b 100755 (executable)
@@ -35,7 +35,7 @@ import java.util.Map;
  */
 public class ResidueColourScheme implements ColourSchemeI
 {
-  final int[] symbolIndex;
+  int[] symbolIndex;
   boolean conservationColouring = false;
 
   Color[] colors = null;
index 2416344..300ed34 100755 (executable)
@@ -1340,20 +1340,67 @@ public class ResidueProperties
   static
   {
     toRNAssState = new Hashtable();
-    toRNAssState.put(")", "S");
-    toRNAssState.put("(", "S");
-    toRNAssState.put("]", "C");
-    toRNAssState.put("[", "C");
-    toRNAssState.put("{", "C");
-    toRNAssState.put("}", "C");
-    toRNAssState.put("A", "C");
-    toRNAssState.put("a", "C");
-    toRNAssState.put("B", "C");
-    toRNAssState.put("b", "C");
+    toRNAssState.put(")", "(");
+    toRNAssState.put("(", "(");
+    toRNAssState.put("]", "[");
+    toRNAssState.put("[", "[");
+    toRNAssState.put("{", "{");
+    toRNAssState.put("}", "{");
+    toRNAssState.put(">", ">");
+    toRNAssState.put("<", ">");
+    toRNAssState.put("A", "A");
+    toRNAssState.put("a", "A");
+    toRNAssState.put("B", "B");
+    toRNAssState.put("b", "B");
     toRNAssState.put("C", "C");
     toRNAssState.put("c", "C");
-    toRNAssState.put("D", "C");
-    toRNAssState.put("d", "C");
+    toRNAssState.put("D", "D");
+    toRNAssState.put("d", "D");
+    toRNAssState.put("1", "1");
+    toRNAssState.put("e", "1");
+    toRNAssState.put("F", "F");
+    toRNAssState.put("f", "F");
+    toRNAssState.put("G", "G");
+    toRNAssState.put("g", "G");
+    toRNAssState.put("2", "2");
+    toRNAssState.put("h", "2");
+    toRNAssState.put("I", "I");
+    toRNAssState.put("i", "I");
+    toRNAssState.put("J", "J");
+    toRNAssState.put("j", "J");
+    toRNAssState.put("K", "K");
+    toRNAssState.put("k", "K");
+    toRNAssState.put("L", "L");
+    toRNAssState.put("l", "L");
+    toRNAssState.put("M", "M");
+    toRNAssState.put("m", "M");
+    toRNAssState.put("N", "N");
+    toRNAssState.put("n", "N");
+    toRNAssState.put("O", "O");
+    toRNAssState.put("o", "O");
+    toRNAssState.put("P", "P");
+    toRNAssState.put("p", "P");
+    toRNAssState.put("Q", "Q");
+    toRNAssState.put("q", "Q");
+    toRNAssState.put("R", "R");
+    toRNAssState.put("r", "R");
+    toRNAssState.put("S", "S");
+    toRNAssState.put("s", "S");
+    toRNAssState.put("T", "T");
+    toRNAssState.put("t", "T");
+    toRNAssState.put("U", "U");
+    toRNAssState.put("u", "U");
+    toRNAssState.put("V", "V");
+    toRNAssState.put("v", "V");
+    toRNAssState.put("W", "W");
+    toRNAssState.put("w", "W");
+    toRNAssState.put("X", "X");
+    toRNAssState.put("x", "X");
+    toRNAssState.put("Y", "Y");
+    toRNAssState.put("y", "Y");
+    toRNAssState.put("Z", "Z");
+    toRNAssState.put("z", "Z");
+    
   }
 
   /**
index a7f919b..abbfb23 100644 (file)
@@ -3,6 +3,7 @@ package jalview.workers;
 import java.util.Hashtable;
 
 import jalview.analysis.StructureFrequency;
+import jalview.analysis.StructureFrequency;
 import jalview.api.AlignCalcWorkerI;
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
@@ -90,8 +91,8 @@ public class StrucConsensusThread extends AlignCalcWorker implements
 
       try {
               jalview.analysis.StructureFrequency.calculate(
-              alignment.getSequencesArray(), 0, alignment.getWidth(),
-              hStrucConsensus, true, rnaStruc);
+                         alignment.getSequencesArray(), 0, alignment.getWidth(),
+                      hStrucConsensus, true, rnaStruc);
       } catch (ArrayIndexOutOfBoundsException x)
       {
         calcMan.workerComplete(this);
index b2c9d4d..b86c856 100644 (file)
@@ -158,7 +158,12 @@ public class AAConsClient extends JabawsAlignCalcWorker
     }
   }
 
-  public static void removeAAConsAnnotation(AlignmentPanel alignPanel)
+  private String getCalcId() {
+       // TODO Auto-generated method stub
+       return null;
+}
+
+public static void removeAAConsAnnotation(AlignmentPanel alignPanel)
   {
     // List<AlignmentAnnotation>
     // ourannots=alignPanel.getAlignment().findAnnotation(Screen3D.)
index 77ea1fb..a78da28 100644 (file)
@@ -20,6 +20,7 @@ import org.xml.sax.SAXException;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 
 public class TCoffeeScoreFileTest {
 
@@ -27,7 +28,7 @@ public class TCoffeeScoreFileTest {
         final static File ALIGN_FILE = new File("test/jalview/io/tcoffee.fasta_aln");
        
        @Test
-       public void testReadHeader() throws IOException, FileNotFoundException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException {
+       public void testReadHeader() throws IOException, FileNotFoundException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
 
                TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),AppletFormatAdapter.FILE);
                assertTrue(scoreFile.getWarningMessage(),scoreFile.isValid());
@@ -48,7 +49,7 @@ public class TCoffeeScoreFileTest {
        
        
        @Test
-       public void testWrongFile() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException {
+       public void testWrongFile() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
            try {
                TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE);
                assertFalse(result.isValid());
@@ -59,7 +60,7 @@ public class TCoffeeScoreFileTest {
        } 
 
        @Test
-       public void testHeightAndWidth() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException {
+       public void testHeightAndWidth() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
                TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
                assertTrue(result.isValid());
                assertEquals( 8, result.getHeight() );
@@ -99,7 +100,7 @@ public class TCoffeeScoreFileTest {
        }
 
        @Test
-       public void testParse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException {
+       public void testParse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
 
                TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
 
@@ -116,7 +117,7 @@ public class TCoffeeScoreFileTest {
 
        
        @Test
-       public void testGetAsList() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException {
+       public void testGetAsList() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
                
           TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
           assertTrue(parser.getWarningMessage(),parser.isValid());
@@ -135,7 +136,7 @@ public class TCoffeeScoreFileTest {
        
        
        @Test
-       public void testGetAsArray() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException {
+       public void testGetAsArray() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
                
           TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
           assertTrue(parser.getWarningMessage(),parser.isValid());