From: Jim Procter Date: Mon, 24 Nov 2014 22:17:25 +0000 (+0000) Subject: Merge branch 'JAL-1569_wuss_vienna_broke' into Release_2_8_2_Branch X-Git-Tag: Release_2_8_2b1^2~16 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cce1680b94df1b7b8dfa321873936e2b870501bc;hp=879293251d1072b24403df2f4bf3ac6a69d4a012;p=jalview.git Merge branch 'JAL-1569_wuss_vienna_broke' into Release_2_8_2_Branch --- diff --git a/.classpath b/.classpath index 2cb2d93..38d2106 100644 --- a/.classpath +++ b/.classpath @@ -3,7 +3,6 @@ - @@ -54,5 +53,7 @@ + + diff --git a/.externalToolBuilders/Jalview Release indices [Builder].launch b/.externalToolBuilders/Jalview Release indices [Builder].launch index 4c0c7dd..9d81cc8 100644 --- a/.externalToolBuilders/Jalview Release indices [Builder].launch +++ b/.externalToolBuilders/Jalview Release indices [Builder].launch @@ -14,6 +14,7 @@ + diff --git a/build.xml b/build.xml index 19b41e5..d8ebe1e 100755 --- a/build.xml +++ b/build.xml @@ -62,8 +62,12 @@ --> + + + + @@ -175,8 +179,9 @@
---Jalview Build Details--- -
+ +
diff --git a/help/help.jhm b/help/help.jhm index c6cc626..b6b0063 100755 --- a/help/help.jhm +++ b/help/help.jhm @@ -39,6 +39,7 @@ + @@ -54,6 +55,7 @@ + diff --git a/help/helpTOC.xml b/help/helpTOC.xml index 6ae5c78..1d45e7a 100755 --- a/help/helpTOC.xml +++ b/help/helpTOC.xml @@ -97,6 +97,9 @@ + + + diff --git a/help/html/features/annotation.html b/help/html/features/annotation.html index 49128c2..a036bd5 100755 --- a/help/html/features/annotation.html +++ b/help/html/features/annotation.html @@ -39,6 +39,15 @@ and symbolic annotations can be added to an alignment via an Annotations File dragged into the alignment window or loaded from the alignment's file menu.

+

Sequence Reference Annotation +

+

+ Sequence reference annotation is created from 3D structure + data, and from the results of sequence based prediction of + secondary structure and disordered region + prediction methods. +

Interactive Alignment Annotation

Annotation rows are added using the Annotation Label diff --git a/help/html/features/chimera.html b/help/html/features/chimera.html index e866597..236701a 100644 --- a/help/html/features/chimera.html +++ b/help/html/features/chimera.html @@ -133,6 +133,8 @@ atoms in the displayed structures. For comprehensive details of Chimera's comman they are insertions (relative to the associated sequence in the alignment) and grey if they are N or C terminal flanks outside the region mapped to the alignment window's sequence. +

  • By Chain
    +
    Uses the Chimera 'rainbow chain' command to apply a different colour to each chain.
  • Charge & Cysteine
    Highlights cysteines in yellow, anionic (Aspartic Acid or Glutamic Acid) residues in red, and cationic (Lysine or Arginine) diff --git a/help/html/features/preferences.html b/help/html/features/preferences.html index b2d8b93..657359e 100755 --- a/help/html/features/preferences.html +++ b/help/html/features/preferences.html @@ -113,16 +113,16 @@ will be loaded.

    "Structure" Preferences tab added in Jalview 2.8.2

    Process secondary structure from PDB - if selected, then structure information -read from PDB will be processed to derive secondary structure annotation. -

    Use RNAView for secondary structure - if selected, the RNAView service will be -automatically called to derive secondary structure information. -

    Add secondary structure annotation to alignment - if selected, PDB secondary structure -annotation will be shown on the alignment when available. -

    Add Temperature Factor annotation to alignment - if selected, PDB Temperature Factor -annotation will be shown on the alignment when available. +read from PDB will be processed and annotation added to associated sequences. +

    Use RNAView for secondary structure - if selected, the pyRNA RNAView service (https://github.com/fjossinet/PyRNA) will be +called to derive secondary structure information for RNA chains. +

    Add secondary structure annotation to alignment - if selected, Jmol's implementation DSSP will be used to add annotation to polypeptide chains in the structure. +

    Add Temperature Factor annotation to alignment - if selected, values extracted from the Temperature Factor +column for the backbone atoms in the PDB file will be extracted as annotation lines shown on the alignment.

    Default structure viewer - choose JMOL or CHIMERA for viewing 3D structures.

    Path to Chimera program - Optional, as Jalview will search standard installation paths for Windows, Linux or MacOS. -If you have installed Chimera in a non-standard location, you can specify it here. Enter the full path to the Chimera executable program. +If you have installed Chimera in a non-standard location, you can specify it here, by entering the full path to the Chimera executable program. +Double-click this field to open a file chooser dialog.

    "Connections" Preferences tab

    diff --git a/help/html/features/viewingpdbs.html b/help/html/features/viewingpdbs.html index 8fc557e..75a5c9c 100755 --- a/help/html/features/viewingpdbs.html +++ b/help/html/features/viewingpdbs.html @@ -24,14 +24,26 @@

    Viewing PDB Structures

    - -

    Jalview can view protein structures associated with a sequence -via the "Structure→" submenu from a -sequence's pop-up menu.

    -A Jmol viewer has been included since Jalview 2.3. Jalview 2.8.2 added support for Chimera, -provided this has been separately installed. Choice of default viewer is configurable in the Preferences Structure tab. - -

    The following menu entries are provided for viewing structure data
    +

    + Jalview can view protein structures associated with a sequence via the + "Structure→" submenu from a sequence's pop-up menu. +

    + The + Jmol viewer has been included since Jalview + 2.3. Jalview 2.8.2 included support for + Chimera, provided it is + installed and can be launched by Jalview. The default viewer can be + configured in the + Structure tab in the + Tools→Preferences dialog box. +

    + Structure data imported into Jalview can also be processed to display + secondary structure and temperature factor annotation. See the Annotation from Structure page for + more information. +

    +

    The following menu entries are provided for viewing structure data

    +JNet annotation created in Jalview 2.8.2 and later versions can be displayed on other alignments via the Add reference annotation As of Jalview 2.6, the Jnet service accessed accessed via the 'Secondary structure prediction' submenu should be considered a legacy Jalview SOAP service, and will be replaced in the near future by a -JABAWS Jnet service. +JABAWS Jnet service (now available in the Jalview 2.9 development version). diff --git a/help/html/whatsNew.html b/help/html/whatsNew.html index dd536b1..ae45aae 100755 --- a/help/html/whatsNew.html +++ b/help/html/whatsNew.html @@ -24,53 +24,17 @@

    - What's new ?

    -

    - Jalview 2.8.1 includes new features for group creation, RNA secondary - structure prediction and a host bug fixes. It also includes support - for version 2.1 - of JABA and includes a Spanish translation of its user interface.
    - The highlights are detailed below, and the full list is given in the Jalview 2.8.1 Release Notes. -

    -

    The Desktop and web based applet include new keystrokes for - defining and undefining groups, and PAM250 has been added to the range - of score models available for use by the tree and PCA calculations. - The Jalview project file format has also been extended for handling - RNA and protein secondary structure annotation, in anticipation for - new structure based secondary structure support in Jalview 2.8.2.

    -

    Internationalisation

    -

    Jalview 2.8.1 is the first release to include support for - displaying Jalview's user interface in different languages. In August - 2013, David Roldán-Martinez took on the task of - internationalising Jalview's user interface. He also recruited Sara - Hernández Díaz and Laura Ferrandis Martinez who created - Jalview's first spanish user interface translation.

    -

    - If you notice any problems, or would like to help translate Jalview's - user interface into other languages, head over to issues.jalview.org and put in a - feature request describing the translations you can provide to the i18n - component. David has also documented - the process of creating i18n translations to help you get started. + What's new ?

    -

    RNA Secondary Structure Prediction with JABA 2.1

    -

    - This version of Jalview includes a client to access the new services available in JABA v2.1 , which - provides services for RNA consensus secondary structure prediction and - two new alignment programs (GLProbs and MSAProbs).

    - To see how to perform RNA secondary structure predictions like the one below, take a look at the RNAAliFold - client documentation. + Jalview 2.8.2 is the first release produced by our new core + development team.
    It incorporates many minor improvements and + bug-fixes, and also includes new features for working with 3D + structure data, shading alignments by secondary structure and + generation of alignment figures as Scalable Vector Graphics.
    As + ever, the highlights are detailed below, and the full list is given in + the Jalview 2.8.2 Release + Notes.

    -
    -
    The RNAalifold client was implemented by Jalview's 2013 - summer student, Dan Barton. -
    diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 511e5e9..cabee76 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -107,7 +107,7 @@ action.change_params = Change Parameters action.apply = Apply action.apply_threshold_all_groups = Apply threshold to all groups action.apply_all_groups = Apply to all Groups -action.by_chain = By chain +action.by_chain = By Chain action.by_sequence = By Sequence action.paste_annotations = Paste Annotations action.format = Format @@ -249,8 +249,8 @@ label.autoadd_secstr = Add secondary structure annotation to alignment label.autoadd_temp = Add Temperature Factor annotation to alignment label.structure_viewer = Default structure viewer label.chimera_path = Path to Chimera program -label.chimera_path_tip = Jalview will try standard locations, plus any path entered here. -label.invalid_path = File not found or not executable +label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.
    Double-click to browse for file. +label.invalid_chimera_path = Chimera path not found or not executable label.min_colour = Minimum Colour label.max_colour = Maximum Colour label.use_original_colours = Use Original Colours @@ -344,7 +344,7 @@ label.dont_ask_me_again = Don't ask me again label.select_eps_character_rendering_style = Select EPS character rendering style label.invert_selection = Invert Selection label.optimise_order = Optimise Order -label.seq_sort_by_score = Seq sort by Score +label.seq_sort_by_score = Sequence sort by Score label.load_colours = Load Colours label.save_colours = Save Colours label.fetch_das_features = Fetch DAS Features @@ -778,7 +778,9 @@ label.services_at = Services at {0} label.rest_client_submit = {0} using {1} label.fetch_retrieve_from =Retrieve from {0} label.fetch_retrieve_from_all_sources = Retrieve from all {0} sources in {1}
    First is :{2} -label.feature_settings_click_drag = Click/drag feature types up or down to change render order.
    Double click to select columns containing feature in alignment/current selection
    Pressing Alt will select columns outside features rather than inside
    Pressing Shift to modify current selection (rather than clear current selection)
    Press CTRL or Command/Meta to toggle columns in/outside features
    +#label.feature_settings_click_drag = Click/drag feature types up or down to change render order.
    Double click to select columns containing feature in alignment/current selection
    Pressing Alt will select columns outside features rather than inside
    Pressing Shift to modify current selection (rather than clear current selection)
    Press CTRL or Command/Meta to toggle columns in/outside features
    +label.feature_settings_click_drag = Drag up or down to change render order.
    Double click to select columns containing feature. +label.transparency_tip = Adjust transparency to 'see through' feature colours. label.opt_and_params_further_details = see further details by right-clicking label.opt_and_params_show_brief_desc_image_link = Click to show brief description
    Right click for further information. label.opt_and_params_show_brief_desc = Click to show brief description
    diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index a1663d9..dc403d0 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -748,7 +748,7 @@ label.services_at = Servicios en {0} label.rest_client_submit = {0} utilizando {1} label.fetch_retrieve_from =Recuperar de {0} label.fetch_retrieve_from_all_sources = Recuperar de todas las fuentes {0} en {1}
    La primera es :{2} -label.feature_settings_click_drag = Haga clic o arrastre los tipos de las características hacia arriba o hacia abajo para cambiar el orden de visualización.
    Haga doble clic para seleccionar las columnas que contienen las características del alineamiento/selección actual.
    Presionando Alt seleccionará las columnas exteriores a las características en lugar de las interiores
    Presione Shift para modificar la selección actual (en lugar de borrarla)
    Presione CTRL o Command/Meta para cambiar las columans externas o internas a las características
    +label.feature_settings_click_drag = Haga clic o arrastre los tipos de las características hacia arriba o hacia abajo para cambiar el orden de visualización.
    Haga doble clic para seleccionar las columnas que contienen las características del alineamiento/selección actual.
    label.opt_and_params_further_details = ver los detalles adicionales haciendo clic en el botón derecho label.opt_and_params_show_brief_desc_image_link = Haga clic para ver una descripción breve
    Haga clic en el botón derecho para obtener información adicional. label.opt_and_params_show_brief_desc = Haga clic para ver una descripción breve
    diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 2dd6d37..e8f1bc9 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -267,7 +267,7 @@ public class PDBChain bonds.addElement(new Bond(start, end, at1, at2)); } - public void makeResidueList() + public void makeResidueList(boolean visibleChainAnnotation) { int count = 0; Object symbol; @@ -377,23 +377,27 @@ public class PDBChain .elementAt(i)); resFeatures.setElementAt(null, i); } - Annotation[] annots = new Annotation[resAnnotation.size()]; - float max = 0; - for (i = 0, iSize = annots.length; i < iSize; i++) + if (visibleChainAnnotation) { - annots[i] = (Annotation) resAnnotation.elementAt(i); - if (annots[i].value > max) + Annotation[] annots = new Annotation[resAnnotation.size()]; + float max = 0; + for (i = 0, iSize = annots.length; i < iSize; i++) { - max = annots[i].value; + annots[i] = (Annotation) resAnnotation.elementAt(i); + if (annots[i].value > max) + { + max = annots[i].value; + } + resAnnotation.setElementAt(null, i); } - resAnnotation.setElementAt(null, i); + + AlignmentAnnotation tfactorann = new AlignmentAnnotation( + "PDB.TempFactor", "Temperature Factor for " + + sequence.getName(), annots, 0, max, + AlignmentAnnotation.LINE_GRAPH); + tfactorann.setSequenceRef(sequence); + sequence.addAlignmentAnnotation(tfactorann); } - AlignmentAnnotation tfactorann = new AlignmentAnnotation( - "PDB.TempFactor", "Temperature Factor for " - + sequence.getName(), annots, 0, max, - AlignmentAnnotation.LINE_GRAPH); - tfactorann.setSequenceRef(sequence); - sequence.addAlignmentAnnotation(tfactorann); } public void setChargeColours() diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index d3535c0..bf285b9 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -113,7 +113,7 @@ public class PDBViewer extends JInternalFrame implements Runnable try { tmpPDBFile = pdbentry.getFile(); - PDBfile pdbfile = new PDBfile(false,false,tmpPDBFile, + PDBfile pdbfile = new PDBfile(false, false, false, tmpPDBFile, jalview.io.AppletFormatAdapter.FILE); pdbcanvas.init(pdbentry, seq, chains, ap, protocol); diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index b22eb29..e1c4dc5 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -47,32 +47,38 @@ public class PDBfile extends jalview.io.AlignFile */ boolean VisibleChainAnnotation = false; - boolean processSecondaryStructure=true; - + boolean processSecondaryStructure = true; + + boolean externalSecondaryStructure = false; public PDBfile(boolean visibleChainAnnotation, - boolean processSecondaryStructure) + boolean processSecondaryStructure, boolean externalSecStr) { super(); VisibleChainAnnotation = visibleChainAnnotation; this.processSecondaryStructure = processSecondaryStructure; + this.externalSecondaryStructure = externalSecStr; } public PDBfile(boolean visibleChainAnnotation, - boolean processSecondaryStructure, String file, String protocol) throws IOException + boolean processSecondaryStructure, boolean externalSecStr, + String file, String protocol) throws IOException { super(false, file, protocol); VisibleChainAnnotation = visibleChainAnnotation; this.processSecondaryStructure = processSecondaryStructure; + this.externalSecondaryStructure = externalSecStr; doParse(); } public PDBfile(boolean visibleChainAnnotation, - boolean processSecondaryStructure, FileParse source) throws IOException + boolean processSecondaryStructure, boolean externalSecStr, + FileParse source) throws IOException { super(false, source); VisibleChainAnnotation = visibleChainAnnotation; this.processSecondaryStructure = processSecondaryStructure; + this.externalSecondaryStructure = externalSecStr; doParse(); } @@ -189,8 +195,7 @@ public class PDBfile extends jalview.io.AlignFile entry.setProperty(new Hashtable()); if (chains.elementAt(i).id != null) { - entry.getProperty().put("CHAIN", - chains.elementAt(i).id); + entry.getProperty().put("CHAIN", chains.elementAt(i).id); } if (inFile != null) { @@ -217,7 +222,7 @@ public class PDBfile extends jalview.io.AlignFile AlignmentAnnotation[] chainannot = chainseq.getAnnotation(); - if (chainannot != null) + if (chainannot != null && VisibleChainAnnotation) { for (int ai = 0; ai < chainannot.length; ai++) { @@ -228,34 +233,34 @@ public class PDBfile extends jalview.io.AlignFile } if (processSecondaryStructure) { - if (rna.size() > 0) - { - try + if (externalSecondaryStructure && rna.size() > 0) { - processPdbFileWithAnnotate3d(rna); - } catch (Exception x) - { - System.err - .println("Exceptions when dealing with RNA in pdb file"); - x.printStackTrace(); + try + { + processPdbFileWithAnnotate3d(rna); + } catch (Exception x) + { + System.err + .println("Exceptions when dealing with RNA in pdb file"); + x.printStackTrace(); + } } - } - ; - if (prot.size() > 0) - { - try + ; + if (prot.size() > 0) { - processPdbFileWithJmol(prot); - } catch (Exception x) - { - System.err - .println("Exceptions from Jmol when processing data in pdb file"); - x.printStackTrace(); + try + { + processPdbFileWithJmol(prot); + } catch (Exception x) + { + System.err + .println("Exceptions from Jmol when processing data in pdb file"); + x.printStackTrace(); + } } } - } } catch (OutOfMemoryError er) { System.out.println("OUT OF MEMORY LOADING PDB FILE"); @@ -277,11 +282,11 @@ public class PDBfile extends jalview.io.AlignFile public static boolean isCalcIdHandled(String calcId) { - return calcId != null - && (calcIdPrefix.equals(calcId)); + return calcId != null && (calcIdPrefix.equals(calcId)); } - public static boolean isCalcIdForFile(AlignmentAnnotation alan, String pdbFile) + public static boolean isCalcIdForFile(AlignmentAnnotation alan, + String pdbFile) { return alan.getCalcId() != null && calcIdPrefix.equals(alan.getCalcId()) @@ -301,19 +306,23 @@ public class PDBfile extends jalview.io.AlignFile { for (SequenceI sq : seqs) { - for (AlignmentAnnotation aa : sq.getAnnotation()) + if (sq.getAnnotation() != null) { - String oldId = aa.getCalcId(); - if (oldId == null) + for (AlignmentAnnotation aa : sq.getAnnotation()) { - oldId = ""; + String oldId = aa.getCalcId(); + if (oldId == null) + { + oldId = ""; + } + aa.setCalcId(calcIdPrefix); + aa.setProperty("PDBID", id); + aa.setProperty("oldCalcId", oldId); } - aa.setCalcId(calcIdPrefix); - aa.setProperty("PDBID", id); - aa.setProperty("oldCalcId", oldId); } } } + private void processPdbFileWithJmol(ArrayList prot) throws Exception { @@ -352,8 +361,8 @@ public class PDBfile extends jalview.io.AlignFile AlignmentI al, String pep, boolean b) { List> replaced = AlignSeq - .replaceMatchingSeqsWith(seqs, - annotations, prot, al, AlignSeq.PEP, false); + .replaceMatchingSeqsWith(seqs, annotations, prot, al, + AlignSeq.PEP, false); for (PDBChain ch : chains) { int p = 0; @@ -371,8 +380,7 @@ public class PDBfile extends jalview.io.AlignFile p = -p - 1; // set shadow entry for chains ch.shadow = (SequenceI) replaced.get(1).get(p); - ch.shadowMap = ((AlignSeq) replaced.get(2) -.get(p)) + ch.shadowMap = ((AlignSeq) replaced.get(2).get(p)) .getMappingFromS1(false); } } @@ -445,7 +453,7 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - chains.elementAt(i).makeResidueList(); + chains.elementAt(i).makeResidueList(VisibleChainAnnotation); } } @@ -490,8 +498,8 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - chains.elementAt(i).setChainColours(Color.getHSBColor( - 1.0f / i, .4f, 1.0f)); + chains.elementAt(i).setChainColours( + Color.getHSBColor(1.0f / i, .4f, 1.0f)); } } diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 307a06f..ba7e520 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -1153,7 +1153,7 @@ public class AlignSeq ap++; } } - if (sq.getAnnotation() != null) + if (sq.getAnnotation() != null && sq.getAnnotation().length > 0) { annotations.addAll(inspos, Arrays.asList(sq.getAnnotation())); } diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 24ed1b4..3b0a23e 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -150,6 +150,7 @@ import org.apache.log4j.SimpleLayout; *
  • FOLLOW_SELECTIONS (true) Controls whether a new alignment view should * respond to selections made in other alignments containing the same sequences. *
  • + *
  • JWS2HOSTURLS comma-separated list of URLs to try for JABAWS services
  • *
  • SHOW_WSDISCOVERY_ERRORS (true) Controls if the web service URL discovery * warning dialog box is displayed.
  • *
  • ANNOTATIONCOLOUR_MIN (orange) Shade used for minimum value of annotation diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 184c267..f80f341 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -24,6 +24,7 @@ import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.util.MessageManager; import jalview.util.Platform; +import jalview.ws.jws2.Jws2Discoverer; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -34,6 +35,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.lang.reflect.Constructor; +import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.net.URLDecoder; @@ -106,40 +108,7 @@ public class Jalview if (aparser.contains("help") || aparser.contains("h")) { - System.out - .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n" - + "-nodisplay\tRun Jalview without User Interface.\n" - + "-props FILE\tUse the given Jalview properties file instead of users default.\n" - + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n" - + "-annotations FILE\tAdd precalculated annotations to the alignment.\n" - + "-tree FILE\tLoad the given newick format tree file onto the alignment\n" - + "-features FILE\tUse the given file to mark features on the alignment.\n" - + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n" - + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n" - + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n" - + "-msf FILE\tCreate alignment file FILE in MSF format.\n" - + "-pileup FILE\tCreate alignment file FILE in Pileup format\n" - + "-pir FILE\tCreate alignment file FILE in PIR format.\n" - + "-blc FILE\tCreate alignment file FILE in BLC format.\n" - + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n" - + "-png FILE\tCreate PNG image FILE from alignment.\n" - + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n" - + "-eps FILE\tCreate EPS file FILE from alignment.\n" - + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n" - + "-noquestionnaire\tTurn off questionnaire check.\n" - + "-nousagestats\tTurn off google analytics tracking for this session.\n" - + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n" - // + - // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)" - + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n" - + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n" - + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n" - + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n" - // + - // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n" - // + "-vses vamsas-session\tJoin session with given URN\n" - + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n" - + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n"); + showUsage(); System.exit(0); } if (aparser.contains("nodisplay") || aparser.contains("nogui") @@ -150,6 +119,20 @@ public class Jalview } Cache.loadProperties(aparser.getValue("props")); // must do this before // anything else! + + final String jabawsUrl = aparser.getValue("jabaws"); + if (jabawsUrl != null) + { + try + { + Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); + } catch (MalformedURLException e) + { + System.err.println("Invalid jabaws parameter: " + jabawsUrl + + " ignored"); + } + } + String defs = aparser.getValue("setprop"); while (defs != null) { @@ -619,6 +602,45 @@ public class Jalview } } + private static void showUsage() + { + System.out + .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n" + + "-nodisplay\tRun Jalview without User Interface.\n" + + "-props FILE\tUse the given Jalview properties file instead of users default.\n" + + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n" + + "-annotations FILE\tAdd precalculated annotations to the alignment.\n" + + "-tree FILE\tLoad the given newick format tree file onto the alignment\n" + + "-features FILE\tUse the given file to mark features on the alignment.\n" + + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n" + + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n" + + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n" + + "-msf FILE\tCreate alignment file FILE in MSF format.\n" + + "-pileup FILE\tCreate alignment file FILE in Pileup format\n" + + "-pir FILE\tCreate alignment file FILE in PIR format.\n" + + "-blc FILE\tCreate alignment file FILE in BLC format.\n" + + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n" + + "-png FILE\tCreate PNG image FILE from alignment.\n" + + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n" + + "-eps FILE\tCreate EPS file FILE from alignment.\n" + + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n" + + "-noquestionnaire\tTurn off questionnaire check.\n" + + "-nousagestats\tTurn off google analytics tracking for this session.\n" + + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n" + // + + // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)" + + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n" + + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n" + + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n" + + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n" + + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n" + // + + // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n" + // + "-vses vamsas-session\tJoin session with given URN\n" + + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n" + + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n"); + } + private static void startUsageStats(final Desktop desktop) { /** diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 0abd31b..ae8bc98 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -1269,7 +1269,7 @@ public class JalviewLite extends Applet implements public static boolean debug = false; - static String builddate = null, version = null; + static String builddate = null, version = null, installation = null; private static void initBuildDetails() { @@ -1277,6 +1277,7 @@ public class JalviewLite extends Applet implements { builddate = "unknown"; version = "test"; + installation = "Webstart"; java.net.URL url = JalviewLite.class .getResource("/.build_properties"); if (url != null) @@ -1296,6 +1297,10 @@ public class JalviewLite extends Applet implements { builddate = line.substring(line.indexOf("=") + 1); } + if (line.indexOf("INSTALLATION") > -1) + { + installation = line.substring(line.indexOf("=") + 1); + } } } catch (Exception ex) { @@ -1311,6 +1316,12 @@ public class JalviewLite extends Applet implements return builddate; } + public static String getInstallation() + { + initBuildDetails(); + return installation; + } + public static String getVersion() { initBuildDetails(); @@ -1360,6 +1371,7 @@ public class JalviewLite extends Applet implements System.err.println("JalviewLite Version " + getVersion()); System.err.println("Build Date : " + getBuildDate()); + System.err.println("Installation : " + getInstallation()); } String externalsviewer = getParameter("externalstructureviewer"); diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index b2d4f0f..4057773 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -147,7 +147,9 @@ public class Alignment implements AlignmentI public SequenceI[] getSequencesArray() { if (sequences == null) + { return null; + } synchronized (sequences) { return sequences.toArray(new SequenceI[sequences.size()]); @@ -211,7 +213,9 @@ public class Alignment implements AlignmentI } } if (hiddenSequences != null) + { hiddenSequences.adjustHeightSequenceAdded(); + } } /** @@ -245,7 +249,9 @@ public class Alignment implements AlignmentI public void finalize() { if (getDataset() != null) + { getDataset().removeAlignmentRef(); + } dataset = null; sequences = null; @@ -754,7 +760,9 @@ public class Alignment implements AlignmentI continue; } if (tIndex < temp.length) + { temp[tIndex++] = annotations[i]; + } } if (swap) @@ -950,6 +958,27 @@ public class Alignment implements AlignmentI else if (dataset == null && data != null) { dataset = data; + for (int i = 0; i < getHeight(); i++) + { + SequenceI currentSeq = getSequenceAt(i); + SequenceI dsq = currentSeq.getDatasetSequence(); + if (dsq == null) + { + dsq = currentSeq.createDatasetSequence(); + dataset.addSequence(dsq); + } + else + { + while (dsq.getDatasetSequence() != null) + { + dsq = dsq.getDatasetSequence(); + } + if (dataset.findIndex(dsq) == -1) + { + dataset.addSequence(dsq); + } + } + } } dataset.addAlignmentRef(); } @@ -1150,7 +1179,9 @@ public class Alignment implements AlignmentI public void setProperty(Object key, Object value) { if (alignmentProperties == null) + { alignmentProperties = new Hashtable(); + } alignmentProperties.put(key, value); } @@ -1159,9 +1190,13 @@ public class Alignment implements AlignmentI public Object getProperty(Object key) { if (alignmentProperties != null) + { return alignmentProperties.get(key); + } else + { return null; + } } @Override @@ -1183,7 +1218,9 @@ public class Alignment implements AlignmentI public void addCodonFrame(AlignedCodonFrame codons) { if (codons == null) + { return; + } if (codonFrameList == null) { codonFrameList = new AlignedCodonFrame[] @@ -1217,15 +1254,21 @@ public class Alignment implements AlignmentI public AlignedCodonFrame[] getCodonFrame(SequenceI seq) { if (seq == null || codonFrameList == null) + { return null; + } Vector cframes = new Vector(); for (int f = 0; f < codonFrameList.length; f++) { if (codonFrameList[f].involvesSequence(seq)) + { cframes.addElement(codonFrameList[f]); + } } if (cframes.size() == 0) + { return null; + } AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()]; cframes.copyInto(cfr); return cfr; @@ -1252,7 +1295,9 @@ public class Alignment implements AlignmentI public boolean removeCodonFrame(AlignedCodonFrame codons) { if (codons == null || codonFrameList == null) + { return false; + } boolean removed = false; int i = 0, iSize = codonFrameList.length; while (i < iSize) diff --git a/src/jalview/datamodel/HiddenSequences.java b/src/jalview/datamodel/HiddenSequences.java index aefb5cc..bfeafd6 100755 --- a/src/jalview/datamodel/HiddenSequences.java +++ b/src/jalview/datamodel/HiddenSequences.java @@ -20,7 +20,9 @@ */ package jalview.datamodel; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; public class HiddenSequences { @@ -143,34 +145,34 @@ public class HiddenSequences alignment.deleteSequence(sequence); } - public Vector showAll( + public List showAll( Map hiddenRepSequences) { - Vector revealedSeqs = new Vector(); + List revealedSeqs = new ArrayList(); for (int i = 0; i < hiddenSequences.length; i++) { if (hiddenSequences[i] != null) { - Vector tmp = showSequence(i, hiddenRepSequences); - for (int t = 0; t < tmp.size(); t++) + List tmp = showSequence(i, hiddenRepSequences); + for (SequenceI seq : tmp) { - revealedSeqs.addElement(tmp.elementAt(t)); + revealedSeqs.add(seq); } } } return revealedSeqs; } - public Vector showSequence(int alignmentIndex, + public List showSequence(int alignmentIndex, Map hiddenRepSequences) { - Vector revealedSeqs = new Vector(); + List revealedSeqs = new ArrayList(); SequenceI repSequence = alignment.getSequenceAt(alignmentIndex); if (repSequence != null && hiddenRepSequences != null && hiddenRepSequences.containsKey(repSequence)) { hiddenRepSequences.remove(repSequence); - revealedSeqs.addElement(repSequence); + revealedSeqs.add(repSequence); } int start = adjustForHiddenSeqs(alignmentIndex - 1); @@ -192,7 +194,7 @@ public class HiddenSequences { if (seq.getLength() > 0) { - revealedSeqs.addElement(seq); + revealedSeqs.add(seq); asequences.add(alignmentIndex, seq); } else diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 090b61d..fb03f04 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -343,8 +343,7 @@ public abstract class JalviewChimeraBinding extends public void colourByChain() { colourBySequence = false; - // this is not a valid Chimera command; is there one? Menu option hidden - evalStateCommand("select *;color chain",false); + evalStateCommand("rainbow chain", false); } public void colourByCharge() diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index cfac4ef..02865e1 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -144,9 +144,6 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, _alignwith = new Vector(); } - // no colour by chain command in Chimera? - chainColour.setVisible(false); - // save As not yet implemented savemenu.setVisible(false); diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index faffd89..007fefd 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -26,6 +26,7 @@ import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; +import jalview.structure.StructureSelectionManager; import jalview.util.ImageMaker; import jalview.util.MessageManager; import jalview.ws.params.ParamManager; @@ -286,7 +287,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements instance = this; doVamsasClientCheck(); doGroovyCheck(); - + doConfigureStructurePrefs(); setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE", @@ -322,8 +323,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements } jconsole = new Console(this, showjconsole); // add essential build information - jconsole.setHeader("Jalview Desktop " + jconsole.setHeader("Jalview Version: " + jalview.bin.Cache.getProperty("VERSION") + "\n" + + "Jalview Installation: " + + jalview.bin.Cache.getDefault("INSTALLATION", "unknown") + + "\n" + "Build Date: " + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n" + "Java version: " + System.getProperty("java.version") + "\n" @@ -416,6 +420,27 @@ public class Desktop extends jalview.jbgui.GDesktop implements }); } + public void doConfigureStructurePrefs() + { + // configure services + StructureSelectionManager ssm = StructureSelectionManager + .getStructureSelectionManager(this); + if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true)) + { + ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault( + Preferences.ADD_TEMPFACT_ANN, true)); + ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(Preferences.STRUCT_FROM_PDB, true)); + ssm.setSecStructServices(jalview.bin.Cache.getDefault(Preferences.USE_RNAVIEW, + true)); + } + else + { + ssm.setAddTempFacAnnot(false); + ssm.setProcessSecondaryStructure(false); + ssm.setSecStructServices(false); + } + } + public void checkForNews() { final Desktop me = this; @@ -2580,7 +2605,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements + ermsg + "" + "

    It may be that you have invalid JABA URLs
    in your web service preferences," - + " or mis-configured HTTP proxy settings.

    " + + "
    or as a command-line argument, or mis-configured HTTP proxy settings.

    " + "

    Check the Connections and Web services tab
    of the" + " Tools->Preferences dialog box to change them.

    "), "Web Service Configuration Problem", diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 693e6fe..2210148 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -27,6 +27,7 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.gui.Help.HelpId; import jalview.io.JalviewFileChooser; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.GraduatedColor; @@ -61,6 +62,7 @@ import java.util.Iterator; import java.util.List; import java.util.Vector; +import javax.help.HelpSetException; import javax.swing.AbstractCellEditor; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -132,7 +134,19 @@ public class FeatureSettings extends JPanel ex.printStackTrace(); } - table = new JTable(); + table = new JTable() { + @Override + public String getToolTipText(MouseEvent e) { + if (table.columnAtPoint(e.getPoint()) == 0) { + /* + * Tooltip for feature name only + */ + return JvSwingUtils.wrapTooltip(true, + MessageManager.getString("label.feature_settings_click_drag")); + } + return null; + } + }; table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12)); table.setFont(new Font("Verdana", Font.PLAIN, 12)); table.setDefaultRenderer(Color.class, new ColorRenderer()); @@ -201,8 +215,8 @@ public class FeatureSettings extends JPanel } } }); - table.setToolTipText(JvSwingUtils - .wrapTooltip(true, MessageManager.getString("label.feature_settings_click_drag"))); +// table.setToolTipText(JvSwingUtils.wrapTooltip(true, +// MessageManager.getString("label.feature_settings_click_drag"))); scrollPane.setViewportView(table); dassourceBrowser = new DasSourceBrowser(this); @@ -572,7 +586,9 @@ public class FeatureSettings extends JPanel || ((Boolean) fr.featureGroups.get(group)).booleanValue()) { if (group != null) + { checkGroupState(group); + } type = tmpfeatures[index].getType(); if (!visibleChecks.contains(type)) { @@ -610,7 +626,9 @@ public class FeatureSettings extends JPanel if (fr.renderOrder != null) { if (!handlingUpdate) + { fr.findAllFeatures(groupChanged != null); // prod to update + } // colourschemes. but don't // affect display // First add the checks in the previous render order, @@ -691,12 +709,18 @@ public class FeatureSettings extends JPanel { order[i] = fr.getOrder(data[i][0].toString()); if (order[i] < 0) + { order[i] = fr.setOrder(data[i][0].toString(), i / order.length); + } if (i > 1) + { sort = sort || order[i - 1] > order[i]; + } } if (sort) + { jalview.util.QuickSort.sort(order, data); + } } void load() @@ -887,7 +911,9 @@ public class FeatureSettings extends JPanel public void orderByAvWidth() { if (table == null || table.getModel() == null) + { return; + } Object[][] data = ((FeatureTableModel) table.getModel()).getData(); float[] width = new float[data.length]; float[] awidth; @@ -909,7 +935,9 @@ public class FeatureSettings extends JPanel width[i] = 0; } if (max < width[i]) + { max = width[i]; + } } boolean sort = false; for (int i = 0; i < width.length; i++) @@ -929,11 +957,15 @@ public class FeatureSettings extends JPanel fr.setOrder(data[i][0].toString(), width[i]); // store for later } if (i > 0) + { sort = sort || width[i - 1] > width[i]; + } } if (sort) + { jalview.util.QuickSort.sort(width, data); // update global priority order + } updateFeatureRenderer(data, false); table.repaint(); @@ -1001,7 +1033,9 @@ public class FeatureSettings extends JPanel JButton sortByDens = new JButton(); - JPanel transbuttons = new JPanel(new GridLayout(4, 1)); + JButton help = new JButton(); + + JPanel transbuttons = new JPanel(new GridLayout(5, 1)); private void jbInit() throws Exception { @@ -1047,6 +1081,21 @@ public class FeatureSettings extends JPanel sortByDens(null); } }); + help.setFont(JvSwingUtils.getLabelFont()); + help.setText(MessageManager.getString("action.help")); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + try + { + Help.showHelpWindow(HelpId.SequenceFeatureSettings); + } catch (HelpSetException e1) + { + e1.printStackTrace(); + } + } + }); cancel.setFont(JvSwingUtils.getLabelFont()); cancel.setText(MessageManager.getString("action.cancel")); cancel.addActionListener(new ActionListener() @@ -1094,6 +1143,8 @@ public class FeatureSettings extends JPanel }); transparency.setMaximum(70); + transparency.setToolTipText(MessageManager + .getString("label.transparency_tip")); fetchDAS.setText(MessageManager.getString("label.fetch_das_features")); fetchDAS.addActionListener(new ActionListener() { @@ -1129,6 +1180,9 @@ public class FeatureSettings extends JPanel transbuttons.add(invert); transbuttons.add(sortByScore); transbuttons.add(sortByDens); + transbuttons.add(help); + JPanel sliderPanel = new JPanel(); + sliderPanel.add(transparency); transPanel.add(transparency); transPanel.add(transbuttons); buttonPanel.add(ok); diff --git a/src/jalview/gui/Help.java b/src/jalview/gui/Help.java index dac17c0..ae3f457 100644 --- a/src/jalview/gui/Help.java +++ b/src/jalview/gui/Help.java @@ -2,6 +2,7 @@ package jalview.gui; import java.net.URL; +import javax.help.BadIDException; import javax.help.HelpBroker; import javax.help.HelpSet; import javax.help.HelpSetException; @@ -14,6 +15,23 @@ import javax.help.HelpSetException; */ public class Help { + public enum HelpId + { + Home("home"), SequenceFeatureSettings("seqfeatures.settings"); + + private String id; + + private HelpId(String loc) + { + this.id = loc; + } + + @Override + public String toString() + { + return this.id; + } + } private static final long HALF_A_MO = 500; // half a second @@ -33,10 +51,11 @@ public class Help * * This is a workaround for issue JAL-914 - both Desktop and AlignFrame * responding to F1 key, resulting in duplicate help windows opened. + * @param id TODO * * @throws HelpSetException */ - public static void showHelpWindow() throws HelpSetException + public static void showHelpWindow(HelpId id) throws HelpSetException { long timeNow = System.currentTimeMillis(); @@ -48,8 +67,21 @@ public class Help HelpSet hs = new HelpSet(cl, url); HelpBroker hb = hs.createHelpBroker(); - hb.setCurrentID("home"); + try + { + hb.setCurrentID(id.toString()); + } catch (BadIDException bad) + { + System.out.println("Bad help link: " + id.toString() + + ": must match a target in help.jhm"); + throw bad; + } hb.setDisplayed(true); } } + + public static void showHelpWindow() throws HelpSetException + { + showHelpWindow(HelpId.Home); + } } diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index ab4f94f..b082bc6 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -291,17 +291,7 @@ public class Preferences extends GPreferences @Override public void actionPerformed(ActionEvent e) { - if (chimeraPath.getText().trim().length() > 0) - { - File f = new File(chimeraPath.getText()); - if (!f.canExecute()) - { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.invalid_path"), - MessageManager.getString("label.invalid_name"), - JOptionPane.ERROR_MESSAGE); - } - } + validateChimeraPath(); } }); @@ -376,6 +366,11 @@ public class Preferences extends GPreferences */ public void ok_actionPerformed(ActionEvent e) { + if (!validateSettings()) + { + return; + } + /* * Save Visual settings */ @@ -590,9 +585,8 @@ public class Preferences extends GPreferences dasSource.saveProperties(Cache.applicationProperties); wsPrefs.updateAndRefreshWsMenuConfig(false); - Cache.saveProperties(); - + Desktop.instance.doConfigureStructurePrefs(); try { frame.setClosed(true); @@ -602,6 +596,27 @@ public class Preferences extends GPreferences } /** + * Do any necessary validation before saving settings. + * + * @return + */ + private boolean validateSettings() + { + if (!validateStructure()) + { + structureTab.requestFocusInWindow(); + return false; + } + return true; + } + + @Override + protected boolean validateStructure() + { + return validateChimeraPath(); + + } + /** * DOCUMENT ME! */ public void startupFileTextfield_mouseClicked() @@ -843,4 +858,25 @@ public class Preferences extends GPreferences userIdWidthlabel.setEnabled(!autoIdWidth.isSelected()); } + /** + * Returns true if chimera path is to a valid executable, else show an error + * dialog. + */ + private boolean validateChimeraPath() + { + if (chimeraPath.getText().trim().length() > 0) + { + File f = new File(chimeraPath.getText()); + if (!f.canExecute()) + { + JOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.getString("label.invalid_chimera_path"), + MessageManager.getString("label.invalid_name"), + JOptionPane.ERROR_MESSAGE); + return false; + } + } + return true; + } + } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 02c6c16..61782b4 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -20,21 +20,38 @@ */ package jalview.gui; -import java.util.*; -import java.util.List; - -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; - -import jalview.commands.*; -import jalview.datamodel.*; +import jalview.commands.EditCommand; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SearchResults; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; import jalview.io.SequenceAnnotationReport; -import jalview.schemes.*; -import jalview.structure.*; +import jalview.schemes.ResidueProperties; +import jalview.structure.SelectionListener; +import jalview.structure.SelectionSource; +import jalview.structure.SequenceListener; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.util.List; +import java.util.Vector; + +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.ToolTipManager; + /** * DOCUMENT ME! * @@ -245,7 +262,9 @@ public class SeqPanel extends JPanel implements MouseListener, .containsKey(features[i].featureGroup) && !((Boolean) seqCanvas.fr.featureGroups .get(features[i].featureGroup)).booleanValue()) + { continue; + } if ((features[i].getBegin() <= res) && (features[i].getEnd() >= res)) @@ -695,7 +714,9 @@ public class SeqPanel extends JPanel implements MouseListener, pos = setStatusMessage(sequence, res, seq); if (ssm != null && pos > -1) + { mouseOverSequence(sequence, res, pos); + } tooltipText.setLength(6); // Cuts the buffer back to @@ -746,7 +767,8 @@ public class SeqPanel extends JPanel implements MouseListener, if (lastTooltip == null || !lastTooltip.equals(tooltipText.toString())) { - setToolTipText(tooltipText.toString()); + setToolTipText(JvSwingUtils.wrapTooltip(true, + tooltipText.toString())); lastTooltip = tooltipText.toString(); } diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 8c889c9..4a74c9c 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -436,7 +436,7 @@ public class WsJobParameters extends JPanel implements ItemListener, protected void revert_actionPerformed(ActionEvent e) { reInitDialog(lastParmSet); - + updateWebServiceMenus(); } protected void update_actionPerformed(ActionEvent e) @@ -465,6 +465,7 @@ public class WsJobParameters extends JPanel implements ItemListener, _deleteUserPreset(lastParmSet); } reInitDialog(null); // service default + updateWebServiceMenus(); } protected void create_actionPerformed(ActionEvent e) @@ -475,7 +476,9 @@ public class WsJobParameters extends JPanel implements ItemListener, _storeCurrentPreset(curname); lastParmSet = curname; isUserPreset = true; + reInitDialog(curname); initArgSetModified(); + updateWebServiceMenus(); } else { @@ -953,7 +956,7 @@ public class WsJobParameters extends JPanel implements ItemListener, { Vector services = new Vector(); services.addElement(args[p++]); - Jws2Discoverer.setServiceUrls(services); + Jws2Discoverer.getDiscoverer().setServiceUrls(services); } try { @@ -1295,7 +1298,18 @@ public class WsJobParameters extends JPanel implements ItemListener, SetNamePanel.validate(); validate(); settingDialog = false; + } + /** + * Rebuild the AlignFrame web service menus (after add/delete of a preset + * option). + */ + protected void updateWebServiceMenus() + { + for (AlignFrame alignFrame : Desktop.getAlignframes()) + { + alignFrame.BuildWebServiceMenu(); + } } String curSetName = null; diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java index de89241..527750c 100644 --- a/src/jalview/gui/WsPreferences.java +++ b/src/jalview/gui/WsPreferences.java @@ -33,6 +33,7 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; +import java.util.List; import java.util.Vector; import javax.swing.JLabel; @@ -52,7 +53,9 @@ public class WsPreferences extends GWsPreferences initFromPreferences(); } - Vector wsUrls, oldUrls, rsbsUrls, oldRsbsUrls; + List wsUrls; + + Vector oldUrls, rsbsUrls, oldRsbsUrls; private boolean needWsMenuUpdate; @@ -62,8 +65,8 @@ public class WsPreferences extends GWsPreferences private void initFromPreferences() { - wsUrls = jalview.ws.jws2.Jws2Discoverer.getServiceUrls(); - if (wsUrls != null) + wsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls(); + if (!wsUrls.isEmpty()) { oldUrls = new Vector(wsUrls); } @@ -235,7 +238,7 @@ public class WsPreferences extends GWsPreferences private void updateServiceList() { - jalview.ws.jws2.Jws2Discoverer.setServiceUrls(wsUrls); + Jws2Discoverer.getDiscoverer().setServiceUrls(wsUrls); } private void updateRsbsServiceList() @@ -256,7 +259,7 @@ public class WsPreferences extends GWsPreferences int sel = wsList.getSelectedRow(); if (sel > -1) { - wsUrls.removeElementAt(sel); + wsUrls.remove(sel); update++; updateList(); } @@ -274,21 +277,22 @@ public class WsPreferences extends GWsPreferences int sel = wsList.getSelectedRow(); if (sel > -1) { - String url = editUrl(wsUrls.elementAt(sel), MessageManager.getString("label.edit_jabaws_url")); + String url = editUrl(wsUrls.get(sel), + MessageManager.getString("label.edit_jabaws_url")); if (url != null) { int present = wsUrls.indexOf(url); if (present == -1) { update++; - wsUrls.setElementAt(url, sel); + wsUrls.set(sel, url); updateList(); } else { if (present != sel) { - wsUrls.removeElementAt(sel); + wsUrls.remove(sel); updateList(); } } @@ -406,8 +410,8 @@ public class WsPreferences extends GWsPreferences if (p > -1 && p < wsUrls.size() - 1) { String t = wsUrls.get(p + 1); - wsUrls.setElementAt(wsUrls.elementAt(p), p + 1); - wsUrls.setElementAt(t, p); + wsUrls.set(p + 1, wsUrls.get(p)); + wsUrls.set(p, t); updateList(); wsList.getSelectionModel().setSelectionInterval(p + 1, p + 1); update++; @@ -428,8 +432,8 @@ public class WsPreferences extends GWsPreferences if (p > 0) { String t = wsUrls.get(p - 1); - wsUrls.setElementAt(wsUrls.elementAt(p), p - 1); - wsUrls.setElementAt(t, p); + wsUrls.set(p - 1, wsUrls.get(p)); + wsUrls.set(p, t); updateList(); wsList.getSelectionModel().setSelectionInterval(p - 1, p - 1); update++; @@ -487,7 +491,7 @@ public class WsPreferences extends GWsPreferences if (validate == JOptionPane.OK_OPTION) { - if (jalview.ws.jws2.Jws2Discoverer.testServiceUrl(foo)) + if (Jws2Discoverer.testServiceUrl(foo)) { return foo.toString(); } @@ -498,7 +502,7 @@ public class WsPreferences extends GWsPreferences Desktop.desktop, "The Server '" + foo.toString() - + "' failed validation, do you want to proceed and add it anyway? ", + + "' failed validation,\ndo you want to add it anyway? ", "Server Validation Failed", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null); @@ -544,11 +548,11 @@ public class WsPreferences extends GWsPreferences int selind = wsList.getSelectedRow(); if (selind > -1) { - wsUrls.insertElementAt(url, selind); + wsUrls.add(selind, url); } else { - wsUrls.addElement(url); + wsUrls.add(url); } update++; updateList(); @@ -651,8 +655,8 @@ public class WsPreferences extends GWsPreferences @Override protected void resetWs_actionPerformed(ActionEvent e) { - jalview.ws.jws2.Jws2Discoverer.setServiceUrls(null); - Vector nwsUrls = jalview.ws.jws2.Jws2Discoverer.getServiceUrls(); + Jws2Discoverer.getDiscoverer().setServiceUrls(null); + List nwsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls(); if (!wsUrls.equals(nwsUrls)) { update++; diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index 5366cb4..d3b19fa 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -123,6 +123,21 @@ public class AppletFormatAdapter public static String CLASSLOADER = "ClassLoader"; + /** + * add jalview-derived non-secondary structure annotation from PDB structure + */ + boolean annotFromStructure = false; + + /** + * add secondary structure from PDB data with built-in algorithms + */ + boolean localSecondaryStruct = false; + + /** + * process PDB data with web services + */ + boolean serviceSecondaryStruct = false; + AlignFile afile = null; String inFile; @@ -236,7 +251,8 @@ public class AppletFormatAdapter } else if (format.equals("PDB")) { - afile = new MCview.PDBfile(true,true,inFile, type); + afile = new MCview.PDBfile(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct, inFile, type); // Uncomment to test Jmol data based PDB processing: JAL-1213 // afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type); } @@ -357,7 +373,8 @@ public class AppletFormatAdapter } else if (format.equals("PDB")) { - afile = new MCview.PDBfile(true,true,source); + afile = new MCview.PDBfile(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct, source); } else if (format.equals("STH")) { diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index c2a317a..8ca0c35 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -21,7 +21,13 @@ package jalview.io; import jalview.api.AlignViewportI; -import jalview.datamodel.*; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; /** * Additional formatting methods used by the application in a number of places. @@ -32,6 +38,26 @@ import jalview.datamodel.*; public class FormatAdapter extends AppletFormatAdapter { + public FormatAdapter() + { + super(); + if (jalview.bin.Cache.getDefault("STRUCT_FROM_PDB", true)) + { + annotFromStructure = jalview.bin.Cache.getDefault("ADD_TEMPFACT_ANN", + true); + localSecondaryStruct = jalview.bin.Cache.getDefault("ADD_SS_ANN", + true); + serviceSecondaryStruct = jalview.bin.Cache.getDefault("USE_RNAVIEW", + true); + } + else + { + // disable all PDB annotation options + annotFromStructure = false; + localSecondaryStruct = false; + serviceSecondaryStruct = false; + } + } public String formatSequences(String format, SequenceI[] seqs, String[] omitHiddenColumns) { @@ -154,8 +180,10 @@ public class FormatAdapter extends AppletFormatAdapter public boolean getCacheSuffixDefault(String format) { if (isValidFormat(format)) + { return jalview.bin.Cache.getDefault(format.toUpperCase() + "_JVSUFFIX", true); + } return false; } diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index a232377..5569c24 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -26,6 +26,7 @@ import jalview.util.MessageManager; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; @@ -36,6 +37,7 @@ import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -45,6 +47,7 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; +import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; @@ -56,6 +59,8 @@ import javax.swing.SwingConstants; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -128,8 +133,10 @@ public class GPreferences extends JPanel protected JCheckBox showNpTooltip = new JCheckBox(); /* - * Annotations tab components + * Structure tab and components */ + protected JPanel structureTab; + protected JCheckBox structFromPdb = new JCheckBox(); protected JCheckBox useRnaView = new JCheckBox(); @@ -239,7 +246,7 @@ public class GPreferences extends JPanel */ private void jbInit() throws Exception { - JTabbedPane tabbedPane = new JTabbedPane(); + final JTabbedPane tabbedPane = new JTabbedPane(); this.setLayout(new BorderLayout()); JPanel okCancelPanel = initOkCancelPanel(); this.add(tabbedPane, BorderLayout.CENTER); @@ -273,6 +280,31 @@ public class GPreferences extends JPanel */ wsTab.setLayout(new BorderLayout()); tabbedPane.add(wsTab, MessageManager.getString("label.web_services")); + + /* + * Handler to validate a tab before leaving it - currently only for + * Structure. + */ + tabbedPane.addChangeListener(new ChangeListener() + { + private Component lastTab; + + @Override + public void stateChanged(ChangeEvent e) + { + if (lastTab == structureTab + && tabbedPane.getSelectedComponent() != structureTab) + { + if (!validateStructure()) + { + tabbedPane.setSelectedComponent(structureTab); + return; + } + } + lastTab = tabbedPane.getSelectedComponent(); + } + + }); } /** @@ -691,7 +723,8 @@ public class GPreferences extends JPanel */ private JPanel initStructureTab() { - JPanel structureTab = new JPanel(); + structureTab = new JPanel(); + structureTab.setBorder(new TitledBorder(MessageManager .getString("label.structure_options"))); structureTab.setLayout(null); @@ -756,20 +789,81 @@ public class GPreferences extends JPanel pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11)); pathLabel.setHorizontalAlignment(SwingConstants.LEFT); pathLabel.setText(MessageManager.getString("label.chimera_path")); - pathLabel.setToolTipText(MessageManager - .getString("label.chimera_path_tip")); + final String tooltip = JvSwingUtils.wrapTooltip(true, + MessageManager.getString("label.chimera_path_tip")); + pathLabel.setToolTipText(tooltip); pathLabel.setBounds(new Rectangle(10, ypos, 140, height)); structureTab.add(pathLabel); chimeraPath.setFont(verdana11); chimeraPath.setText(""); chimeraPath.setBounds(new Rectangle(160, ypos, 300, height)); + chimeraPath.addMouseListener(new MouseAdapter() + { + @Override + public void mouseClicked(MouseEvent e) + { + if (e.getClickCount() == 2) + { + String chosen = openFileChooser(); + if (chosen != null) + { + chimeraPath.setText(chosen); + } + } + } + }); structureTab.add(chimeraPath); return structureTab; } /** + * Show a dialog for the user to choose a file. Returns the chosen path, or + * null on Cancel. + * + * @return + */ + protected String openFileChooser() + { + String choice = null; + JFileChooser chooser = new JFileChooser(); + + // chooser.setFileView(new JalviewFileView()); + chooser.setDialogTitle(MessageManager + .getString("label.open_local_file")); + chooser.setToolTipText(MessageManager.getString("action.open")); + + int value = chooser.showOpenDialog(this); + + if (value == JFileChooser.APPROVE_OPTION) + { + choice = chooser.getSelectedFile().getPath(); + } + return choice; + } + + /** + * Validate the structure tab preferences; if invalid, set focus on this tab. + * + * @param e + */ + protected boolean validateStructure(FocusEvent e) + { + if (!validateStructure()) + { + e.getComponent().requestFocusInWindow(); + return false; + } + return true; + } + + protected boolean validateStructure() + { + return false; + } + + /** * Initialises the Visual tabbed panel. * * @return diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index ac2897d..4359879 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -46,6 +46,70 @@ public class StructureSelectionManager StructureMapping[] mappings; + private boolean processSecondaryStructure = false, + secStructServices = false, addTempFacAnnot = false; + + /** + * @return true if will try to use external services for processing secondary + * structure + */ + public boolean isSecStructServices() + { + return secStructServices; + } + + /** + * control use of external services for processing secondary structure + * + * @param secStructServices + */ + public void setSecStructServices(boolean secStructServices) + { + this.secStructServices = secStructServices; + } + + /** + * flag controlling addition of any kind of structural annotation + * + * @return true if temperature factor annotation will be added + */ + public boolean isAddTempFacAnnot() + { + return addTempFacAnnot; + } + + /** + * set flag controlling addition of structural annotation + * + * @param addTempFacAnnot + */ + public void setAddTempFacAnnot(boolean addTempFacAnnot) + { + this.addTempFacAnnot = addTempFacAnnot; + } + + /** + * + * @return if true, the structure manager will attempt to add secondary + * structure lines for unannotated sequences + */ + + public boolean isProcessSecondaryStructure() + { + return processSecondaryStructure; + } + + /** + * Control whether structure manager will try to annotate mapped sequences + * with secondary structure from PDB data. + * + * @param enable + */ + public void setProcessSecondaryStructure(boolean enable) + { + processSecondaryStructure = enable; + } + /** * debug function - write all mappings to stdout */ @@ -245,7 +309,7 @@ public class StructureSelectionManager * the tried and tested MCview pdb mapping */ MCview.PDBfile pdb = null; - boolean parseSecStr=true; + boolean parseSecStr = processSecondaryStructure; if (isPDBFileRegistered(pdbFile)) { for (SequenceI sq : sequence) @@ -274,7 +338,8 @@ public class StructureSelectionManager } try { - pdb = new MCview.PDBfile(true, parseSecStr, pdbFile, protocol); + pdb = new MCview.PDBfile(addTempFacAnnot, parseSecStr, + secStructServices, pdbFile, protocol); if (pdb.id != null && pdb.id.trim().length() > 0 && AppletFormatAdapter.FILE.equals(protocol)) { diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 0fa4a3c..1b42faf 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -20,7 +20,6 @@ */ package jalview.viewmodel; -import jalview.analysis.AAFrequency; import jalview.analysis.Conservation; import jalview.api.AlignCalcManagerI; import jalview.api.AlignViewportI; @@ -35,7 +34,6 @@ import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.schemes.Blosum62ColourScheme; -import jalview.schemes.ClustalxColourScheme; import jalview.schemes.ColourSchemeI; import jalview.schemes.PIDColourScheme; import jalview.schemes.ResidueProperties; @@ -447,7 +445,9 @@ public abstract class AlignmentViewport implements AlignViewportI AlignmentAnnotation alignmentAnnotation) { if (!alignmentAnnotation.autoCalculated) + { return false; + } if (calculator.workingInvolvedWith(alignmentAnnotation)) { // System.err.println("grey out ("+alignmentAnnotation.label+")"); @@ -899,11 +899,12 @@ public abstract class AlignmentViewport implements AlignViewportI selectionGroup = new SequenceGroup(); selectionGroup.setEndRes(alignment.getWidth() - 1); } - Vector tmp = alignment.getHiddenSequences().showAll( + List tmp = alignment.getHiddenSequences().showAll( hiddenRepSequences); - for (int t = 0; t < tmp.size(); t++) + for (SequenceI seq : tmp) { - selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false); + selectionGroup.addSequence(seq, false); + setSequenceAnnotationsVisible(seq, true); } hasHiddenRows = false; @@ -918,7 +919,8 @@ public abstract class AlignmentViewport implements AlignViewportI public void showSequence(int index) { - Vector tmp = alignment.getHiddenSequences().showSequence(index, + List tmp = alignment.getHiddenSequences().showSequence( + index, hiddenRepSequences); if (tmp.size() > 0) { @@ -928,9 +930,10 @@ public abstract class AlignmentViewport implements AlignViewportI selectionGroup.setEndRes(alignment.getWidth() - 1); } - for (int t = 0; t < tmp.size(); t++) + for (SequenceI seq : tmp) { - selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false); + selectionGroup.addSequence(seq, false); + setSequenceAnnotationsVisible(seq, true); } // JBPNote: refactor: only update flag if we modified visiblity (used to // do this regardless) @@ -964,12 +967,30 @@ public abstract class AlignmentViewport implements AlignViewportI for (int i = 0; i < seq.length; i++) { alignment.getHiddenSequences().hideSequence(seq[i]); + setSequenceAnnotationsVisible(seq[i], false); } hasHiddenRows = true; firePropertyChange("alignment", null, alignment.getSequences()); } } + /** + * Set visibility for any annotations for the given sequence. + * + * @param sequenceI + */ + protected void setSequenceAnnotationsVisible(SequenceI sequenceI, + boolean visible) + { + for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation()) + { + if (ann.sequenceRef == sequenceI) + { + ann.visible = visible; + } + } + } + public void hideRepSequences(SequenceI repSequence, SequenceGroup sg) { int sSize = sg.getSize(); diff --git a/src/jalview/ws/jws1/JPredThread.java b/src/jalview/ws/jws1/JPredThread.java index 85969fc..4e95b14 100644 --- a/src/jalview/ws/jws1/JPredThread.java +++ b/src/jalview/ws/jws1/JPredThread.java @@ -20,17 +20,26 @@ */ package jalview.ws.jws1; -import java.util.*; - -import jalview.analysis.*; -import jalview.bin.*; -import jalview.datamodel.*; -import jalview.gui.*; -import jalview.io.*; -import jalview.util.*; +import jalview.analysis.AlignSeq; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.WebserviceInfo; +import jalview.io.FormatAdapter; +import jalview.util.Comparison; +import jalview.util.MessageManager; import jalview.ws.AWsJob; import jalview.ws.JobStateSummary; import jalview.ws.WSClientI; + +import java.util.Hashtable; +import java.util.List; + import vamsas.objects.simple.JpredResult; class JPredThread extends JWS1Thread implements WSClientI @@ -138,14 +147,21 @@ class JPredThread extends JWS1Thread implements WSClientI sqs[i] = al.getSequenceAt(i); } if (!jalview.analysis.SeqsetUtils.deuniquify( - (Hashtable) SequenceInfo, sqs)) + SequenceInfo, sqs)) { throw (new Exception(MessageManager.getString("exception.couldnt_recover_sequence_properties_for_alignment"))); } } FirstSeq = 0; - al.setDataset(null); + if (currentView.getDataset() != null) + { + al.setDataset(currentView.getDataset()); + } + else + { + al.setDataset(null); + } jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, false, predMap); @@ -162,8 +178,8 @@ class JPredThread extends JWS1Thread implements WSClientI if (predMap != null) { char gc = getGapChar(); - SequenceI[] sqs = (SequenceI[]) ((java.lang.Object[]) input - .getAlignmentAndColumnSelection(gc))[0]; + SequenceI[] sqs = (SequenceI[]) input + .getAlignmentAndColumnSelection(gc)[0]; if (this.msaIndex >= sqs.length) { throw new Error(MessageManager.getString("error.implementation_error_invalid_msa_index_for_job")); @@ -187,7 +203,15 @@ class JPredThread extends JWS1Thread implements WSClientI } else { - al.setDataset(null); + if (currentView.getDataset() != null) + { + al.setDataset(currentView.getDataset()); + + } + else + { + al.setDataset(null); + } jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, true, predMap); SequenceI profileseq = al.getSequenceAt(0); // this includes any gaps. @@ -201,11 +225,53 @@ class JPredThread extends JWS1Thread implements WSClientI } } } + // transfer to dataset + for (AlignmentAnnotation alant : al.getAlignmentAnnotation()) + { + if (alant.sequenceRef != null) + { + replaceAnnotationOnAlignmentWith(alant, alant.label, + "jalview.jws1.Jpred" + (this.msa == null ? "" : "MSA"), + alant.sequenceRef); + } + } return new Object[] { al, alcsel }; // , FirstSeq, noMsa}; } /** + * copied from JabawsCalcWorker + * + * @param newAnnot + * @param typeName + * @param calcId + * @param aSeq + */ + protected void replaceAnnotationOnAlignmentWith( + AlignmentAnnotation newAnnot, String typeName, String calcId, + SequenceI aSeq) + { + SequenceI dsseq = aSeq.getDatasetSequence(); + while (dsseq.getDatasetSequence() != null) + { + dsseq = dsseq.getDatasetSequence(); + } + // look for same annotation on dataset and lift this one over + List dsan = dsseq.getAlignmentAnnotations( + calcId, typeName); + if (dsan != null && dsan.size() > 0) + { + for (AlignmentAnnotation dssan : dsan) + { + dsseq.removeAlignmentAnnotation(dssan); + } + } + AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot); + dsseq.addAlignmentAnnotation(dssan); + dssan.adjustForAlignment(); + } + + /** * Given an alignment where all other sequences except profileseq are * aligned to the ungapped profileseq, insert gaps in the other sequences to * realign them with the residues in profileseq @@ -372,7 +438,7 @@ class JPredThread extends JWS1Thread implements WSClientI { if (job.getJobId().startsWith("Broken")) { - job.result = (vamsas.objects.simple.Result) new JpredResult(); + job.result = new JpredResult(); job.result.setInvalid(true); job.result.setStatus(MessageManager.formatMessage("label.submission_params", new String[]{job.getJobId().toString()})); throw new Exception(job.getJobId()); diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index 83eebdf..6c438be 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -279,10 +279,13 @@ public class AADisorderClient extends JabawsCalcWorker implements { continue; } + String typename, calcName; AlignmentAnnotation annot = createAnnotationRowsForScores( ourAnnot, - service.serviceType + " (" + scr.getMethod() + ")", - service.getServiceTypeURI() + "/" + scr.getMethod(), + typename = service.serviceType + " (" + + scr.getMethod() + ")", + calcName = service.getServiceTypeURI() + "/" + + scr.getMethod(), aseq, base + 1, scr); annot.graph = AlignmentAnnotation.LINE_GRAPH; @@ -333,6 +336,9 @@ public class AADisorderClient extends JabawsCalcWorker implements } } annot._linecolour = col; + // finally, update any dataset annotation + replaceAnnotationOnAlignmentWith(annot, typename, calcName, + aseq); } } } diff --git a/src/jalview/ws/jws2/JabaWsServerQuery.java b/src/jalview/ws/jws2/JabaWsServerQuery.java index 2eb484b..74dce4d 100644 --- a/src/jalview/ws/jws2/JabaWsServerQuery.java +++ b/src/jalview/ws/jws2/JabaWsServerQuery.java @@ -27,6 +27,9 @@ import jalview.bin.Cache; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.jws2.jabaws2.Jws2InstanceFactory; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.HashSet; import java.util.Set; @@ -44,7 +47,7 @@ public class JabaWsServerQuery implements Runnable Jws2Discoverer jws2Discoverer = null; - String jwsservers = null; + String jwsserver = null; boolean quit = false, running = false; @@ -65,10 +68,10 @@ public class JabaWsServerQuery implements Runnable this.quit = quit; } - public JabaWsServerQuery(Jws2Discoverer jws2Discoverer, String jwsservers) + public JabaWsServerQuery(Jws2Discoverer jws2Discoverer, String server) { this.jws2Discoverer = jws2Discoverer; - this.jwsservers = jwsservers; + this.jwsserver = server; } Services[] JABAWS1SERVERS = new Services[] @@ -92,7 +95,9 @@ public class JabaWsServerQuery implements Runnable running = true; try { - if (Jws2Client.validURL(jwsservers)) + // TODO this test doesn't seem to attempt a connection - should it? + // would save a lot of failed tries with UnknownHostException + if (isValidUrl(jwsserver)) { compbio.data.msa.RegistryWS registry = null; Set svccategories = null; @@ -109,7 +114,7 @@ public class JabaWsServerQuery implements Runnable try { // JBPNote: why is RegistryWS in compbio.data.msa ? - registry = Jws2Client.connectToRegistry(jwsservers); + registry = Jws2Client.connectToRegistry(jwsserver); if (registry != null) { // System.err.println("Test Services Output\n" @@ -137,13 +142,14 @@ public class JabaWsServerQuery implements Runnable ex.printStackTrace(); // if that failed, then we are probably working with a JABAWS1 server. // in that case, look for each service endpoint - System.err.println("JWS2 Discoverer: " + jwsservers + System.err.println("JWS2 Discoverer: " + jwsserver + " is a JABAWS1 server. Using hardwired list."); for (Services srv : JABAWS1SERVERS) { srv_set.add(srv); } } + for (Category cat : categories) { for (Services srv : cat.getServices()) @@ -160,18 +166,18 @@ public class JabaWsServerQuery implements Runnable JABAService service = null; try { - service = Jws2Client.connect(jwsservers, srv); + service = Jws2Client.connect(jwsserver, srv); } catch (Exception e) { System.err.println("Jws2 Discoverer: Problem on " - + jwsservers + " with service " + srv + ":\n" + + jwsserver + " with service " + srv + ":\n" + e.getMessage()); if (!(e instanceof javax.xml.ws.WebServiceException)) { e.printStackTrace(); } // For moment, report service as a problem. - jws2Discoverer.addInvalidServiceUrl(jwsservers); + jws2Discoverer.addInvalidServiceUrl(jwsserver); } ; if (service != null) @@ -183,16 +189,16 @@ public class JabaWsServerQuery implements Runnable String description = registry.getServiceDescription(srv); - svc = Jws2InstanceFactory.newJws2Instance(jwsservers, + svc = Jws2InstanceFactory.newJws2Instance(jwsserver, srv.toString(), cat.name, description, service); } if (svc == null) { - svc = Jws2InstanceFactory.newJws2Instance(jwsservers, + svc = Jws2InstanceFactory.newJws2Instance(jwsserver, srv.toString(), cat.name, "JABAWS 1 Alignment Service", service); } - jws2Discoverer.addService(jwsservers, svc); + jws2Discoverer.addService(jwsserver, svc); } } @@ -200,25 +206,53 @@ public class JabaWsServerQuery implements Runnable if (noservices) { - jws2Discoverer.addUrlwithnoservices(jwsservers); + jws2Discoverer.addUrlwithnoservices(jwsserver); } } else { - jws2Discoverer.addInvalidServiceUrl(jwsservers); - Cache.log.info("Ignoring invalid Jws2 service url " + jwsservers); + jws2Discoverer.addInvalidServiceUrl(jwsserver); + Cache.log.info("Ignoring invalid Jws2 service url " + jwsserver); } } catch (Exception e) { e.printStackTrace(); Cache.log.warn("Exception when discovering Jws2 services.", e); - jws2Discoverer.addInvalidServiceUrl(jwsservers); + jws2Discoverer.addInvalidServiceUrl(jwsserver); } catch (Error e) { Cache.log.error("Exception when discovering Jws2 services.", e); - jws2Discoverer.addInvalidServiceUrl(jwsservers); + jws2Discoverer.addInvalidServiceUrl(jwsserver); } running = false; } + /** + * Check if the URL is valid and responding. + * + * @return + */ + private boolean isValidUrl(String server) + { + // return Jws2Client.validURL(jwsserver); // checks syntax only + boolean result = false; + if (server != null) { + try { + URL url = new URL(server); + url.openStream().close(); + result = true; + } catch (MalformedURLException e) + { + System.err.println("Invalid server URL: " + server); + result = false; + } catch (IOException e) + { + System.err.println("Error connecting to server: " + server + ": " + + e.toString()); + result = false; + } + } + return result; + } + } diff --git a/src/jalview/ws/jws2/JabawsCalcWorker.java b/src/jalview/ws/jws2/JabawsCalcWorker.java index e966886..e01c648 100644 --- a/src/jalview/ws/jws2/JabawsCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsCalcWorker.java @@ -158,6 +158,30 @@ public abstract class JabawsCalcWorker extends AbstractJabaCalcWorker return annotation; } + protected void replaceAnnotationOnAlignmentWith( + AlignmentAnnotation newAnnot, String typeName, String calcId, + SequenceI aSeq) + { + SequenceI dsseq = aSeq.getDatasetSequence(); + while (dsseq.getDatasetSequence() != null) + { + dsseq = dsseq.getDatasetSequence(); + } + // look for same annotation on dataset and lift this one over + List dsan = dsseq.getAlignmentAnnotations(calcId, + typeName); + if (dsan != null && dsan.size() > 0) + { + for (AlignmentAnnotation dssan : dsan) + { + dsseq.removeAlignmentAnnotation(dssan); + } + } + AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot); + dsseq.addAlignmentAnnotation(dssan); + dssan.adjustForAlignment(); + } + private void constructAnnotationFromScore(AlignmentAnnotation annotation, int base, int alWidth, Score scr) { diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index 910b749..a111d68 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -34,6 +34,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; @@ -60,9 +62,48 @@ import compbio.ws.client.Services; */ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI { - private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport( + public static final String COMPBIO_JABAWS = "http://www.compbio.dundee.ac.uk/jabaws"; + + /* + * the .jalview_properties entry for JWS2 URLS + */ + final static String JWS2HOSTURLS = "JWS2HOSTURLS"; + + /* + * Singleton instance + */ + private static Jws2Discoverer discoverer; + + /* + * Override for testing only + */ + private static List testUrls = null; + + // preferred url has precedence over others + private String preferredUrl; + + private PropertyChangeSupport changeSupport = new PropertyChangeSupport( this); + Vector invalidServiceUrls = null, urlsWithoutServices = null, + validServiceUrls = null; + + boolean running = false, aborted = false; + + Thread oldthread = null; + + /** + * holds list of services. + */ + protected Vector services; + + /** + * Private constructor enforces use of singleton via getDiscoverer() + */ + private Jws2Discoverer() + { + } + /** * change listeners are notified of "services" property changes * @@ -87,8 +128,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI changeSupport.removePropertyChangeListener(listener); } - boolean running = false, aborted = false; - /** * @return the aborted */ @@ -104,10 +143,8 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI public void setAborted(boolean aborted) { this.aborted = aborted; - } - - Thread oldthread = null; + } public void run() { @@ -135,7 +172,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI // first set up exclusion list if needed final Set ignoredServices = new HashSet(); - for (String ignored : jalview.bin.Cache.getDefault( + for (String ignored : Cache.getDefault( "IGNORED_JABAWS_SERVICETYPES", "") .split("\\|")) { @@ -176,9 +213,9 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI ArrayList svctypes = new ArrayList(); List qrys = new ArrayList(); - for (final String jwsservers : getServiceUrls()) + for (final String jwsserver : getServiceUrls()) { - JabaWsServerQuery squery = new JabaWsServerQuery(this, jwsservers); + JabaWsServerQuery squery = new JabaWsServerQuery(this, jwsserver); if (svctypes.size() == 0) { // TODO: remove this ugly hack to get Canonical JABA service ordering @@ -233,7 +270,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI Jws2Instance[] svcs = new Jws2Instance[services.size()]; int[] spos = new int[services.size()]; int ipos = 0; - Vector svcUrls = getServiceUrls(); + List svcUrls = getServiceUrls(); for (Jws2Instance svc : services) { svcs[ipos] = svc; @@ -290,11 +327,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI } /** - * holds list of services. - */ - protected Vector services; - - /** * attach all available web services to the appropriate submenu in the given * JMenu */ @@ -545,7 +577,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI { if (args.length > 0) { - testUrls = new Vector(); + testUrls = new ArrayList(); for (String url : args) { testUrls.add(url); @@ -592,8 +624,11 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI } } - private static Jws2Discoverer discoverer; - + /** + * Returns the singleton instance of this class. + * + * @return + */ public static Jws2Discoverer getDiscoverer() { if (discoverer == null) @@ -605,7 +640,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI public boolean hasServices() { - // TODO Auto-generated method stub return !running && services != null && services.size() > 0; } @@ -614,24 +648,19 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI return running; } - /** - * the jalview .properties entry for JWS2 URLS - */ - final static String JWS2HOSTURLS = "JWS2HOSTURLS"; - - public static void setServiceUrls(Vector urls) + public void setServiceUrls(List wsUrls) { - if (urls != null) + if (wsUrls != null && !wsUrls.isEmpty()) { - StringBuffer urlbuffer = new StringBuffer(); + StringBuilder urls = new StringBuilder(128); String sep = ""; - for (String url : urls) + for (String url : wsUrls) { - urlbuffer.append(sep); - urlbuffer.append(url); + urls.append(sep); + urls.append(url); sep = ","; } - Cache.setProperty(JWS2HOSTURLS, urlbuffer.toString()); + Cache.setProperty(JWS2HOSTURLS, urls.toString()); } else { @@ -639,18 +668,27 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI } } - private static Vector testUrls = null; - - public static Vector getServiceUrls() + /** + * Returns web service URLs, in the order in which they should be tried (or an + * empty list). + * + * @return + */ + public List getServiceUrls() { if (testUrls != null) { // return test urls, if there are any, instead of touching cache return testUrls; } - String surls = Cache.getDefault(JWS2HOSTURLS, - "http://www.compbio.dundee.ac.uk/jabaws"); - Vector urls = new Vector(); + List urls = new ArrayList(); + + if (this.preferredUrl != null) + { + urls.add(preferredUrl); + } + + String surls = Cache.getDefault(JWS2HOSTURLS, COMPBIO_JABAWS); try { StringTokenizer st = new StringTokenizer(surls, ","); @@ -659,40 +697,37 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI String url = null; try { - java.net.URL u = new java.net.URL(url = st.nextToken()); + url = st.nextToken(); + new URL(url); if (!urls.contains(url)) { urls.add(url); } else { - jalview.bin.Cache.log.info("Ignoring duplicate url in " + Cache.log.info("Ignoring duplicate url " + url + " in " + JWS2HOSTURLS + " list"); } - } catch (Exception ex) + } catch (MalformedURLException ex) { - jalview.bin.Cache.log + Cache.log .warn("Problem whilst trying to make a URL from '" + ((url != null) ? url : "") + "'"); - jalview.bin.Cache.log + Cache.log .warn("This was probably due to a malformed comma separated list" + " in the " + JWS2HOSTURLS + " entry of $(HOME)/.jalview_properties)"); - jalview.bin.Cache.log.debug("Exception was ", ex); + Cache.log.debug("Exception was ", ex); } } } catch (Exception ex) { - jalview.bin.Cache.log.warn( + Cache.log.warn( "Error parsing comma separated list of urls in " + JWS2HOSTURLS + " preference.", ex); } - if (urls.size() >= 0) - { - return urls; - } - return null; + return urls; } public Vector getServices() @@ -750,9 +785,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI return thr; } - Vector invalidServiceUrls = null, urlsWithoutServices = null, - validServiceUrls = null; - /** * @return the invalidServiceUrls */ @@ -865,7 +897,9 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI return 1; } if (urlsWithoutServices != null && urlsWithoutServices.contains(url)) + { return 0; + } if (invalidServiceUrls != null && invalidServiceUrls.contains(url)) { return -1; @@ -979,4 +1013,21 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI { setPreferredServiceFor(null, serviceType, serviceAction, selectedServer); } + + /** + * Set a URL to try before any others. For use with command-line parameter to + * configure a local Jabaws installation without the need to add to property + * files. + * + * @param value + * @throws MalformedURLException + */ + public void setPreferredUrl(String value) throws MalformedURLException + { + if (value != null && value.trim().length() > 0) + { + new URL(value); + preferredUrl = value; + } + } } diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index 9ddc69a..09a6d8d 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -20,19 +20,28 @@ */ package jalview.ws.jws2; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentView; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.JvSwingUtils; +import jalview.util.MessageManager; +import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.WsParamSetI; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.List; -import javax.swing.*; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.ToolTipManager; -import jalview.datamodel.*; -import jalview.gui.*; import compbio.data.msa.MsaWS; import compbio.metadata.Argument; -import jalview.util.MessageManager; -import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.params.WsParamSetI; /** * DOCUMENT ME! @@ -98,20 +107,23 @@ public class MsaWSClient extends Jws2Client if (!(sh.service instanceof MsaWS)) { // redundant at mo - but may change - JOptionPane - .showMessageDialog( - Desktop.desktop, - MessageManager.formatMessage("label.service_called_is_not_msa_service", new String[]{sh.serviceType}), - MessageManager.getString("label.internal_jalview_error"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog(Desktop.desktop, MessageManager + .formatMessage("label.service_called_is_not_msa_service", + new String[] + { sh.serviceType }), MessageManager + .getString("label.internal_jalview_error"), + JOptionPane.WARNING_MESSAGE); return; } server = (MsaWS) sh.service; if ((wsInfo = setWebService(sh, false)) == null) { - JOptionPane.showMessageDialog(Desktop.desktop, - MessageManager.formatMessage("label.msa_service_is_unknown", new String[]{sh.serviceType}), - MessageManager.getString("label.internal_jalview_error"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog(Desktop.desktop, MessageManager + .formatMessage("label.msa_service_is_unknown", new String[] + { sh.serviceType }), MessageManager + .getString("label.internal_jalview_error"), + JOptionPane.WARNING_MESSAGE); return; } @@ -273,13 +285,39 @@ public class MsaWSClient extends Jws2Client "label.run_with_preset_params", new String[] { calcName })); + final int showToolTipFor = ToolTipManager.sharedInstance() + .getDismissDelay(); for (final WsParamSetI preset : presets) { final JMenuItem methodR = new JMenuItem(preset.getName()); - methodR.setToolTipText(JvSwingUtils.wrapTooltip(true, "

    " - + (preset.isModifiable() ? MessageManager.getString("label.user_preset") - : MessageManager.getString("label.service_preset")) + "
    " - + preset.getDescription() + "

    ")); + final int QUICK_TOOLTIP = 1500; + // JAL-1582 shorten tooltip display time in these menu items as + // they can obscure other options + methodR.addMouseListener(new MouseAdapter() + { + @Override + public void mouseEntered(MouseEvent e) + { + ToolTipManager.sharedInstance().setDismissDelay( + QUICK_TOOLTIP); + } + + @Override + public void mouseExited(MouseEvent e) + { + ToolTipManager.sharedInstance().setDismissDelay(showToolTipFor); + } + + }); + methodR.setToolTipText(JvSwingUtils.wrapTooltip( + true, + "

    " + + (preset.isModifiable() ? MessageManager + .getString("label.user_preset") + : MessageManager + .getString("label.service_preset")) + + "
    " + preset.getDescription() + + "

    ")); methodR.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/test/jalview/ext/jmol/PDBFileWithJmolTest.java b/test/jalview/ext/jmol/PDBFileWithJmolTest.java index 79e3eae..7bcf902 100644 --- a/test/jalview/ext/jmol/PDBFileWithJmolTest.java +++ b/test/jalview/ext/jmol/PDBFileWithJmolTest.java @@ -64,7 +64,7 @@ public class PDBFileWithJmolTest { for (String pdbStr : testFile) { - PDBfile mctest = new PDBfile(false, false, pdbStr, + PDBfile mctest = new PDBfile(false, false, false, pdbStr, AppletFormatAdapter.FILE); PDBFileWithJmol jtest = new PDBFileWithJmol(pdbStr, jalview.io.AppletFormatAdapter.FILE); diff --git a/test/jalview/ext/paradise/TestAnnotate3D.java b/test/jalview/ext/paradise/TestAnnotate3D.java index d2322ef..a7c439f 100644 --- a/test/jalview/ext/paradise/TestAnnotate3D.java +++ b/test/jalview/ext/paradise/TestAnnotate3D.java @@ -21,10 +21,8 @@ package jalview.ext.paradise; import static org.junit.Assert.assertTrue; - import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; -import jalview.ext.paradise.Annotate3D; import jalview.io.FastaFile; import jalview.io.FormatAdapter; @@ -72,9 +70,13 @@ public class TestAnnotate3D iline = id.readLine(); fline = file.readLine(); if (iline != null) + { System.out.println(iline); + } if (fline != null) + { System.out.println(fline); + } // next assert fails for latest RNAview - because the XMLID entries // change between file and ID based RNAML generation. assertTrue( @@ -96,7 +98,8 @@ public class TestAnnotate3D @Test public void testPDBfileVsRNAML() throws Exception { - PDBfile pdbf = new PDBfile(true,true,"examples/2GIS.pdb", FormatAdapter.FILE); + PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb", + FormatAdapter.FILE); Assert.assertTrue(pdbf.isValid()); // Comment - should add new FileParse constructor like new FileParse(Reader // ..). for direct reading diff --git a/test/jalview/gui/HelpTest.java b/test/jalview/gui/HelpTest.java new file mode 100644 index 0000000..e4068d7 --- /dev/null +++ b/test/jalview/gui/HelpTest.java @@ -0,0 +1,32 @@ +package jalview.gui; + +import static org.junit.Assert.assertTrue; +import jalview.gui.Help.HelpId; + +import java.net.URL; + +import javax.help.HelpSet; +import javax.help.HelpSetException; +import javax.help.Map; + +import org.junit.Test; + +public class HelpTest +{ + @Test + public void checkHelpTargets() throws HelpSetException + { + ClassLoader cl = Desktop.class.getClassLoader(); + URL url = HelpSet.findHelpSet(cl, "help/help"); // $NON-NLS-$ + HelpSet hs = new HelpSet(cl, url); + Map targets = hs.getLocalMap(); + + for (HelpId id : HelpId.values()) + { + String target = id.toString(); + assertTrue("Unmatched target enum: " + target, + targets.isValidID(target, hs)); + } + + } +} diff --git a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java index 295c3bf..c206323 100644 --- a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java +++ b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java @@ -20,7 +20,8 @@ */ package jalview.ws.jabaws; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import jalview.ws.jws2.Jws2Discoverer; import java.util.Vector; @@ -73,7 +74,7 @@ public class JalviewJabawsTestUtils services.add(url); } ; - Jws2Discoverer.setServiceUrls(services); + Jws2Discoverer.getDiscoverer().setServiceUrls(services); } try {