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