Add support RNAML format
authorAnne Menard <menard.annec@gmail.com>
Thu, 5 Jul 2012 09:49:15 +0000 (11:49 +0200)
committerAnne Menard <menard.annec@gmail.com>
Thu, 5 Jul 2012 09:49:15 +0000 (11:49 +0200)
37 files changed:
.classpath
.externalToolBuilders/Jalview Release 2.7 build.xml [Builder].launch [new file with mode: 0644]
.project
.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
.settings/org.eclipse.ltk.core.refactoring.prefs [new file with mode: 0644]
lib/VARNAv3-9-dev.jar
src/MCview/PDBViewer.java
src/MCview/PDBfile.java
src/jalview/analysis/Rna.java
src/jalview/appletgui/AlignFrame.java
src/jalview/datamodel/SecondaryStructureAnnotation.java [new file with mode: 0644]
src/jalview/datamodel/Sequence.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/renderer/AnnotationRenderer.java
src/jalview/schemes/ResidueProperties.java
src/jalview/ws/jws2/AAConsClient.java
test/jalview/io/TCoffeeScoreFileTest.java

index 6cffc21..e73cec3 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"/>
+       <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>
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..7341ab1
--- /dev/null
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs
new file mode 100644 (file)
index 0000000..b196c64
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
index 6ae57bf..0540b41 100644 (file)
Binary files a/lib/VARNAv3-9-dev.jar and b/lib/VARNAv3-9-dev.jar differ
index c3ab9d7..1b648fe 100755 (executable)
@@ -21,6 +21,13 @@ 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 jalview.datamodel.*;
 import jalview.gui.*;
@@ -51,7 +58,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
 
   {
     this.pdbentry = pdbentry;
index 18b83ae..bb48174 100755 (executable)
@@ -22,6 +22,14 @@ 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 jalview.datamodel.*;
 import jalview.io.FileParse;
 
@@ -36,12 +44,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
   {
     super(inFile, inType);
   }
 
-  public PDBfile(FileParse source) throws IOException
+  public PDBfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
@@ -55,7 +63,7 @@ public class PDBfile extends jalview.io.AlignFile
   {
     // TODO set the filename sensibly - try using data source name.
     id = safeName(getDataName());
-
+  
       chains = new Vector();
 
       PDBChain tmpchain;
@@ -170,11 +178,18 @@ public class PDBfile extends jalview.io.AlignFile
         // maintain reference to
         // dataset
         seqs.addElement(chainseq);
+       if(isRNA(chainseq)==true)
+       {
+          System.out.println("this is a PDB format and RNA sequence");
+       }
+        
         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 +278,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..c309dfc 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'))
       {
         stack.push(i);
       }
-      else if ((base == '>') || (base == ')') || (base == '}')
-              || (base == ']'))
+      else if ((base == '>') || (base == ')') || (base == '}')|| (base == ']')|| (base == 'a')|| (base == 'b')|| (base == 'c')|| (base == 'd'))
+      
       {
 
         if (stack.isEmpty())
index 4948613..6876984 100644 (file)
@@ -92,6 +92,14 @@ 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
+\r
 public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemListener, KeyListener\r
 {\r
   public AlignmentPanel alignPanel;\r
@@ -3625,8 +3633,13 @@ 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
    */\r
-  public boolean loadScoreFile( String source ) throws IOException {\r
+  public boolean loadScoreFile( String source ) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed {\r
 \r
     TCoffeeScoreFile file = new TCoffeeScoreFile(source, AppletFormatAdapter.checkProtocol(source));\r
          if( !file.isValid()) {\r
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..aa27d25 100755 (executable)
@@ -60,7 +60,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;
 
   /**
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..87bbae3 100644 (file)
@@ -148,16 +148,19 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
   {
     // super("VARNA in Jalview");
     initVarna(seq, struc);
+    System.out.println("here(1)");
   }
 
   public AppVarnaBinding(ArrayList<RNA> rnaList)
   {
+        System.out.println("here(2)");
     // super("VARNA in Jalview");
     initVarnaEdit(rnaList);
   }
 
   private void initVarna(String seq, String str)
   {
+         System.out.println("initialisation VARNA (appvarnabinding");
     DefaultListModel dlm = new DefaultListModel();
 
     DefaultListSelectionModel m = new DefaultListSelectionModel();
@@ -190,6 +193,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
 
     try
     {
+    System.out.println("here");
       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)
   {
+        System.out.println("initialisation VARNA(2) (appvarnabinding");
     DefaultListModel dlm = new DefaultListModel();
 
     int marginTools = 40;
@@ -251,10 +256,12 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
 
     try
     {
+       System.out.println("here(plop)");
       vp = new VARNAPanel("0", ".");
       for (int i = 0; i < rnaInList.size(); i++)
       {
         rnaInList.get(i).drawRNARadiate(vp.getConfig());
+        System.out.println(i);
       }
     } catch (ExceptionNonEqualLength e)
     {
index 6f36a79..ddcd310 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 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 +44,21 @@ public class AssociatePdbFileWithSeq
  * assocate the given PDB file with 
  * @param choice
  * @param sequence
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
  */
-  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
   {
     PDBEntry entry = new PDBEntry();
     try
     {
+               System.out.println("This is a annotation PDB");
+       
+       
       MCview.PDBfile pdbfile = new MCview.PDBfile(choice,
               protocol);
 
@@ -65,6 +83,7 @@ public class AssociatePdbFileWithSeq
       {
         entry.setId(pdbfile.id);
       }
+       
     } catch (java.io.IOException ex)
     {
       ex.printStackTrace();
@@ -73,6 +92,7 @@ public class AssociatePdbFileWithSeq
     entry.setFile(choice);
     sequence.getDatasetSequence().addPDBId(entry);
     return entry;
+    
   }
 
 }
index c1bbc8d..3e589aa 100644 (file)
@@ -23,6 +23,13 @@ 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 MCview.*;
 import jalview.analysis.*;
@@ -277,8 +284,15 @@ public class PopupMenu extends JPopupMenu
             {
               public void actionPerformed(ActionEvent e)
               {
+                       System.out.println("1:"+structureLine);
+                       System.out.println("2:"+seq);
+                       System.out.println("3:"+seq.getSequenceAsString());
+                       System.out.println("4:"+rnastruc);
+                       System.out.println("5:"+seq.getName());
+                       System.out.println("6:"+ap);
                 new AppVarna(structureLine, seq, seq.getSequenceAsString(), rnastruc, seq
                         .getName(), ap);
+                       System.out.println("end");
               }
             });
             viewStructureMenu.add(menuItem);
@@ -304,6 +318,7 @@ 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,seq.getSequenceAsString(), rnastruc, seq
                           .getName(), ap);
                 }
@@ -1004,7 +1019,24 @@ 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();
+               }
       }
     });
     enterPDB.setText("Enter PDB Id");
@@ -1847,7 +1879,7 @@ public class PopupMenu extends JPopupMenu
     oal = null;
   }
 
-  public void pdbFromFile_actionPerformed()
+  public void pdbFromFile_actionPerformed() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
             jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
index 3ef7210..c5d44ed 100755 (executable)
@@ -27,6 +27,14 @@ 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;
+
 /**
  * DOCUMENT ME!
  * 
@@ -65,6 +73,8 @@ public abstract class AlignFile extends FileParse
    */
   public AlignFile()
   {
+         // Shouldn't we init data structures
+         initData();
   }
 
   /**
@@ -74,8 +84,13 @@ 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 
    */
-  public AlignFile(String inFile, String type) throws IOException
+  public AlignFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(inFile, type);
     initData();
@@ -92,8 +107,13 @@ public abstract class AlignFile extends FileParse
    * 
    * @param source
    * @throws IOException
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
    */
-  public AlignFile(FileParse source) throws IOException
+  public AlignFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
     initData();
@@ -237,8 +257,13 @@ 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 
    */
-  public abstract void parse() throws IOException;
+  public abstract void parse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed;
 
   /**
    * Print out in alignment file format the Sequences in the seqs Vector.
index 0709a2f..dad1077 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
@@ -67,7 +67,7 @@ public class AppletFormatAdapter
    */
   public static final String[] READABLE_EXTENSIONS = new String[]
   { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
-      "sto,stk" }; // ,
+      "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,16 @@ public class AppletFormatAdapter
       }
       else if (format.equals("PDB"))
       {
+       //if (contient de l'ARN)
+       //  {
+         System.out.println(inFile); //donne le path
+         
+               //new URL = http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data=inFile;
+         //afile = new RnamlFile(inFile, type);
+               
+         //}
         afile = new MCview.PDBfile(inFile, type);
+        
       }
       else if (format.equals("STH"))
       {
@@ -233,7 +242,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 +353,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 +464,11 @@ public class AppletFormatAdapter
       {
         afile = new AMSAFile(alignment);
       }
+      else if (format.equalsIgnoreCase("RNAML"))
+      {
+        afile = new RnamlFile();
+      }
+      
       else
       {
         throw new Exception(
index 03b2edf..e5bcd32 100755 (executable)
@@ -20,6 +20,14 @@ 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 jalview.datamodel.*;
 
 /**
@@ -49,13 +57,18 @@ public class BLCFile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
    */
-  public BLCFile(String inFile, String type) throws IOException
+  public BLCFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(inFile, type);
   }
 
-  public BLCFile(FileParse source) throws IOException
+  public BLCFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index 8c0cac1..29a3daf 100755 (executable)
@@ -20,6 +20,14 @@ 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 jalview.datamodel.*;
 import jalview.util.*;
 
@@ -30,12 +38,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
   {
     super(inFile, type);
   }
 
-  public ClustalFile(FileParse source) throws IOException
+  public ClustalFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index 3b74855..d2749db 100755 (executable)
@@ -19,6 +19,14 @@ 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 jalview.datamodel.*;
 
 /**
@@ -53,13 +61,18 @@ public class FastaFile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
    */
-  public FastaFile(String inFile, String type) throws IOException
+  public FastaFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(inFile, type);
   }
 
-  public FastaFile(FileParse source) throws IOException
+  public FastaFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index 2ac0e13..6958923 100755 (executable)
@@ -20,6 +20,14 @@ 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
+\r
 import jalview.analysis.SequenceIdMatcher;\r
 import jalview.datamodel.*;\r
 import jalview.schemes.*;\r
@@ -59,13 +67,18 @@ 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
    */\r
-  public FeaturesFile(String inFile, String type) throws IOException\r
+  public FeaturesFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed\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\r
   {\r
     super(source);\r
   }\r
index 7c5223c..6475497 100755 (executable)
@@ -132,6 +132,13 @@ public class IdentifyFile
 
           break;
         }
+        
+        if ((data.indexOf(">") > -1))
+        {
+          reply = "RNAML";
+          System.out.println("This is a RNAML format");
+          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..a26ec61 100755 (executable)
@@ -25,6 +25,14 @@ 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 jalview.datamodel.*;
 
 /**
@@ -66,13 +74,18 @@ public class JPredFile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
    */
-  public JPredFile(String inFile, String type) throws IOException
+  public JPredFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(inFile, type);
   }
 
-  public JPredFile(FileParse source) throws IOException
+  public JPredFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
@@ -347,8 +360,13 @@ public class JPredFile extends AlignFile
    * 
    * @param args
    *          DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
    */
-  public static void main(String[] args)
+  public static void main(String[] args) throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     try
     {
index b128997..855cd8d 100755 (executable)
@@ -171,7 +171,7 @@ public class JalviewFileChooser extends JFileChooser
     {
       format = "PFAM";
     }
-
+    
     return format;
   }
 
index 6b584a8..2d9579c 100755 (executable)
@@ -20,6 +20,14 @@ 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 jalview.datamodel.*;
 import jalview.util.*;
 
@@ -49,13 +57,18 @@ public class MSFfile extends AlignFile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
    */
-  public MSFfile(String inFile, String type) throws IOException
+  public MSFfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(inFile, type);
   }
 
-  public MSFfile(FileParse source) throws IOException
+  public MSFfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index 07dc6b5..5bc7bd5 100755 (executable)
@@ -20,6 +20,14 @@ 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 jalview.datamodel.*;
 
 public class PIRFile extends AlignFile
@@ -32,12 +40,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
   {
     super(inFile, type);
   }
 
-  public PIRFile(FileParse source) throws IOException
+  public PIRFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index f74a15a..a8df460 100755 (executable)
@@ -20,6 +20,14 @@ 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 jalview.datamodel.*;
 import jalview.util.*;
 
@@ -30,12 +38,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
   {
     super(inFile, type);
   }
 
-  public PfamFile(FileParse source) throws IOException
+  public PfamFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index 571c469..3d9845d 100755 (executable)
@@ -34,6 +34,14 @@ 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 jalview.datamodel.*;
 import jalview.util.*;
 
@@ -57,13 +65,18 @@ public class PileUpfile extends MSFfile
    * 
    * @throws IOException
    *           DOCUMENT ME!
+ * @throws SAXException 
+ * @throws ParserConfigurationException 
+ * @throws ExceptionFileFormatOrSyntax 
+ * @throws ExceptionLoadingFailed 
+ * @throws ExceptionPermissionDenied 
    */
-  public PileUpfile(String inFile, String type) throws IOException
+  public PileUpfile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(inFile, type);
   }
 
-  public PileUpfile(FileParse source) throws IOException
+  public PileUpfile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
diff --git a/src/jalview/io/RnamlFile.java b/src/jalview/io/RnamlFile.java
new file mode 100644 (file)
index 0000000..e614e6b
--- /dev/null
@@ -0,0 +1,272 @@
+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 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.factories.RNAFactory;
+import fr.orsay.lri.varna.models.rna.RNA;
+import fr.orsay.lri.varna.utils.RNAMLParser;
+
+
+
+
+public class RnamlFile extends AlignFile
+{
+        public String id;
+        
+        public RnamlFile()
+         {
+                super();
+               
+         }
+        
+        public RnamlFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
+         {
+           super(inFile, type);
+           
+         }
+
+         public RnamlFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
+         {
+           super(source);
+           
+         }
+         
+         
+       
+       
+         public void parse() throws ExceptionPermissionDenied, ExceptionLoadingFailed, ExceptionFileFormatOrSyntax, FileNotFoundException 
+         {
+                 System.out.println("this is a rnaml file");
+                 
+                 
+                 FileReader fr = null;
+                 fr = new FileReader(inFile); 
+                 
+                 BufferedReader r = new BufferedReader (fr);
+                
+                 Hashtable seqhash = new Hashtable();
+                 Vector headers = new Vector();
+                 //ArrayList<String> seq =new ArrayList();
+                 System.out.println(r);
+                 ArrayList<RNA> result = RNAFactory.loadSecStrRNAML(r);
+                 
+                 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);
+               }
+                 
+                 
+                 
+                 
+                 
+                 
+                 
+                 
+                
+       
+//                                     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;
+         }
+         
+}
+
index ec1cbd0..42b593e 100644 (file)
@@ -20,6 +20,14 @@ 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 jalview.datamodel.*;
 import jalview.util.*;
 
@@ -46,12 +54,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
   {
     super(inFile, type);
   }
 
-  public SimpleBlastFile(FileParse source) throws IOException
+  public SimpleBlastFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index 6b60cd5..2827191 100644 (file)
@@ -23,7 +23,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 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 jalview.datamodel.*;\r
 import jalview.analysis.Rna;\r
 \r
@@ -49,12 +57,12 @@ public class StockholmFile extends AlignFile
   {\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\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\r
   {\r
     super(source);\r
   }\r
index cf33671..1531301 100644 (file)
@@ -19,6 +19,14 @@ 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;
+
 /**
  * A file parse for T-Coffee score ascii format. This file contains the alignment consensus 
  * for each resude in any sequence.
@@ -74,13 +82,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
   {
     super(inFile, type);
     
   }
 
-  public TCoffeeScoreFile(FileParse source) throws IOException
+  public TCoffeeScoreFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed
   {
     super(source);
   }
index 8588bf2..d56ba54 100644 (file)
@@ -34,6 +34,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 +53,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 +70,7 @@ public class AnnotationRenderer
     }
     else
     {
+       
       // display a forward arrow
       if (diffdownstream)
       {
@@ -125,6 +128,64 @@ public class AnnotationRenderer
    */
   private int imgWidth;
 
+  
+  public void drawNotCanonicalAnnot(Graphics g, Annotation[] row_annotations,
+          int lastSSX, int x, int y, int iconOffset, int startRes,
+          int column, boolean validRes, boolean validEnd)
+  {
+       
+    g.setColor(NOTCANONICAL_COLOUR);
+    int sCol = (lastSSX / charWidth) + startRes;
+    int x1 = lastSSX;
+    int x2 = (x * charWidth);
+    Regex closeparen = new Regex("(}|]|a|b|c|d)");
+    
+    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,
@@ -441,12 +502,22 @@ public class AnnotationRenderer
         {
           char ss = validRes ? row_annotations[column].secondaryStructure
                   : ' ';
+          //System.out.println(ss);
           if (ss == 'S')
           {
             // distinguish between forward/backward base-pairing
             if (row_annotations[column].displayCharacter.indexOf(')') > -1)
             {
               ss = 's';
+              System.out.println(ss);
+            }
+          }
+           if (ss == 'C')
+          {
+            if ((row_annotations[column].displayCharacter.indexOf(']') > -1) || (row_annotations[column].displayCharacter.indexOf('}') > -1))
+            {
+                ss = 'c';
+                System.out.println(ss);
             }
           }
           if (!validRes || (ss != lastSS))
@@ -470,7 +541,11 @@ public class AnnotationRenderer
                 drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
                         column, validRes, validEnd);
                 break;
-
+              case 'C':
+              case 'c':
+                 drawNotCanonicalAnnot(g, 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 +610,11 @@ public class AnnotationRenderer
           drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
                   column, validRes, validEnd);
           break;
+        case 'c':
+        case 'C': 
+         drawNotCanonicalAnnot(g, 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 +695,8 @@ public class AnnotationRenderer
   private final Color HELIX_COLOUR = Color.red;
 
   private final Color STEM_COLOUR = Color.blue;
+  
+  private final Color NOTCANONICAL_COLOUR = Color.red;
 
   public void drawGlyphLine(Graphics g, Annotation[] row,
           int lastSSX, int x, int y, int iconOffset, int startRes,
@@ -625,6 +707,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)
   {
index 98b7101..2416344 100755 (executable)
@@ -1342,6 +1342,18 @@ public class ResidueProperties
     toRNAssState = new Hashtable();
     toRNAssState.put(")", "S");
     toRNAssState.put("(", "S");
+    toRNAssState.put("]", "C");
+    toRNAssState.put("[", "C");
+    toRNAssState.put("{", "C");
+    toRNAssState.put("}", "C");
+    toRNAssState.put("A", "C");
+    toRNAssState.put("a", "C");
+    toRNAssState.put("B", "C");
+    toRNAssState.put("b", "C");
+    toRNAssState.put("C", "C");
+    toRNAssState.put("c", "C");
+    toRNAssState.put("D", "C");
+    toRNAssState.put("d", "C");
   }
 
   /**
index 58d0fa9..c5aa7fa 100644 (file)
@@ -4,6 +4,7 @@ import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Annotation;
 import jalview.gui.AlignFrame;
+import jalview.gui.AlignmentPanel;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.WsParamSetI;
 
index 85c0bff..493e9cd 100644 (file)
@@ -12,7 +12,14 @@ 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;
 
 public class TCoffeeScoreFileTest {
 
@@ -20,7 +27,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 {
 
                TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),AppletFormatAdapter.FILE);
                assertTrue(scoreFile.getWarningMessage(),scoreFile.isValid());
@@ -41,7 +48,7 @@ public class TCoffeeScoreFileTest {
        
        
        @Test
-       public void testWrongFile() {
+       public void testWrongFile() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed {
            try {
                TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE);
                assertFalse(result.isValid());
@@ -52,7 +59,7 @@ public class TCoffeeScoreFileTest {
        } 
 
        @Test
-       public void testHeightAndWidth() throws IOException {
+       public void testHeightAndWidth() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed {
                TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
                assertTrue(result.isValid());
                assertEquals( 8, result.getHeight() );
@@ -92,7 +99,7 @@ public class TCoffeeScoreFileTest {
        }
 
        @Test
-       public void testParse() throws IOException {
+       public void testParse() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed {
 
                TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
 
@@ -109,7 +116,7 @@ public class TCoffeeScoreFileTest {
 
        
        @Test
-       public void testGetAsList() throws IOException {
+       public void testGetAsList() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed {
                
           TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
           assertTrue(parser.getWarningMessage(),parser.isValid());
@@ -128,7 +135,7 @@ public class TCoffeeScoreFileTest {
        
        
        @Test
-       public void testGetAsArray() throws IOException {
+       public void testGetAsArray() throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed {
                
           TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
           assertTrue(parser.getWarningMessage(),parser.isValid());