Merge branch 'develop' into menard
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 17 Aug 2012 12:13:56 +0000 (13:13 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 17 Aug 2012 12:13:56 +0000 (13:13 +0100)
Conflicts:
src/jalview/ws/jws2/AAConsClient.java
 (preferred develop)

47 files changed:
.classpath
.externalToolBuilders/Jalview Release 2.7 build.xml [Builder].launch [new file with mode: 0644]
.project
lib/VARNAv3-9-dev.jar
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/datamodel/Annotation.java
src/jalview/datamodel/SecondaryStructureAnnotation.java [new file with mode: 0644]
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceI.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/JalviewFileChooser.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 [new file with mode: 0644]
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/ColourSchemeProperty.java
src/jalview/schemes/RNAInteractionColourScheme.java [new file with mode: 0644]
src/jalview/schemes/ResidueColourScheme.java
src/jalview/schemes/ResidueProperties.java
src/jalview/workers/StrucConsensusThread.java
src/jalview/ws/jws1/Annotate3D.java [new file with mode: 0644]
test/jalview/io/TCoffeeScoreFileTest.java

index 6cffc21..f76d550 100644 (file)
@@ -46,7 +46,8 @@
        <classpathentry kind="lib" path="lib/spring-core-3.0.5.RELEASE.jar"/>
        <classpathentry kind="lib" path="lib/spring-web-3.0.5.RELEASE.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
-       <classpathentry kind="lib" path="/Users/jimp/git/jalview_clean/lib/VARNAv3-9-dev.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+       <classpathentry kind="lib" path="lib/VARNAv3-9-dev.jar" sourcepath="/VARNA3-1"/>
+       <classpathentry kind="lib" path="/usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar"/>
        <classpathentry kind="output" path="classes"/>
 </classpath>
diff --git a/.externalToolBuilders/Jalview Release 2.7 build.xml [Builder].launch b/.externalToolBuilders/Jalview Release 2.7 build.xml [Builder].launch
new file mode 100644 (file)
index 0000000..b280175
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="editedByExternalToolsMainTab" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="true"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/Jalview Release 2.7/build.xml"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-openjdk-i386&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/Jalview Release 2.7/lib&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/Jalview Release 2.7/utils&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.antHome&quot;&gt;&#10;&lt;memento default=&quot;true&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.extraClasspathEntries&quot;&gt;&#10;&lt;memento/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-openjdk-i386"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.launching.remote.InternalAntRunner"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Jalview Release 2.7"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_ANT_TARGETS" value="buildindices,"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Jalview Release 2.7/build.xml}"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
+</launchConfiguration>
index 5f4b511..d0dfc7e 100644 (file)
--- a/.project
+++ b/.project
@@ -6,23 +6,13 @@
        </projects>
        <buildSpec>
                <buildCommand>
-                       <name>org.eclipse.wst.common.project.facet.core.builder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
                        <name>org.eclipse.jdt.core.javabuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
-                       <triggers>full,incremental,</triggers>
+                       <name>org.eclipse.wst.common.project.facet.core.builder</name>
                        <arguments>
-                               <dictionary>
-                                       <key>LaunchConfigHandle</key>
-                                       <value>&lt;project&gt;/.externalToolBuilders/Jalview Release indices [Builder].launch</value>
-                               </dictionary>
                        </arguments>
                </buildCommand>
                <buildCommand>
@@ -31,7 +21,7 @@
                        <arguments>
                                <dictionary>
                                        <key>LaunchConfigHandle</key>
-                                       <value>&lt;project&gt;/.externalToolBuilders/buildapplet [Builder].launch</value>
+                                       <value>&lt;project&gt;/.externalToolBuilders/Jalview Release indices [Builder].launch</value>
                                </dictionary>
                        </arguments>
                </buildCommand>
index 6ae57bf..865de94 100644 (file)
Binary files a/lib/VARNAv3-9-dev.jar and b/lib/VARNAv3-9-dev.jar differ
index c3ab9d7..714cbd1 100755 (executable)
@@ -21,6 +21,14 @@ import java.io.*;
 
 import java.awt.event.*;
 import javax.swing.*;
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
@@ -51,7 +59,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
   String tmpPDBFile;
 
   public PDBViewer(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
-          AlignmentPanel ap, String protocol)
+          AlignmentPanel ap, String protocol) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
 
   {
     this.pdbentry = pdbentry;
index 18b83ae..fe2851a 100755 (executable)
@@ -22,8 +22,19 @@ import java.util.*;
 
 import java.awt.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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;
+import jalview.io.RnamlFile;
+import jalview.ws.jws1.Annotate3D;
 
 public class PDBfile extends jalview.io.AlignFile
 {
@@ -36,12 +47,12 @@ public class PDBfile extends jalview.io.AlignFile
    */
   boolean VisibleChainAnnotation = false;
 
-  public PDBfile(String inFile, String inType) throws IOException
+  public PDBfile(String inFile, String inType) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, inType);
   }
 
-  public PDBfile(FileParse source) throws IOException
+  public PDBfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
@@ -51,11 +62,11 @@ public class PDBfile extends jalview.io.AlignFile
     return null;
   }
 
-  public void parse() throws IOException
+  public void parse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException
   {
     // TODO set the filename sensibly - try using data source name.
     id = safeName(getDataName());
-
+  
       chains = new Vector();
 
       PDBChain tmpchain;
@@ -170,11 +181,37 @@ public class PDBfile extends jalview.io.AlignFile
         // maintain reference to
         // dataset
         seqs.addElement(chainseq);
+       if(isRNA(chainseq)==true)
+       {
+          String path =inFile.getPath();
+          System.out.println("this is a PDB format and RNA sequence");
+          Annotate3D an3d = new Annotate3D(path);
+          System.out.println(id);
+          //BufferedWriter r = an3d.getReader();
+          
+         // BufferedReader in = new BufferedReader(new FileReader("temp.rnaml"));
+          
+          //String str;
+         // while ((str = in.readLine()) != null) {
+                   // System.out.println(str);
+                   // System.out.println("toto");
+
+                   // }
+          //String type = "File";
+          //RnamlFile rnaml =new RnamlFile("temp.rnaml",type);
+          System.out.println("Create rnamfile object");
+          //rnaml.parse("temp");
+          //this.annotations =rnaml.getAnnot();
+          
+       }
+        
         AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
+        
         if (chainannot != null)
         {
           for (int ai = 0; ai < chainannot.length; ai++)
           {
+        
             chainannot[ai].visible = VisibleChainAnnotation;
             annotations.addElement(chainannot[ai]);
           }
@@ -263,4 +300,17 @@ public class PDBfile extends jalview.io.AlignFile
               1.0f / (float) i, .4f, 1.0f));
     }
   }
+  public boolean isRNA(SequenceI seqs)
+  {
+         for (int i=0;i<seqs.getLength();i++){
+                 if((seqs.getCharAt(i)!='A') &&(seqs.getCharAt(i)!='C')&&(seqs.getCharAt(i)!='G')&&(seqs.getCharAt(i)!='U'))
+                 {
+                         return false;
+                 }
+         }
+        
+                 return true;
+         
+         
+  }
 }
index ba18732..800e70a 100644 (file)
@@ -54,12 +54,12 @@ public class Rna
     {
       char base = line.charAt(i);
 
-      if ((base == '<') || (base == '(') || (base == '{') || (base == '['))
+      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 == ']'))
+      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'))
+      
       {
 
         if (stack.isEmpty())
@@ -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 4948613..01227a6 100644 (file)
@@ -52,6 +52,7 @@ import jalview.schemes.NucleotideColourScheme;
 import jalview.schemes.PIDColourScheme;\r
 import jalview.schemes.PurinePyrimidineColourScheme;\r
 import jalview.schemes.RNAHelicesColourChooser;\r
+import jalview.schemes.RNAInteractionColourScheme;\r
 import jalview.schemes.ResidueProperties;\r
 import jalview.schemes.StrandColourScheme;\r
 import jalview.schemes.TCoffeeColourScheme;\r
@@ -92,6 +93,15 @@ import java.util.List;
 import java.util.StringTokenizer;\r
 import java.util.Vector;\r
 \r
+import javax.xml.parsers.ParserConfigurationException;\r
+\r
+import org.xml.sax.SAXException;\r
+\r
+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
   public AlignmentPanel alignPanel;\r
@@ -203,6 +213,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
       RNAHelixColour.setEnabled(false);\r
       purinePyrimidineColour.setEnabled(false);\r
     }\r
+    \r
     // Some JVMS send keyevents to Top frame or lowest panel,\r
     // Havent worked out why yet. So add to both this frame and seqCanvas for\r
     // now\r
@@ -1001,6 +1012,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     {\r
       changeColour(new PurinePyrimidineColourScheme());\r
     }\r
+    else if (source == RNAInteractionColour)\r
+    {\r
+      changeColour(new RNAInteractionColourScheme());\r
+    }\r
     else if (source == RNAHelixColour)\r
     {\r
       new RNAHelicesColourChooser(viewport, alignPanel);\r
@@ -2775,6 +2790,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
   MenuItem buriedColour = new MenuItem();\r
 \r
   MenuItem purinePyrimidineColour = new MenuItem();\r
+  MenuItem RNAInteractionColour = new MenuItem();\r
   MenuItem RNAHelixColour = new MenuItem();\r
 \r
   MenuItem userDefinedColour = new MenuItem();\r
@@ -2970,6 +2986,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     buriedColour.addActionListener(this);\r
     purinePyrimidineColour.setLabel("Purine/Pyrimidine");\r
     purinePyrimidineColour.addActionListener(this);\r
+    RNAInteractionColour.setLabel("Purine/Pyrimidine");\r
+    RNAInteractionColour.addActionListener(this);\r
     RNAHelixColour.setLabel("by RNA Helices");\r
     RNAHelixColour.addActionListener(this);\r
     userDefinedColour.setLabel("User Defined...");\r
@@ -3188,6 +3206,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     colourMenu.add(buriedColour);\r
     colourMenu.add(nucleotideColour);\r
     colourMenu.add(purinePyrimidineColour);\r
+    colourMenu.add(RNAInteractionColour);\r
     colourMenu.add(tcoffeeColour);\r
     colourMenu.add(userDefinedColour);\r
     colourMenu.addSeparator();\r
@@ -3625,8 +3644,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
    * @param source File/URL/T-COFFEE score file contents\r
    * @throws IOException\r
    * @return true if alignment was annotated with data from source\r
+ * @throws SAXException \r
+ * @throws ParserConfigurationException \r
+ * @throws ExceptionFileFormatOrSyntax \r
+ * @throws ExceptionLoadingFailed \r
+ * @throws ExceptionPermissionDenied \r
+ * @throws InterruptedException \r
+ * @throws ExceptionUnmatchedClosingParentheses \r
    */\r
-  public boolean loadScoreFile( String source ) throws IOException {\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 f5d34a6..1962423 100755 (executable)
@@ -20,9 +20,12 @@ package jalview.datamodel;
 import jalview.analysis.Rna;
 import jalview.analysis.WUSSParseException;
 
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Hashtable;
 
+import fr.orsay.lri.varna.models.rna.RNA;
+
 /**
  * DOCUMENT ME!
  * 
@@ -49,6 +52,8 @@ public class AlignmentAnnotation
 
   /** DOCUMENT ME!! */
   public Annotation[] annotations;
+  
+  
 
   /**
    * RNA secondary structure contact positions
@@ -237,7 +242,37 @@ public class AlignmentAnnotation
       else
       // Check for RNA secondary structure
       {
-        if (annotations[i].secondaryStructure == 'S')
+         //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;
@@ -270,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)
         {
@@ -487,7 +551,7 @@ public class AlignmentAnnotation
       {
         if (annotations[i] != null)
         {
-          annotations[i].displayCharacter = "";
+          annotations[i].displayCharacter = "X";
         }
       }
     }
@@ -945,7 +1009,7 @@ public class AlignmentAnnotation
       {
         if (annotations[i] == null)
           annotations[i] = new Annotation(String.valueOf(gapchar), null,
-                  ' ', 0f);
+                  ' ', 0f,null);
         else if (annotations[i].displayCharacter == null
                 || annotations[i].displayCharacter.equals(" "))
           annotations[i].displayCharacter = String.valueOf(gapchar);
@@ -998,4 +1062,6 @@ public class AlignmentAnnotation
     this.calcId = calcId;
   }
   
+  
 }
index 6b22cad..b371bc3 100755 (executable)
@@ -18,6 +18,9 @@
 package jalview.datamodel;
 
 import java.awt.*;
+import java.util.ArrayList;
+
+import fr.orsay.lri.varna.models.rna.RNA;
 
 /**
  * DOCUMENT ME!
@@ -38,6 +41,8 @@ public class Annotation
 
   /** DOCUMENT ME!! */
   public float value;
+  
+
 
   // add visual cues here
 
@@ -62,6 +67,7 @@ public class Annotation
     description = desc;
     secondaryStructure = ss;
     value = val;
+    
   }
 
   /**
@@ -105,6 +111,7 @@ public class Annotation
     secondaryStructure = that.secondaryStructure;
     value = that.value;
     colour = that.colour;
+
   }
 
   /**
@@ -115,6 +122,10 @@ public class Annotation
    */
   public Annotation(float val)
   {
-    this(null, null, ' ', val);
+    this(null, null, ' ', val,null);
   }
+  
+  
+  
+  
 }
diff --git a/src/jalview/datamodel/SecondaryStructureAnnotation.java b/src/jalview/datamodel/SecondaryStructureAnnotation.java
new file mode 100644 (file)
index 0000000..5c3eae9
--- /dev/null
@@ -0,0 +1,31 @@
+package jalview.datamodel;
+
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class SecondaryStructureAnnotation extends AlignmentAnnotation
+{
+       
+
+       private static RNA _rna = null;
+         public SecondaryStructureAnnotation (RNA rna) 
+         {
+                super("Secondary Structure", "Un truc trop cool",getAnnotation(rna));
+                
+           
+           _rna = rna;
+         }
+       
+         public RNA getRNA()
+        {
+                 return _rna;
+        }
+         public static Annotation[] getAnnotation(RNA rna) 
+         {
+                 Annotation[] ann =  new Annotation[rna.getSize()];
+                        for(int i=0;i<ann.length;i++)
+                        {      
+                                ann[i] = new Annotation(_rna.getStructDBN(true), "", ' ', 0f);; 
+                        }
+                 return ann;
+         }
+}
index 293528d..a416728 100755 (executable)
@@ -22,6 +22,8 @@ import jalview.analysis.AlignSeq;
 import java.util.Enumeration;
 import java.util.Vector;
 
+import fr.orsay.lri.varna.models.rna.RNA;
+
 /**
  * 
  * Implements the SequenceI interface for a char[] based sequence object.
@@ -48,6 +50,8 @@ public class Sequence implements SequenceI
   String vamsasId;
 
   DBRefEntry[] dbrefs;
+  
+  RNA rna;
 
   /**
    * This annotation is displayed below the alignment but the positions are tied
@@ -60,7 +64,7 @@ public class Sequence implements SequenceI
    */
   int index = -1;
 
-  /** array of seuqence features - may not be null for a valid sequence object */
+  /** array of sequence features - may not be null for a valid sequence object */
   public SequenceFeature[] sequenceFeatures;
 
   /**
@@ -1193,4 +1197,9 @@ public class Sequence implements SequenceI
    * @param The position for this sequence. This value is zero-based (zero for this first sequence)
    */
   public void setIndex(int value) { index = value; }
+  
+  public void setRNA(RNA r){rna=r;}
+  
+  public RNA getRNA() { return rna; }
+  
 }
index 33045d0..bf3c031 100755 (executable)
  */
 package jalview.datamodel;
 
+
 import java.util.Vector;
 
+import fr.orsay.lri.varna.models.rna.RNA;
+
 /**
  * DOCUMENT ME!
  * 
@@ -358,5 +361,17 @@ public interface SequenceI
    * @return The index of the sequence in the alignment
    */
   public int getIndex();
+  
+  /**
+   * @return The RNA of the sequence in the alignment
+   */
+  
+  public RNA getRNA();
+  /**
+   * @param rna The RNA.
+   */
+  public void setRNA(RNA rna);
+  
 
 }
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 da6c6e5..00670aa 100644 (file)
@@ -76,12 +76,23 @@ public class AppVarna extends JInternalFrame implements
   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>();
     RNA rna1 = new RNA(name);
     try
     {
+    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();
@@ -89,17 +100,20 @@ public class AppVarna extends JInternalFrame implements
     {
       e3.printStackTrace();
     }
+    
     RNA trim = trimRNA(rna1, "trimmed "+sname);
     rnaList.add(trim);
     rnaList.add(rna1);
+    
     rnas.put(seq, rna1);
     rnas.put(seq, trim);
+   
     rna1.setName(sname+" (with gaps)");
 
     {
       seqs.put(trim, seq);
       seqs.put(rna1, seq);
-
+      
       /**
        * if (false || seq.getStart()!=1) { for (RNA rshift:rnaList) { ShiftList
        * shift=offsets.get(rshift); if (shift==null) { offsets.put(rshift,
@@ -112,13 +126,16 @@ public class AppVarna extends JInternalFrame implements
     // System.out.println("Hallo: "+name);
     this.name = sname+" trimmed to "+name;
     initVarna();
+   
     ssm = ap.getStructureSelectionManager();
+    System.out.println(ssm.toString());
     ssm.addStructureViewerListener(this);
     ssm.addSelectionListener(this);
   }
 
   public void initVarna()
   {
+         System.out.println("initialisation VANRA");
     // vab.setFinishedInit(false);
     varnaPanel = vab.get_varnaPanel();
     setBackground(Color.white);
@@ -133,6 +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)
@@ -148,6 +166,7 @@ public class AppVarna extends JInternalFrame implements
   public RNA trimRNA(RNA rna, String name)
   {
     ShiftList offset = new ShiftList();
+    
     RNA rnaTrim = new RNA(name);
     try
     {
index fc1f446..0bc84ce 100644 (file)
@@ -148,16 +148,19 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
   {
     // super("VARNA in Jalview");
     initVarna(seq, struc);
+   
   }
 
   public AppVarnaBinding(ArrayList<RNA> rnaList)
   {
+
     // super("VARNA in Jalview");
     initVarnaEdit(rnaList);
   }
 
   private void initVarna(String seq, String str)
   {
+         
     DefaultListModel dlm = new DefaultListModel();
 
     DefaultListSelectionModel m = new DefaultListSelectionModel();
@@ -190,6 +193,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
 
     try
     {
+    
       vp = new VARNAPanel("0", ".");
       _RNA1.setRNA(seq, str);
       _RNA1.drawRNARadiate(vp.getConfig());
@@ -218,6 +222,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
 
   private void initVarnaEdit(ArrayList<RNA> rnaInList)
   {
+       
     DefaultListModel dlm = new DefaultListModel();
 
     int marginTools = 40;
@@ -241,7 +246,8 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
           FullBackup sel = (FullBackup) _sideList.getSelectedValue();
           Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
                   .getSize(), sel.rna.getSize());
-          vp.showRNAInterpolated(sel.rna, sel.config, map);
+          //vp.showRNAInterpolated(sel.rna, sel.config, map);
+          vp.showRNA(sel.rna, sel.config);
           // _seq.setText(sel.rna.getSeq());
           _str.setText(sel.rna.getStructDBN());
         }
@@ -251,10 +257,12 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
 
     try
     {
+       
       vp = new VARNAPanel("0", ".");
       for (int i = 0; i < rnaInList.size(); i++)
       {
         rnaInList.get(i).drawRNARadiate(vp.getConfig());
+       
       }
     } catch (ExceptionNonEqualLength e)
     {
index 6f36a79..3bd21b5 100644 (file)
 package jalview.gui;
 
 import javax.swing.JOptionPane;
+import javax.xml.parsers.ParserConfigurationException;
+
+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;
 import jalview.datamodel.SequenceI;
+import jalview.io.FileParse;
+import jalview.io.IdentifyFile;
 
 /**
  * GUI related routines for associating PDB files with sequences
@@ -35,12 +45,23 @@ public class AssociatePdbFileWithSeq
  * assocate the given PDB file with 
  * @param choice
  * @param sequence
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
  */
-  public PDBEntry associatePdbWithSeq(String choice, String protocol, SequenceI sequence, boolean prompt)
+  public PDBEntry associatePdbWithSeq(String choice, String protocol, SequenceI sequence, boolean prompt) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     PDBEntry entry = new PDBEntry();
     try
     {
+               System.out.println("This is a annotation PDB");
+       
+       
       MCview.PDBfile pdbfile = new MCview.PDBfile(choice,
               protocol);
 
@@ -65,6 +86,7 @@ public class AssociatePdbFileWithSeq
       {
         entry.setId(pdbfile.id);
       }
+       
     } catch (java.io.IOException ex)
     {
       ex.printStackTrace();
@@ -73,6 +95,7 @@ public class AssociatePdbFileWithSeq
     entry.setFile(choice);
     sequence.getDatasetSequence().addPDBId(entry);
     return entry;
+    
   }
 
 }
index c1bbc8d..0e83c6e 100644 (file)
@@ -23,6 +23,14 @@ import java.awt.*;
 import java.awt.event.*;
 
 import javax.swing.*;
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
@@ -71,6 +79,7 @@ public class PopupMenu extends JPopupMenu
   protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
 
   protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+  protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
 
   // protected JRadioButtonMenuItem covariationColour = new
   // JRadioButtonMenuItem();
@@ -189,6 +198,7 @@ public class PopupMenu extends JPopupMenu
     colours.add(PIDColour);
     colours.add(BLOSUM62Colour);
     colours.add(purinePyrimidineColour);
+    colours.add(RNAInteractionColour);
     // colours.add(covariationColour);
 
     for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)
@@ -274,11 +284,23 @@ public class PopupMenu extends JPopupMenu
             menuItem = new JMenuItem();
             menuItem.setText("2D RNA "+structureLine);
             menuItem.addActionListener(new java.awt.event.ActionListener()
+            
             {
               public void actionPerformed(ActionEvent e)
               {
-                new AppVarna(structureLine, seq, seq.getSequenceAsString(), rnastruc, seq
-                        .getName(), ap);
+                       //System.out.println("1:"+structureLine);
+                       System.out.println("1:sname"+seq.getName());
+                       System.out.println("2:seq"+seq);
+                
+                       //System.out.println("3:"+seq.getSequenceAsString());
+                       System.out.println("3:strucseq"+rnastruc);
+                       //System.out.println("4:struc"+seq.getRNA());
+                       System.out.println("5:name"+seq.getName());
+                       System.out.println("6:ap"+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");
               }
             });
             viewStructureMenu.add(menuItem);
@@ -304,6 +326,8 @@ public class PopupMenu extends JPopupMenu
                 public void actionPerformed(ActionEvent e)
                 {
                   // 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,seq.getSequenceAsString(), rnastruc, seq
                           .getName(), ap);
                 }
@@ -439,6 +463,11 @@ public class PopupMenu extends JPopupMenu
       {
         purinePyrimidineColour.setSelected(true);
       }
+      
+      else if (sg.cs instanceof RNAInteractionColourScheme)
+      {
+        RNAInteractionColour.setSelected(true);
+      }
       /*
        * else if (sg.cs instanceof CovariationColourScheme) {
        * covariationColour.setSelected(true); }
@@ -1004,7 +1033,30 @@ public class PopupMenu extends JPopupMenu
     {
       public void actionPerformed(ActionEvent e)
       {
-        pdbFromFile_actionPerformed();
+        try {
+                       pdbFromFile_actionPerformed();
+               } catch (ExceptionFileFormatOrSyntax e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               } catch (ParserConfigurationException e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               } catch (SAXException e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               } catch (ExceptionPermissionDenied e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               } catch (ExceptionLoadingFailed e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               } catch (InterruptedException e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               } catch (ExceptionUnmatchedClosingParentheses e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               }
       }
     });
     enterPDB.setText("Enter PDB Id");
@@ -1081,6 +1133,7 @@ public class PopupMenu extends JPopupMenu
     colourMenu.add(turnColour);
     colourMenu.add(buriedColour);
     colourMenu.add(nucleotideMenuItem);
+    colourMenu.add(RNAInteractionColour);
     if (ap.getAlignment().isNucleotide()) {
        colourMenu.add(purinePyrimidineColour);
     }
@@ -1245,6 +1298,16 @@ public class PopupMenu extends JPopupMenu
                 purinePyrimidineColour_actionPerformed();
               }
             });
+    
+    RNAInteractionColour.setText("RNA Interaction type");
+    RNAInteractionColour
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                RNAInteractionColour_actionPerformed();
+              }
+            });
     /*
      * covariationColour.addActionListener(new java.awt.event.ActionListener() {
      * public void actionPerformed(ActionEvent e) {
@@ -1395,6 +1458,11 @@ public class PopupMenu extends JPopupMenu
     refresh();
   }
 
+  protected void RNAInteractionColour_actionPerformed()
+  {
+    getGroup().cs = new RNAInteractionColourScheme();
+    refresh();
+  }
   /*
    * protected void covariationColour_actionPerformed() { getGroup().cs = new
    * CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); }
@@ -1847,7 +1915,7 @@ public class PopupMenu extends JPopupMenu
     oal = null;
   }
 
-  public void pdbFromFile_actionPerformed()
+  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 3ef7210..837fee0 100755 (executable)
@@ -27,6 +27,15 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Vector;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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!
  * 
@@ -65,6 +74,8 @@ public abstract class AlignFile extends FileParse
    */
   public AlignFile()
   {
+         // Shouldn't we init data structures
+         initData();
   }
 
   /**
@@ -74,8 +85,15 @@ public abstract class AlignFile extends FileParse
    *          Filename to read from.
    * @param type
    *          What type of file to read from (File, URL)
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public AlignFile(String inFile, String type) throws IOException
+  public AlignFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
     initData();
@@ -92,8 +110,15 @@ public abstract class AlignFile extends FileParse
    * 
    * @param source
    * @throws IOException
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public AlignFile(FileParse source) throws IOException
+  public AlignFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
     initData();
@@ -237,8 +262,15 @@ public abstract class AlignFile extends FileParse
 
   /**
    * This method must be implemented to parse the contents of the file.
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public abstract void parse() throws IOException;
+  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 0709a2f..d4831d7 100755 (executable)
@@ -38,7 +38,7 @@ public class AppletFormatAdapter
    */
   public static final String[] READABLE_FORMATS = new String[]
   { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH",
-      "PDB", "JnetFile" }; // , "SimpleBLAST" };
+      "PDB", "JnetFile" , "RNAML"}; // , "SimpleBLAST" };
 
   /**
    * List of valid format strings for use by callers of the formatSequences
@@ -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,8 +66,8 @@ 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",
-      "sto,stk" }; // ,
+  { "fa,faa,fasta,fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
+      "sto,stk","xml" }; // ,
 
   // ".blast"
   // };
@@ -78,7 +78,7 @@ public class AppletFormatAdapter
    */
   public static final String[] READABLE_FNAMES = new String[]
   { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview",
-      "Stockholm" };// ,
+      "Stockholm","RNAML" };// ,
 
   // "SimpleBLAST"
   // };
@@ -223,7 +223,7 @@ public class AppletFormatAdapter
       }
       else if (format.equals("PDB"))
       {
-        afile = new MCview.PDBfile(inFile, type);
+        afile = new MCview.PDBfile(inFile, type);        
       }
       else if (format.equals("STH"))
       {
@@ -233,7 +233,11 @@ public class AppletFormatAdapter
       {
         afile = new SimpleBlastFile(inFile, type);
       }
-
+      else if (format.equals("RNAML"))
+      {
+        afile = new RnamlFile(inFile, type);
+      }
+      
       Alignment al = new Alignment(afile.getSeqsAsArray());
 
       afile.addAnnotations(al);
@@ -340,6 +344,10 @@ public class AppletFormatAdapter
       {
         afile = new StockholmFile(source);
       }
+      else if (format.equals("RNAML"))
+      {
+        afile = new RnamlFile(source);
+      }
       else if (format.equals("SimpleBLAST"))
       {
         afile = new SimpleBlastFile(source);
@@ -447,6 +455,11 @@ public class AppletFormatAdapter
       {
         afile = new AMSAFile(alignment);
       }
+      else if (format.equalsIgnoreCase("RNAML"))
+      {
+        afile = new RnamlFile();
+      }
+      
       else
       {
         throw new Exception(
index 03b2edf..6611f1e 100755 (executable)
@@ -20,6 +20,15 @@ package jalview.io;
 import java.io.*;
 import java.util.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
 /**
@@ -49,13 +58,20 @@ public class BLCFile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public BLCFile(String inFile, String type) throws IOException
+  public BLCFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public BLCFile(FileParse source) throws IOException
+  public BLCFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 8c0cac1..8a1cf05 100755 (executable)
@@ -20,6 +20,15 @@ package jalview.io;
 import java.io.*;
 import java.util.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
@@ -30,12 +39,12 @@ public class ClustalFile extends AlignFile
   {
   }
 
-  public ClustalFile(String inFile, String type) throws IOException
+  public ClustalFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public ClustalFile(FileParse source) throws IOException
+  public ClustalFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 3b74855..deca926 100755 (executable)
@@ -19,6 +19,15 @@ package jalview.io;
 
 import java.io.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
 /**
@@ -53,13 +62,20 @@ public class FastaFile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public FastaFile(String inFile, String type) throws IOException
+  public FastaFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public FastaFile(FileParse source) throws IOException
+  public FastaFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 23723c7..ad2cfd7 100755 (executable)
@@ -20,6 +20,15 @@ package jalview.io;
 import java.io.*;\r
 import java.util.*;\r
 \r
+import javax.xml.parsers.ParserConfigurationException;\r
+\r
+import org.xml.sax.SAXException;\r
+\r
+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
 import jalview.schemes.*;\r
@@ -59,13 +68,20 @@ public class FeaturesFile extends AlignFile
    * \r
    * @throws IOException\r
    *           DOCUMENT ME!\r
+ * @throws SAXException \r
+ * @throws ParserConfigurationException \r
+ * @throws ExceptionFileFormatOrSyntax \r
+ * @throws ExceptionLoadingFailed \r
+ * @throws ExceptionPermissionDenied \r
+ * @throws InterruptedException \r
+ * @throws ExceptionUnmatchedClosingParentheses \r
    */\r
-  public FeaturesFile(String inFile, String type) throws IOException\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\r
+  public FeaturesFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses\r
   {\r
     super(source);\r
   }\r
index 7c5223c..e90e0ef 100755 (executable)
@@ -132,6 +132,13 @@ public class IdentifyFile
 
           break;
         }
+        
+        if ((data.indexOf("<") > -1))
+        {
+          reply = "RNAML";
+          
+          break;
+        }
 
         if ((data.length() < 1) || (data.indexOf("#") == 0))
         {
@@ -160,6 +167,8 @@ public class IdentifyFile
 
           break;
         }
+        
+        
         else if (data.indexOf(">") > -1)
         {
           // FASTA, PIR file or BLC file
@@ -286,6 +295,7 @@ public class IdentifyFile
 
   public static void main(String[] args)
   {
+        
     for (int i = 0; args != null && i < args.length; i++)
     {
       IdentifyFile ider = new IdentifyFile();
index 396847d..444d0e0 100755 (executable)
@@ -25,6 +25,15 @@ package jalview.io;
 import java.io.*;
 import java.util.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
 /**
@@ -66,13 +75,20 @@ public class JPredFile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public JPredFile(String inFile, String type) throws IOException
+  public JPredFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public JPredFile(FileParse source) throws IOException
+  public JPredFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
@@ -347,8 +363,15 @@ public class JPredFile extends AlignFile
    * 
    * @param args
    *          DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public static void main(String[] args)
+  public static void main(String[] args) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     try
     {
index b128997..855cd8d 100755 (executable)
@@ -171,7 +171,7 @@ public class JalviewFileChooser extends JFileChooser
     {
       format = "PFAM";
     }
-
+    
     return format;
   }
 
index 6b584a8..161634c 100755 (executable)
@@ -20,6 +20,15 @@ package jalview.io;
 import java.io.*;
 import java.util.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
@@ -49,13 +58,20 @@ public class MSFfile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public MSFfile(String inFile, String type) throws IOException
+  public MSFfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public MSFfile(FileParse source) throws IOException
+  public MSFfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 07dc6b5..5e8c79d 100755 (executable)
@@ -20,6 +20,15 @@ package jalview.io;
 import java.io.*;
 import java.util.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
 public class PIRFile extends AlignFile
@@ -32,12 +41,12 @@ public class PIRFile extends AlignFile
   {
   }
 
-  public PIRFile(String inFile, String type) throws IOException
+  public PIRFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public PIRFile(FileParse source) throws IOException
+  public PIRFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index f74a15a..20e8b98 100755 (executable)
@@ -20,6 +20,15 @@ package jalview.io;
 import java.io.*;
 import java.util.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
@@ -30,12 +39,12 @@ public class PfamFile extends AlignFile
   {
   }
 
-  public PfamFile(String inFile, String type) throws IOException
+  public PfamFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public PfamFile(FileParse source) throws IOException
+  public PfamFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 571c469..4fb4ee7 100755 (executable)
@@ -34,6 +34,15 @@ package jalview.io;
  */
 import java.io.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
@@ -57,13 +66,20 @@ public class PileUpfile extends MSFfile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
+ * @throws InterruptedException 
+ * @throws ExceptionUnmatchedClosingParentheses 
    */
-  public PileUpfile(String inFile, String type) throws IOException
+  public PileUpfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public PileUpfile(FileParse source) throws IOException
+  public PileUpfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
diff --git a/src/jalview/io/RnamlFile.java b/src/jalview/io/RnamlFile.java
new file mode 100644 (file)
index 0000000..b1589b6
--- /dev/null
@@ -0,0 +1,368 @@
+package jalview.io;
+
+
+
+
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SecondaryStructureAnnotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.ws.jws1.Annotate3D;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.FileReader;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+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;
+import fr.orsay.lri.varna.utils.RNAMLParser;
+
+
+
+
+public class RnamlFile extends AlignFile
+{
+        public String id;
+        protected ArrayList<RNA> result;
+        
+        public RnamlFile()
+         {
+                super();
+               
+         }
+        
+        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, ExceptionUnmatchedClosingParentheses
+         {
+           super(source);
+           
+         }
+         
+//       public RnamlFile(BufferedReader r) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
+//       {
+//                     super();            
+//                 parse(r);
+//                 // sets the index of each sequence in the alignment
+//                 for( int i=0,c=seqs.size(); i<c; i++ ) {  
+//                     seqs.get(i).setIndex(i);  
+//                 }
+//               
+//         
+//       }
+         
+       public BufferedReader CreateReader() throws FileNotFoundException
+       {
+                FileReader fr = null;
+                 fr = new FileReader(inFile); 
+                 
+                 BufferedReader r = new BufferedReader (fr);
+                 return r;
+       }
+       
+       
+       @SuppressWarnings("unchecked")
+       public void parse() throws FileNotFoundException, ExceptionPermissionDenied, ExceptionLoadingFailed, ExceptionFileFormatOrSyntax
+       {
+                FileReader fr = null;
+                 fr = new FileReader(inFile); 
+                 
+                 BufferedReader r = new BufferedReader (fr);
+       
+                 //ArrayList<String> seq =new ArrayList();
+                 //System.out.println(r);
+                  
+                 
+                result = RNAFactory.loadSecStrRNAML(r);
+                 
+                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());
+                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;
+                 
+                 id = safeName(getDataName());
+                 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[rna.length()] ;
+                 Annotation[] ann = new Annotation[rna.length()];
+               
+                 for(int j=0;j<rna.length();j++)
+                       {
+                         annot[j] =rna.substring(j,j+1);
+                 
+                       }
+                 
+                 for(int k=0;k<rna.length();k++)
+               {
+                         ann[k] = new Annotation(annot[k], "", jalview.schemes.ResidueProperties.getRNASecStrucState(annot[k]).charAt(0), 0f);
+                                                 
+               }
+                 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);
+                
+                
+               
+
+       }
+         
+       
+         public void parse(BufferedReader r) throws ExceptionPermissionDenied, ExceptionLoadingFailed, ExceptionFileFormatOrSyntax 
+         {
+                  System.out.println("parse with Buffer (RnamlFile");
+                 Hashtable seqhash = new Hashtable();
+                 Vector headers = new Vector();
+                 //ArrayList<String> seq =new ArrayList();
+                 //System.out.println(r);
+                 
+                 result = RNAFactory.loadSecStr(r,RNAFileType.FILE_TYPE_RNAML);
+                 
+                 System.out.println("this is the secondary scructure:" +result.toArray());
+                 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();
+                 System.out.println(type); //the type is "File"
+                 System.out.println(inFile );//inFile is the path
+                 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);
+                 
+                 String[] annot=new String[10000] ;
+                 Annotation[] ann = new Annotation[1000];
+                 for(int j=0;j<rna1.length();j++)
+                       {
+                 annot[j] =rna1.substring(j,j+1);
+                 //System.out.println(annot[j]);
+                       }
+                 
+                 for(int k=0;k<rna1.length();k++)
+               {
+                         ann[k] = new Annotation(annot[k], "", ' ', 0f);
+                         
+                         ann[k].secondaryStructure = jalview.schemes.ResidueProperties.getRNASecStrucState(annot[k]).charAt(0);
+                         
+               }
+                 AlignmentAnnotation align = new AlignmentAnnotation("Secondary structure","",ann);
+                 seqs[0].addAlignmentAnnotation(align);
+                 this.annotations.addElement(align);
+               }
+               //Annotate3D tintin = new Annotate3D();
+                 
+               //System.out.println(tintin);  
+                 
+                 
+                 
+                 
+                 
+                 
+                
+       
+//                                     for(RNAMLParser.RNATmp rnaTmp : RNAMLData.getMolecules())
+//                                     {
+//                                             // Retrieving parsed data
+//                                             seq = rnaTmp.getSequence(); //contient la séquence sous forme de liste
+//                                             System.out.println(seq);
+//                                             String seqAsStr = "";
+//                                             for(String s:seq)
+//                                             {
+//                                                     // Only consider last character, e.g. in case of modified nucleotide
+//                                                     seqAsStr += s.charAt(s.length()-1);
+//                                             }
+//                                             int begin=0;
+//                                             int end = seqAsStr.length()-1;
+//                                             SequenceI[] seqs = new SequenceI[1];
+//                                             id = safeName(getDataName());
+//                                             seqs[0] = new Sequence(id, seqAsStr, begin, end);
+//                                             SequenceFeature feat = new SequenceFeature(type, "",5, 13, 0f, null);
+//
+//                         seqs[0].addSequenceFeature(feat);
+//                                             this.setSeqs(seqs);
+                                               
+                                               //String pos = annot.substring(1, 2);
+                                               //System.out.println(annot);
+                                               //System.out.println(pos);
+                                               
+                                          // ann[1] = new Annotation(pos, "", ' ', 0f);
+                                          // ann[1].secondaryStructure = 'A';
+                                           //System.out.println(ann[1]);
+                                           
+                                          // toto.annotations=ann;
+                                           
+
+                                           
+////                                            Annotation[] els = new Annotation[seq.size()];
+//                                             
+//                                             //System.err.println(""+seq.size());
+//                                         Vector<RNAMLParser.BPTemp> allbpsTmp = rnaTmp.getStructure();
+//                                         String[] annot = new String[10000];
+//                                       
+//                                             //Annotation[] ann = new Annotation[allbpsTmp.size()];
+//                                             for (int i = 0; i < allbpsTmp.size(); i++) {
+//                                             RNAMLParser.BPTemp bp = allbpsTmp.get(i);
+//                                             //System.err.println("toto ="+bp);
+//                                             int bp5 = bp.pos5;
+//                                             annot[bp5]= "(";
+//                                             //annot[bp5]= '(';
+//                                             System.out.println(annot[bp5]);
+//                                             //System.out.println("bp5 ="+bp5);
+//                                             int bp3 = bp.pos3;
+//                                     
+//                                             annot[bp3]= ")";
+//                                             System.out.println(annot[bp3]);
+//                                             //System.out.println(annot.get(bp3));
+//                                             
+//                                             //String pos1 = annot.substring(bp5, bp5+1);
+//                                             //String pos2 = annot.substring(bp3, bp3+1);
+//                                             //ann[i] = new Annotation(pos1, "", ' ', 0f);
+//                                             //ann[i+1] = new Annotation(pos2, "", ' ', 0f);
+//                                             //System.out.println(pos1);
+//                                             
+//                                             //System.out.println("bp3 ="+bp3);
+//                                             //ModeleBP newStyle = bp.createBPStyle(mb, part);
+//                                             }       
+//                                             Annotation[] ann = new Annotation[annot.length+1];
+//                                             for(int i=0;i<annot.length;i++)
+//                                             {               
+//                                                     if(annot[i]==null)
+//                                                     {
+//                                                             annot[i]=".";
+//                                                     }
+//                                                     
+//                                                     ann[i] = new Annotation(annot[i], "", ' ', 0f);
+//                                             //System.out.print(annot[i]);
+//                                             }
+//                                             
+//                                             AlignmentAnnotation toto = new AlignmentAnnotation("Secondary structure","",ann);
+//                                             this.annotations.addElement(toto);
+                                       
+                                               // Creating empty structure of suitable size
+//                                             int[] str = new int[seq.size()];
+//                                             for (int i=0;i<str.length;i++)
+//                                             { str[i] = -1; }
+//                                             Vector<RNAMLParser.BPTemp> allbpsTmp = rnaTmp.getStructure();
+//                                             for (int i = 0; i < allbpsTmp.size(); i++) {
+//                                                     RNAMLParser.BPTemp bp = allbpsTmp.get(i);
+//                                                     //System.err.println("toto ="+bp);
+//                                                     int bp5 = bp.pos5;
+//                                                     //System.out.println("bp5 ="+bp5);
+//                                                     int bp3 = bp.pos3;
+                                                       //System.out.println("bp3 ="+bp3);
+                                                       //ModeleBP newStyle = bp.createBPStyle(mb, part);
+//                                             }
+                                               //Annotation ann;
+                                           //ann = new Annotation(bp5, "", ' ', 0f);
+                               
+                                       //}
+
+                       
+
+//                             return result;
+         
+}
+
+         
+         public static String print(SequenceI[] s)
+         {
+           return "not yet implemented";
+         }
+         
+         public String print()
+         {
+               System.out.print("affiche :");
+           return print(getSeqsAsArray());
+         }
+         
+         /**
+          * make a friendly ID string.
+          * 
+          * @param dataName
+          * @return truncated dataName to after last '/'
+          */
+         private String safeName(String dataName)
+         {
+           int b = 0;
+           while ((b = dataName.indexOf("/")) > -1 && b < dataName.length() )
+           {              
+               dataName = dataName.substring(b + 1).trim();
+               
+           }
+           int e = (dataName.length() - dataName.indexOf("."))+1;
+           dataName = dataName.substring(1,e).trim();
+           return dataName;
+         }
+         
+         public ArrayList getRNA()
+         {
+                 return result;
+         }
+         
+         public Vector getAnnot()
+         {
+                 return annotations;
+         }
+}
index ec1cbd0..5c2b2f3 100644 (file)
@@ -20,6 +20,15 @@ package jalview.io;
 import java.io.*;
 import java.util.*;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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.*;
 
@@ -46,12 +55,12 @@ public class SimpleBlastFile extends AlignFile
   {
   }
 
-  public SimpleBlastFile(String inFile, String type) throws IOException
+  public SimpleBlastFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
   }
 
-  public SimpleBlastFile(FileParse source) throws IOException
+  public SimpleBlastFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 6b60cd5..77e29bb 100644 (file)
@@ -23,7 +23,18 @@ package jalview.io;
 import java.io.*;\r
 import java.util.*;\r
 \r
+import javax.xml.parsers.ParserConfigurationException;\r
+\r
+import org.xml.sax.SAXException;\r
+\r
 import com.stevesoft.pat.*;\r
+\r
+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
@@ -44,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\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\r
+  public StockholmFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses\r
   {\r
     super(source);\r
   }\r
@@ -70,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
@@ -530,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
@@ -558,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
@@ -571,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
@@ -593,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
@@ -683,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 9c75878..9f26670 100644 (file)
@@ -19,6 +19,15 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+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 
  * for each resude in any sequence.
@@ -74,13 +83,13 @@ import java.util.Map;
  */
 public class TCoffeeScoreFile extends AlignFile {
        
-  public TCoffeeScoreFile(String inFile, String type) throws IOException
+  public TCoffeeScoreFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(inFile, type);
     
   }
 
-  public TCoffeeScoreFile(FileParse source) throws IOException
+  public TCoffeeScoreFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses
   {
     super(source);
   }
index 6c1c8c6..b53bcc3 100755 (executable)
@@ -138,6 +138,8 @@ public class GAlignFrame extends JInternalFrame
   protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
 
   protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+  
+  protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
 
   // protected JRadioButtonMenuItem covariationColour = new
   // JRadioButtonMenuItem();
@@ -454,7 +456,7 @@ public class GAlignFrame extends JInternalFrame
     colours.add(purinePyrimidineColour);
     // colours.add(covariationColour);
     colours.add(tcoffeeColour);
-
+    colours.add(RNAInteractionColour);
     setColourSelected(jalview.bin.Cache
             .getDefault("DEFAULT_COLOUR", "None"));
 
@@ -532,6 +534,11 @@ public class GAlignFrame extends JInternalFrame
         purinePyrimidineColour.setSelected(true);
 
         break;
+        
+      case ColourSchemeProperty.RNAINTERACTION:
+          RNAInteractionColour.setSelected(true);
+
+          break;
       /*
        * case ColourSchemeProperty.COVARIATION:
        * covariationColour.setSelected(true);
@@ -806,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));
@@ -911,14 +919,22 @@ public class GAlignFrame extends JInternalFrame
     });
 
     purinePyrimidineColour.setText("Purine/Pyrimidine");
-    purinePyrimidineColour
-            .addActionListener(new java.awt.event.ActionListener()
+    purinePyrimidineColour.addActionListener(new java.awt.event.ActionListener()
             {
               public void actionPerformed(ActionEvent e)
               {
                 purinePyrimidineColour_actionPerformed(e);
               }
             });
+    
+    RNAInteractionColour.setText("RNA Interaction type");
+    RNAInteractionColour.addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                 RNAInteractionColour_actionPerformed(e);
+              }
+            });
     /*
      * covariationColour.setText("Covariation");
      * covariationColour.addActionListener(new java.awt.event.ActionListener() {
@@ -1871,6 +1887,7 @@ public class GAlignFrame extends JInternalFrame
     colourMenu.add(buriedColour);
     colourMenu.add(nucleotideColour);
     colourMenu.add(purinePyrimidineColour);
+    colourMenu.add(RNAInteractionColour);
     // colourMenu.add(covariationColour);
     colourMenu.add(tcoffeeColour);
     colourMenu.add(userDefinedColour);
@@ -1880,7 +1897,7 @@ public class GAlignFrame extends JInternalFrame
     colourMenu.add(abovePIDThreshold);
     colourMenu.add(modifyPID);
     colourMenu.add(annotationColour);
-    colourMenu.add(rnahelicesColour);
+    colourMenu.add(rnahelicesColour);  
     calculateMenu.add(sort);
     calculateMenu.add(calculateTree);
     calculateMenu.addSeparator();
@@ -2264,6 +2281,11 @@ public class GAlignFrame extends JInternalFrame
   protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
   {
   }
+  
+  protected void RNAInteractionColour_actionPerformed(ActionEvent e)
+  {
+  }
+  
 
   /*
    * protected void covariationColour_actionPerformed(ActionEvent e) { }
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 8588bf2..b699543 100644 (file)
@@ -1,3 +1,4 @@
+
 package jalview.renderer;
 
 import jalview.analysis.AAFrequency;
@@ -34,6 +35,7 @@ public class AnnotationRenderer
           int lastSSX, int x, int y, int iconOffset, int startRes,
           int column, boolean validRes, boolean validEnd)
   {
+       
     g.setColor(STEM_COLOUR);
     int sCol = (lastSSX / charWidth) + startRes;
     int x1 = lastSSX;
@@ -52,6 +54,7 @@ public class AnnotationRenderer
     // If a closing base pair half of the stem, display a backward arrow
     if (column > 0 && closeparen.search(dc))
     {
+       
       if (diffupstream)
       // if (validRes && column>1 && row_annotations[column-2]!=null &&
       // dc.equals(row_annotations[column-2].displayCharacter))
@@ -68,6 +71,7 @@ public class AnnotationRenderer
     }
     else
     {
+       
       // display a forward arrow
       if (diffdownstream)
       {
@@ -125,6 +129,65 @@ public class AnnotationRenderer
    */
   private int imgWidth;
 
+  
+  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(nonCanColor);
+    int sCol = (lastSSX / charWidth) + startRes;
+    int x1 = lastSSX;
+    int x2 = (x * charWidth);
+    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;
+
+    boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
+            || !dc.equals(row_annotations[sCol - 1].displayCharacter);
+    boolean diffdownstream = !validRes || !validEnd
+            || row_annotations[column] == null
+            || !dc.equals(row_annotations[column].displayCharacter);
+    // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
+    // If a closing base pair half of the stem, display a backward arrow
+    if (column > 0 && closeparen.search(dc))//  closeletter_b.search(dc)||closeletter_c.search(dc)||closeletter_d.search(dc)||closecrochet.search(dc)) )
+    {
+       
+      if (diffupstream)
+      // if (validRes && column>1 && row_annotations[column-2]!=null &&
+      // dc.equals(row_annotations[column-2].displayCharacter))
+      {
+        g.fillPolygon(new int[]
+        { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
+        { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+        x1 += 5;
+      }
+      if (diffdownstream)
+      {
+        x2 -= 1;
+      }
+    }
+    else
+    {
+       
+      // display a forward arrow
+      if (diffdownstream)
+      {
+        g.fillPolygon(new int[]
+        { x2 - 5, x2 - 5, x2 }, new int[]
+        { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+        x2 -= 5;
+      }
+      if (diffupstream)
+      {
+        x1 += 1;
+      }
+    }
+    // draw arrow body
+    g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
+  }
   // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
   // av)
   public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
@@ -431,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);
@@ -440,15 +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 == '[')
+          {
+            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 == '<')
+           {
+             // 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)
@@ -465,12 +798,74 @@ 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':
+              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:
                 g.setColor(Color.gray);
                 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
@@ -535,6 +930,67 @@ 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 '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:
           drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
                   column, validRes, validEnd);
@@ -615,6 +1071,8 @@ public class AnnotationRenderer
   private final Color HELIX_COLOUR = Color.red;
 
   private final Color STEM_COLOUR = Color.blue;
+  
+  private  Color sdNOTCANONICAL_COLOUR;
 
   public void drawGlyphLine(Graphics g, Annotation[] row,
           int lastSSX, int x, int y, int iconOffset, int startRes,
@@ -625,6 +1083,7 @@ public class AnnotationRenderer
   }
 
   public void drawSheetAnnot(Graphics g, Annotation[] row,
+
           int lastSSX, int x, int y, int iconOffset, int startRes,
           int column, boolean validRes, boolean validEnd)
   {
@@ -993,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 1e2db76..fc6d536 100755 (executable)
@@ -86,6 +86,7 @@ public class ColourSchemeProperty
 
   public static final int TCOFFEE = 15;
 
+  public static final int RNAINTERACTION = 16;
 
   /**
    * index of first colourscheme (includes 'None')
@@ -167,6 +168,11 @@ public class ColourSchemeProperty
     {
       ret = PURINEPYRIMIDINE;
     }
+    
+    else if (name.equalsIgnoreCase("RNA Interaction type"))
+    {
+      ret = RNAINTERACTION;
+    }
     // else if (name.equalsIgnoreCase("Covariation"))
     // {
     // ret = COVARIATION;
@@ -240,6 +246,12 @@ public class ColourSchemeProperty
     {
       index = TCOFFEE;
     }
+    else if (cs instanceof RNAInteractionColourScheme)
+    {
+      index = RNAINTERACTION;
+    }
+    
+    
     /*
      * else if (cs instanceof CovariationColourScheme) { index = COVARIATION; }
      */
@@ -334,6 +346,11 @@ public class ColourSchemeProperty
       ret = "T-Coffee Scores";
 
       break;
+      
+    case RNAINTERACTION:
+        ret = "RNA Interaction type";
+
+        break;
     /*
      * case COVARIATION: ret = "Covariation";
      *
@@ -480,6 +497,12 @@ public class ColourSchemeProperty
 
     case TCOFFEE:
       cs = new TCoffeeColourScheme(coll);
+      break;
+      
+    case RNAINTERACTION:
+        cs = new RNAInteractionColourScheme();
+        break;
+      
     // case COVARIATION:
     // cs = new CovariationColourScheme(annotation);
 
diff --git a/src/jalview/schemes/RNAInteractionColourScheme.java b/src/jalview/schemes/RNAInteractionColourScheme.java
new file mode 100644 (file)
index 0000000..08e699b
--- /dev/null
@@ -0,0 +1,65 @@
+package jalview.schemes;
+
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
+
+
+public class RNAInteractionColourScheme extends ResidueColourScheme{
+        public RNAInteractionColourScheme()
+         {
+           super();
+         }
+
+         /**
+          * DOCUMENT ME!
+          * 
+          * @param n
+          *          DOCUMENT ME!
+          * 
+          * @return DOCUMENT ME!
+          */
+         @Override
+         public Color findColour(char c)
+         {
+           // System.out.println("called"); log.debug
+           return colors[ResidueProperties.nucleotideIndex[c]];
+         }
+
+         /**
+          * DOCUMENT ME!
+          * 
+          * @param n
+          *          DOCUMENT ME!
+          * @param j
+          *          DOCUMENT ME!
+          * 
+          * @return DOCUMENT ME!
+          */
+         @Override
+         public Color findColour(char c, int j, SequenceI seq)
+         {
+           Color currentColour;
+           if ((threshold == 0) || aboveThreshold(c, j))
+           {
+             try
+             {
+               currentColour = colors[ResidueProperties.nucleotideIndex[c]];
+             } catch (Exception ex)
+             {
+               return Color.white;
+             }
+           }
+           else
+           {
+             return Color.white;
+           }
+
+           if (conservationColouring)
+           {
+             currentColour = applyConservation(currentColour, j);
+           }
+
+           return currentColour;
+         }
+       }
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 98b7101..300ed34 100755 (executable)
@@ -1340,8 +1340,67 @@ public class ResidueProperties
   static
   {
     toRNAssState = new Hashtable();
-    toRNAssState.put(")", "S");
-    toRNAssState.put("(", "S");
+    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", "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);
diff --git a/src/jalview/ws/jws1/Annotate3D.java b/src/jalview/ws/jws1/Annotate3D.java
new file mode 100644 (file)
index 0000000..505e15f
--- /dev/null
@@ -0,0 +1,206 @@
+package jalview.ws.jws1;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import java.net.URLEncoder;
+
+
+
+public class Annotate3D {
+       //protected BufferedReader in;
+       //protected BufferedWriter out;
+       
+       public Annotate3D()
+       {
+               System.out.println("Annotate3D");
+               //try {
+                    // Create a URL for the desired page
+                    //String id = "1HR2";
+                    //URL url = new URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?pdbid="+id);
+                    //in = new BufferedReader(new InputStreamReader(url.openStream()));
+                    //String str;
+                    //OutputStream out1 = null;
+                    //out = new BufferedWriter(new OutputStreamWriter(out1, "temp.rnaml"));
+                    //while ((str = in.readLine()) != null) {
+                    //System.out.println(str);
+                    //out.write(str);
+                    //}
+                    //in.close();
+                    //out.close();
+                    //} catch (MalformedURLException e) {
+                    //} catch (IOException e) {
+                    //}
+       }
+       
+       public Annotate3D(String path) throws InterruptedException{
+               System.out.println("Annotate3D");
+               try {
+//                 //URL url = new URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="+inFile);
+//                     System.out.println("Step1");
+//                 FileReader r = new FileReader(inFile);
+//                 BufferedReader in = new BufferedReader(r);
+//                 StringBuffer content = new StringBuffer();
+//                 System.out.println("Step2");
+//                     while(in.readLine()!=null){
+//                             content.append(in.readLine());
+//                             //System.out.println("Step3"+in.readLine());
+//                     }
+//                     
+//                     String data = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(content.toString(), "UTF-8");
+//                     for (int i=0;i<data.length();i++)
+//                     {
+//                             System.out.print(data.charAt(i));
+//                     }
+                       
+                       //String data = "width=50&height=100";
+              
+                   
+//                 // Send the request
+//                             FileReader r = new FileReader(path);
+//                             BufferedReader in = new BufferedReader(r);
+//                             StringBuffer content = new StringBuffer();
+//                             System.out.println("Step1");
+//                             while(in.readLine()!=null){
+//                                     content.append(in.readLine());
+//                                     
+//                             }
+//                             System.out.println("Step2");
+//                             String data = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(content.toString(), "UTF-8");
+//                             System.out.println("Step2");
+//                             URL url = new URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="+data);
+//                             DataInputStream is = new DataInputStream(url.openStream());
+//                             String str;
+//                             while ((str = is.readLine()) != null) {
+//                                  System.out.println(str);
+//                                  //out.write(str);
+//                                  }
+                       FileReader r = new FileReader(path);
+                       BufferedReader in = new BufferedReader(r);
+                       String content ="";
+                       String str;
+                       
+                       while((str=in.readLine())!=null){
+                               //System.out.println(str);
+                               
+                               content=content+str;
+                       }
+                       System.out.println("pdbfile="+content.toString());
+                       System.out.println("capacité="+content.length());
+                       String paramfile = URLEncoder.encode(content.toString(), "UTF-8");
+                       System.out.println("param="+paramfile);
+                           URL url = new URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="+content);
+                           BufferedReader is = new BufferedReader(new InputStreamReader(url.openStream()));
+                               String str4;
+                               while ((str4 = is.readLine()) != null) {
+                                    System.out.println(str4);
+                                    //out.write(str);
+                                    }
+                           in.close();
+                           is.close();
+                           
+//                         HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+//                         connection.setRequestMethod("POST" );
+//                         connection.setRequestProperty("data", path );
+//                         //connection.setRequestProperty("nomDuChamp2", "valeurDuChamp2" );
+//                         BufferedReader input = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+//                         //DataInputStream input = new DataInputStream(connection.getInputStream());
+//                         String c;
+//                         while((c=input.readLine())!=null){
+//                          System.out.print(c);
+//                         }
+//                         input.close();
+                               //BufferedReader in1 = new BufferedReader(is);
+                               
+//                          OutputStream out1 = null;
+//                          System.out.println("Step3");
+//                          BufferedWriter out = new BufferedWriter(new OutputStreamWriter(out1, "temp.rnaml"));
+//                          
+//                          in.close();
+//                          out.close();
+                               
+                               
+                               //return;
+                               
+                               //System.out.println(data.length());
+                               //System.out.println("step2");
+                   //URL url = new URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="+data);
+                   //System.out.println("step3");
+                   //URLConnection conn = url.openConnection();
+                   //conn.setDoOutput(true);
+                   //OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
+                   
+                   //write parameters
+                   //writer.write(data);
+                  // writer.flush();
+                   
+                   // Get the response
+//                 StringBuffer answer = new StringBuffer();
+//                 //BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+//                 //String line;
+//                 while ((line = reader.readLine()) != null) {
+//                     answer.append(line);
+//                     System.out.println(line);
+//                 }
+//                 writer.close();
+//                 reader.close();
+                   
+                   //Output the response
+                   
+                   
+               } catch (MalformedURLException ex) {
+                   ex.printStackTrace();
+               } catch (IOException ex) {
+                   ex.printStackTrace();
+               }
+       }
+                       
+                       //in = new BufferedReader(new InputStreamReader(url.openStream()));
+                       
+                    //String str;
+                    
+                    
+                    //out = new FileOutputStream("temp.rnaml");
+                    //out = new BufferedWriter(new FileWriter("temp.rnaml"));
+                    
+                    //while ((str = in.readLine()) != null) {
+                    //System.out.println(str);
+                    //out.write(str);
+                    //System.out.println(str);
+//                     in.close();
+                    
+                    
+                    //out.close();
+//                  } catch (MalformedURLException e) {
+//                  } catch (IOException e) {
+//                  }
+//             
+//     }
+       
+       //public BufferedWriter getReader()
+       //{
+                       //System.out.println("The buffer");
+                       
+                       //return out;
+                       
+               
+       //}
+
+}
index 85c0bff..a78da28 100644 (file)
@@ -12,7 +12,15 @@ import java.io.IOException;
 import java.io.StringReader;
 import java.util.List;
 
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.junit.Test;
+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 {
 
@@ -20,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 {
+       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());
@@ -41,7 +49,7 @@ public class TCoffeeScoreFileTest {
        
        
        @Test
-       public void testWrongFile() {
+       public void testWrongFile() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
            try {
                TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE);
                assertFalse(result.isValid());
@@ -52,7 +60,7 @@ public class TCoffeeScoreFileTest {
        } 
 
        @Test
-       public void testHeightAndWidth() throws IOException {
+       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() );
@@ -92,7 +100,7 @@ public class TCoffeeScoreFileTest {
        }
 
        @Test
-       public void testParse() throws IOException {
+       public void testParse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses {
 
                TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
 
@@ -109,7 +117,7 @@ public class TCoffeeScoreFileTest {
 
        
        @Test
-       public void testGetAsList() throws IOException {
+       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());
@@ -128,7 +136,7 @@ public class TCoffeeScoreFileTest {
        
        
        @Test
-       public void testGetAsArray() throws IOException {
+       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());