From: Anne Menard Date: Thu, 5 Jul 2012 09:49:15 +0000 (+0200) Subject: Add support RNAML format X-Git-Tag: Jalview_2_9~265^2~44 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=a7f8fa9c06d82efbbdbc6a0bf1054bb21610b353 Add support RNAML format --- diff --git a/.classpath b/.classpath index 6cffc21..e73cec3 100644 --- a/.classpath +++ b/.classpath @@ -46,7 +46,8 @@ - + + 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 index 0000000..b280175 --- /dev/null +++ b/.externalToolBuilders/Jalview Release 2.7 build.xml [Builder].launch @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project index 5f4b511..d0dfc7e 100644 --- a/.project +++ b/.project @@ -6,23 +6,13 @@ - org.eclipse.wst.common.project.facet.core.builder - - - - org.eclipse.jdt.core.javabuilder - org.eclipse.ui.externaltools.ExternalToolBuilder - full,incremental, + org.eclipse.wst.common.project.facet.core.builder - - LaunchConfigHandle - <project>/.externalToolBuilders/Jalview Release indices [Builder].launch - @@ -31,7 +21,7 @@ LaunchConfigHandle - <project>/.externalToolBuilders/buildapplet [Builder].launch + <project>/.externalToolBuilders/Jalview Release indices [Builder].launch diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7341ab1 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -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 index 0000000..b196c64 --- /dev/null +++ b/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/lib/VARNAv3-9-dev.jar b/lib/VARNAv3-9-dev.jar index 6ae57bf..0540b41 100644 Binary files a/lib/VARNAv3-9-dev.jar and b/lib/VARNAv3-9-dev.jar differ diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index c3ab9d7..1b648fe 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -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; diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index 18b83ae..bb48174 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -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') || (base == ')') || (base == '}') - || (base == ']')) + else if ((base == '>') || (base == ')') || (base == '}')|| (base == ']')|| (base == 'a')|| (base == 'b')|| (base == 'c')|| (base == 'd')) + { if (stack.isEmpty()) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 4948613..6876984 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -92,6 +92,14 @@ import java.util.List; import java.util.StringTokenizer; 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; + public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemListener, KeyListener { public AlignmentPanel alignPanel; @@ -3625,8 +3633,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis * @param source File/URL/T-COFFEE score file contents * @throws IOException * @return true if alignment was annotated with data from source + * @throws SAXException + * @throws ParserConfigurationException + * @throws ExceptionFileFormatOrSyntax + * @throws ExceptionLoadingFailed + * @throws ExceptionPermissionDenied */ - public boolean loadScoreFile( String source ) throws IOException { + public boolean loadScoreFile( String source ) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed { TCoffeeScoreFile file = new TCoffeeScoreFile(source, AppletFormatAdapter.checkProtocol(source)); if( !file.isValid()) { diff --git a/src/jalview/datamodel/SecondaryStructureAnnotation.java b/src/jalview/datamodel/SecondaryStructureAnnotation.java new file mode 100644 index 0000000..5c3eae9 --- /dev/null +++ b/src/jalview/datamodel/SecondaryStructureAnnotation.java @@ -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 rnaList = new ArrayList(); 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 { diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java index fc1f446..87bbae3 100644 --- a/src/jalview/gui/AppVarnaBinding.java +++ b/src/jalview/gui/AppVarnaBinding.java @@ -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 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 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) { diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index 6f36a79..ddcd310 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -18,10 +18,19 @@ 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; + } } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index c1bbc8d..3e589aa 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -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")); diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 3ef7210..c5d44ed 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -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. diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index 0709a2f..dad1077 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -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( diff --git a/src/jalview/io/BLCFile.java b/src/jalview/io/BLCFile.java index 03b2edf..e5bcd32 100755 --- a/src/jalview/io/BLCFile.java +++ b/src/jalview/io/BLCFile.java @@ -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); } diff --git a/src/jalview/io/ClustalFile.java b/src/jalview/io/ClustalFile.java index 8c0cac1..29a3daf 100755 --- a/src/jalview/io/ClustalFile.java +++ b/src/jalview/io/ClustalFile.java @@ -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); } diff --git a/src/jalview/io/FastaFile.java b/src/jalview/io/FastaFile.java index 3b74855..d2749db 100755 --- a/src/jalview/io/FastaFile.java +++ b/src/jalview/io/FastaFile.java @@ -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); } diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 2ac0e13..6958923 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -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.analysis.SequenceIdMatcher; import jalview.datamodel.*; import jalview.schemes.*; @@ -59,13 +67,18 @@ public class FeaturesFile extends AlignFile * * @throws IOException * DOCUMENT ME! + * @throws SAXException + * @throws ParserConfigurationException + * @throws ExceptionFileFormatOrSyntax + * @throws ExceptionLoadingFailed + * @throws ExceptionPermissionDenied */ - public FeaturesFile(String inFile, String type) throws IOException + public FeaturesFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed { super(inFile, type); } - public FeaturesFile(FileParse source) throws IOException + public FeaturesFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed { super(source); } diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 7c5223c..6475497 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -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(); diff --git a/src/jalview/io/JPredFile.java b/src/jalview/io/JPredFile.java index 396847d..a26ec61 100755 --- a/src/jalview/io/JPredFile.java +++ b/src/jalview/io/JPredFile.java @@ -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 { diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index b128997..855cd8d 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -171,7 +171,7 @@ public class JalviewFileChooser extends JFileChooser { format = "PFAM"; } - + return format; } diff --git a/src/jalview/io/MSFfile.java b/src/jalview/io/MSFfile.java index 6b584a8..2d9579c 100755 --- a/src/jalview/io/MSFfile.java +++ b/src/jalview/io/MSFfile.java @@ -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); } diff --git a/src/jalview/io/PIRFile.java b/src/jalview/io/PIRFile.java index 07dc6b5..5bc7bd5 100755 --- a/src/jalview/io/PIRFile.java +++ b/src/jalview/io/PIRFile.java @@ -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); } diff --git a/src/jalview/io/PfamFile.java b/src/jalview/io/PfamFile.java index f74a15a..a8df460 100755 --- a/src/jalview/io/PfamFile.java +++ b/src/jalview/io/PfamFile.java @@ -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); } diff --git a/src/jalview/io/PileUpfile.java b/src/jalview/io/PileUpfile.java index 571c469..3d9845d 100755 --- a/src/jalview/io/PileUpfile.java +++ b/src/jalview/io/PileUpfile.java @@ -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 index 0000000..e614e6b --- /dev/null +++ b/src/jalview/io/RnamlFile.java @@ -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 seq =new ArrayList(); + System.out.println(r); + ArrayList 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 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 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; + } + +} + diff --git a/src/jalview/io/SimpleBlastFile.java b/src/jalview/io/SimpleBlastFile.java index ec1cbd0..42b593e 100644 --- a/src/jalview/io/SimpleBlastFile.java +++ b/src/jalview/io/SimpleBlastFile.java @@ -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); } diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index 6b60cd5..2827191 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -23,7 +23,15 @@ package jalview.io; import java.io.*; import java.util.*; +import javax.xml.parsers.ParserConfigurationException; + +import org.xml.sax.SAXException; + import com.stevesoft.pat.*; + +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.analysis.Rna; @@ -49,12 +57,12 @@ public class StockholmFile extends AlignFile { } - public StockholmFile(String inFile, String type) throws IOException + public StockholmFile(String inFile, String type) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed { super(inFile, type); } - public StockholmFile(FileParse source) throws IOException + public StockholmFile(FileParse source) throws IOException, ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed { super(source); } diff --git a/src/jalview/io/TCoffeeScoreFile.java b/src/jalview/io/TCoffeeScoreFile.java index cf33671..1531301 100644 --- a/src/jalview/io/TCoffeeScoreFile.java +++ b/src/jalview/io/TCoffeeScoreFile.java @@ -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); } diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 8588bf2..d56ba54 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -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) { diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 98b7101..2416344 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -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"); } /** diff --git a/src/jalview/ws/jws2/AAConsClient.java b/src/jalview/ws/jws2/AAConsClient.java index 58d0fa9..c5aa7fa 100644 --- a/src/jalview/ws/jws2/AAConsClient.java +++ b/src/jalview/ws/jws2/AAConsClient.java @@ -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; diff --git a/test/jalview/io/TCoffeeScoreFileTest.java b/test/jalview/io/TCoffeeScoreFileTest.java index 85c0bff..493e9cd 100644 --- a/test/jalview/io/TCoffeeScoreFileTest.java +++ b/test/jalview/io/TCoffeeScoreFileTest.java @@ -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());