From: Jim Procter Date: Tue, 18 Feb 2014 17:12:38 +0000 (+0000) Subject: Merge branch 'JAL-1445' into develop X-Git-Tag: Jalview_2_9~207 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8d2724b83aca38ef75d68787cc5939d950467e63;p=jalview.git Merge branch 'JAL-1445' into develop Carried over source formatting from 2.8.0b1 release Conflicts: src/jalview/analysis/StructureFrequency.java src/jalview/ext/varna/VarnaCommands.java src/jalview/gui/AppVarna.java src/jalview/gui/PopupMenu.java src/jalview/io/AppletFormatAdapter.java src/jalview/io/StockholmFile.java src/jalview/jbgui/GAlignFrame.java src/jalview/jbgui/GDesktop.java --- 8d2724b83aca38ef75d68787cc5939d950467e63 diff --cc build.xml index dc93408,82cbabb..31419c8 --- a/build.xml +++ b/build.xml @@@ -93,13 -94,14 +94,15 @@@ - + + - - - - + + + + + + diff --cc src/jalview/analysis/AlignSeq.java index 6d8c0cd,573c545..9b09456 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@@ -14,8 -14,10 +14,9 @@@ * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.analysis; - import java.util.*; import java.awt.*; diff --cc src/jalview/analysis/StructureFrequency.java index 9ebbe51,6409413..6816547 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@@ -14,8 -14,8 +14,9 @@@ * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ + package jalview.analysis; import java.util.*; diff --cc src/jalview/ext/varna/VarnaCommands.java index 21f626f,8ed7462..b5f0dc9 --- a/src/jalview/ext/varna/VarnaCommands.java +++ b/src/jalview/ext/varna/VarnaCommands.java @@@ -1,157 -1,168 +1,170 @@@ -/* +/* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Copyright (C) 2014 The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. - */ -package jalview.ext.varna; - -import jalview.api.FeatureRenderer; -import jalview.api.SequenceRenderer; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SequenceI; -import jalview.structure.StructureMapping; -import jalview.structure.StructureSelectionManager; - -import java.awt.Color; -import java.util.ArrayList; - -/** + */ +package jalview.ext.varna; + +import jalview.api.FeatureRenderer; +import jalview.api.SequenceRenderer; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceI; +import jalview.structure.StructureMapping; +import jalview.structure.StructureSelectionManager; +import jalview.util.Comparison; + +import java.awt.Color; +import java.util.ArrayList; + +/** - * Routines for generating Jmol commands for Jalview/Jmol binding - * another cruisecontrol test. + * Routines for generating Jmol commands for Jalview/Jmol binding another + * cruisecontrol test. - * - * @author JimP - * - */ -public class VarnaCommands -{ - - /** + * + * @author JimP + * + */ +public class VarnaCommands +{ + + /** - * Jmol utility which constructs the commands to colour chains by the given alignment + * Jmol utility which constructs the commands to colour chains by the given + * alignment - * - */ + * + */ - public static String[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment) + public static String[] getColourBySequenceCommand( + StructureSelectionManager ssm, String[] files, + SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, + AlignmentI alignment) - { - ArrayList str = new ArrayList(); - StringBuffer command = new StringBuffer(); - - for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) - { - StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); - - if (mapping == null || mapping.length < 1) - continue; - - int lastPos = -1; - for (int s = 0; s < sequence[pdbfnum].length; s++) - { - for (int sp, m = 0; m < mapping.length; m++) - { - if (mapping[m].getSequence() == sequence[pdbfnum][s] - && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) - { - SequenceI asp = alignment.getSequenceAt(sp); - for (int r = 0; r < asp.getLength(); r++) - { - // no mapping to gaps in sequence - if (jalview.util.Comparison.isGap(asp.getCharAt(r))) - { - continue; - } - int pos = mapping[m].getPDBResNum(asp.findPosition(r)); - - if (pos < 1 || pos == lastPos) - continue; - - lastPos = pos; - - Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r); - - if (fr != null) - col = fr.findFeatureColour(col, sequence[pdbfnum][s], r); - String newSelcom = (mapping[m].getChain() != " " ? ":" - + mapping[m].getChain() : "") - + "/" - + (pdbfnum + 1) - + ".1" - + ";color[" - + col.getRed() - + "," - + col.getGreen() - + "," - + col.getBlue() + "]"; + { + + ArrayList str = new ArrayList(); + StringBuffer command = new StringBuffer(); + + for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) + { + StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); + + if (mapping == null || mapping.length < 1) + continue; + + int lastPos = -1; + for (int s = 0; s < sequence[pdbfnum].length; s++) + { + for (int sp, m = 0; m < mapping.length; m++) + { + if (mapping[m].getSequence() == sequence[pdbfnum][s] + && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) + { + SequenceI asp = alignment.getSequenceAt(sp); + for (int r = 0; r < asp.getLength(); r++) + { + // no mapping to gaps in sequence + if (jalview.util.Comparison.isGap(asp.getCharAt(r))) + { + continue; + } + int pos = mapping[m].getPDBResNum(asp.findPosition(r)); + + if (pos < 1 || pos == lastPos) + continue; + + lastPos = pos; + + Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r); + + if (fr != null) + col = fr.findFeatureColour(col, sequence[pdbfnum][s], r); + String newSelcom = (mapping[m].getChain() != " " ? ":" + + mapping[m].getChain() : "") + + "/" + + (pdbfnum + 1) + + ".1" + + ";color[" + + col.getRed() + + "," + + col.getGreen() + + "," + + col.getBlue() + "]"; - if (command.length()>newSelcom.length() && command.substring(command.length()-newSelcom.length()).equals(newSelcom)) + if (command.length() > newSelcom.length() + && command.substring( + command.length() - newSelcom.length()) + .equals(newSelcom)) - { - command = VarnaCommands.condenseCommand(command, pos); - continue; - } - // TODO: deal with case when buffer is too large for Jmol to parse - // - execute command and flush - - command.append(";"); - if (command.length() > 51200) - { - // add another chunk - str.add(command.toString()); - command.setLength(0); - } - command.append("select " + pos); - command.append(newSelcom); - } - break; - } - } - } - } - { - // add final chunk - str.add(command.toString()); - command.setLength(0); - } - return str.toArray(new String[str.size()]); - } - - public static StringBuffer condenseCommand(StringBuffer command, int pos) - { - - // work back to last 'select' - int p = command.length(), q = p; + { + command = VarnaCommands.condenseCommand(command, pos); + continue; + } + // TODO: deal with case when buffer is too large for Jmol to parse + // - execute command and flush + + command.append(";"); + if (command.length()>51200) + { + // add another chunk + str.add(command.toString()); + command.setLength(0); + } + command.append("select " + pos); + command.append(newSelcom); + } + break; + } + } + } + } + { + // add final chunk + str.add(command.toString()); + command.setLength(0); + } + return str.toArray(new String[str.size()]); + } + + public static StringBuffer condenseCommand(StringBuffer command, int pos) + { + + // work back to last 'select' + int p=command.length(),q=p; - do { + do + { - p -= 6; + p-=6; - if (p<1) { p=0; }; + if (p < 1) + { + p = 0; + } + ; - } while ((q = command.indexOf("select", p)) == -1 && p > 0); - - StringBuffer sb = new StringBuffer(command.substring(0, q + 7)); - - command = command.delete(0, q + 7); - - String start; - - if (command.indexOf("-") > -1) - { - start = command.substring(0, command.indexOf("-")); - } - else - { - start = command.substring(0, command.indexOf(":")); - } - - sb.append(start + "-" + pos + command.substring(command.indexOf(":"))); - - return sb; - } - -} + } while ((q=command.indexOf("select",p))==-1 && p>0); + + StringBuffer sb = new StringBuffer(command.substring(0,q+7)); + + command = command.delete(0,q+7); + + String start; + + if (command.indexOf("-") > -1) + { + start = command.substring(0, command.indexOf("-")); + } + else + { + start = command.substring(0, command.indexOf(":")); + } + + sb.append(start + "-" + pos + command.substring(command.indexOf(":"))); + + return sb; + } + +} diff --cc src/jalview/gui/AppVarna.java index 4bff08c,1de0cf2..a1f9a3d --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@@ -17,28 -18,18 +18,32 @@@ */ package jalview.gui; -import java.util.*; +import jalview.bin.Cache; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.structure.SecondaryStructureListener; +import jalview.structure.SelectionListener; +import jalview.structure.SelectionSource; +import jalview.structure.StructureSelectionManager; +import jalview.structure.VamsasSource; +import jalview.util.ShiftList; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.awt.*; -import javax.swing.*; +import javax.swing.JInternalFrame; +import javax.swing.JSplitPane; + import jalview.bin.Cache; -import jalview.datamodel.*; -import jalview.structure.*; + import jalview.util.MessageManager; + import jalview.util.ShiftList; ++ import fr.orsay.lri.varna.VARNAPanel; import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax; import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses; diff --cc src/jalview/gui/PopupMenu.java index 037f007,0e39f34..fb4e237 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@@ -284,9 -280,8 +286,9 @@@ public class PopupMenu extends JPopupMe final String rnastruc = aa[i].getRNAStruc(); final String structureLine = aa[i].label; menuItem = new JMenuItem(); - menuItem.setText("2D RNA " + structureLine); + menuItem.setText(MessageManager.formatMessage("label.2d_rna_structure_line", new String[]{structureLine})); menuItem.addActionListener(new java.awt.event.ActionListener() + { public void actionPerformed(ActionEvent e) { @@@ -1074,33 -1045,7 +1066,33 @@@ pdbFromFile_actionPerformed(); } }); +// RNAFold.setText("From RNA Fold with predict2D"); +// RNAFold.addActionListener(new ActionListener() +// { +// public void actionPerformed(ActionEvent e) +// { +// try { +// RNAFold_actionPerformed(); +// } catch (Exception e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// } +// }); +// ContraFold.setText("From Contra Fold with predict2D"); +// ContraFold.addActionListener(new ActionListener() +// { +// public void actionPerformed(ActionEvent e) +// { +// try { +// ContraFold_actionPerformed(); +// } catch (Exception e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// } +// }); - enterPDB.setText("Enter PDB Id"); + enterPDB.setText(MessageManager.getString("label.enter_pdb_id")); enterPDB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --cc src/jalview/io/AppletFormatAdapter.java index eac7cf2,6679a03..ae742c8 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@@ -68,10 -70,10 +69,8 @@@ public class AppletFormatAdapte * corresponding to READABLE_FNAMES */ public static final String[] READABLE_EXTENSIONS = new String[] - { "fa,faa,fasta,fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar", - "sto,stk","xml,rnaml" }; // , - - // ".blast" + { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar", - "sto,stk" }; // , - - // ".blast" ++ "sto,stk","xml,rnaml" }; // ".blast" // }; /** diff --cc src/jalview/io/StockholmFile.java index 4d8f136,4566bac..9064ad8 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@@ -1,73 -1,50 +1,74 @@@ -/* +/* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Copyright (C) 2014 The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. - */ -/* - * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk - */ -package jalview.io; - -import java.io.*; -import java.util.*; - -import com.stevesoft.pat.*; -import jalview.datamodel.*; -import jalview.util.Format; - -// import org.apache.log4j.*; - -/** - * This class is supposed to parse a Stockholm format file into Jalview There - * are TODOs in this class: we do not know what the database source and version - * is for the file when parsing the #GS= AC tag which associates accessions with - * sequences. Database references are also not parsed correctly: a separate - * reference string parser must be added to parse the database reference form - * into Jalview's local representation. - * - * @author bsb at sanger.ac.uk - * @version 0.3 + jalview mods - * - */ -public class StockholmFile extends AlignFile -{ - // static Logger logger = Logger.getLogger("jalview.io.StockholmFile"); + */ +/* + * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk + */ +package jalview.io; + +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.Mapping; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.util.Format; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.StringTokenizer; +import java.util.Vector; + +import com.stevesoft.pat.Regex; + +import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses; +import fr.orsay.lri.varna.factories.RNAFactory; +import fr.orsay.lri.varna.models.rna.RNA; + +// import org.apache.log4j.*; + +/** + * This class is supposed to parse a Stockholm format file into Jalview There + * are TODOs in this class: we do not know what the database source and version + * is for the file when parsing the #GS= AC tag which associates accessions with + * sequences. Database references are also not parsed correctly: a separate + * reference string parser must be added to parse the database reference form + * into Jalview's local representation. + * + * @author bsb at sanger.ac.uk + * @author Natasha Shersnev (Dundee, UK) (Stockholm file writer) + * @author Lauren Lui (UCSC, USA) (RNA secondary structure annotation import as stockholm) + * @author Anne Menard (Paris, FR) (VARNA parsing of Stockholm file data) + * @version 0.3 + jalview mods + * + */ +public class StockholmFile extends AlignFile +{ + // static Logger logger = Logger.getLogger("jalview.io.StockholmFile"); + protected ArrayList result; StringBuffer out; // output buffer AlignmentI al; diff --cc src/jalview/jbgui/GDesktop.java index 5742337,4ef6fdd..f109058 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@@ -126,14 -129,13 +129,14 @@@ public class GDesktop extends JFram */ private void jbInit() throws Exception { + - FileMenu.setText("File"); - HelpMenu.setText("Help"); + FileMenu.setText(MessageManager.getString("action.file")); + HelpMenu.setText(MessageManager.getString("action.help")); VamsasMenu.setText("Vamsas"); - VamsasMenu.setToolTipText("Share data with other vamsas applications."); - VamsasStMenu.setText("Connect to"); - VamsasStMenu.setToolTipText("Join an existing vamsas session"); - inputLocalFileMenuItem.setText("from File"); + VamsasMenu.setToolTipText(MessageManager.getString("label.share_data_vamsas_applications")); + VamsasStMenu.setText(MessageManager.getString("label.connect_to")); + VamsasStMenu.setToolTipText(MessageManager.getString("label.join_existing_vamsas_session")); + inputLocalFileMenuItem.setText(MessageManager.getString("label.load_tree_from_file")); inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false));