From: kiramt Date: Tue, 6 Feb 2018 13:28:54 +0000 (+0000) Subject: Merge branch 'develop' into feature/JAL-2759 X-Git-Tag: Release_2_10_4~55^2~1^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8c5cefb3ac80bd094a8dab7ce6735a11583b1772;hp=34b682702fe2dee7a5d79f95960a1accbea17ef6;p=jalview.git Merge branch 'develop' into feature/JAL-2759 Conflicts: benchmarking/README src/jalview/datamodel/Alignment.java src/jalview/datamodel/AlignmentAnnotation.java src/jalview/gui/SeqCanvas.java src/jalview/gui/SeqPanel.java --- diff --git a/RELEASE b/RELEASE index f1faf34..eb9d7cd 100644 --- a/RELEASE +++ b/RELEASE @@ -1,2 +1,2 @@ jalview.release=releases/Release_2_10_3_Branch -jalview.version=2.10.3 +jalview.version=2.10.3b1 diff --git a/benchmarking/README b/benchmarking/README index bd2562f..d1ec146 100644 --- a/benchmarking/README +++ b/benchmarking/README @@ -7,16 +7,19 @@ You will need to install Maven: https://maven.apache.org/install.html This builds a jalview.jar file and puts it into dist/ + 2. Make a lib directory in benchmarking/ if not already present and cd into this directory. + 3. Purge any previous maven dependencies: mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false + 4. Run mvn install:install-file -Dfile=../dist/jalview.jar -DgroupId=jalview.org -DartifactId=jalview -Dversion=1.0 -Dpackaging=jar -DlocalRepositoryPath=lib - to install the jalview.jar file in the local maven repository. The pom.xml in the benchmarking references this installation, so if you change the names the pom.xml file will also need to be updated. + 5. Build and run jmh benchmarking. In the benchmarking directory: mvn clean install java -jar target/benchmarks.jar @@ -27,4 +30,15 @@ to install the jalview.jar file in the local maven repository. The pom.xml in th To run a specific benchmark file use: java -jar target/benchmarks.jar - JSON output can be viewed quickly by drag-dropping on http://jmh.morethan.io/ \ No newline at end of file + JSON output can be viewed quickly by drag-dropping on http://jmh.morethan.io/ + + To get help use the standard -h option: + java -jar target/benchmarks.jar -h + + More information here: + http://openjdk.java.net/projects/code-tools/jmh/ + http://java-performance.info/jmh/ + + + 6. If you make changes to the Jalview code everything will need to be refreshed, by performing steps 3-5 again. + diff --git a/help/help.jhm b/help/help.jhm index 010bca8..732f01b 100755 --- a/help/help.jhm +++ b/help/help.jhm @@ -22,7 +22,7 @@ - + diff --git a/help/helpTOC.xml b/help/helpTOC.xml index 7ba4ee5..20dd8db 100755 --- a/help/helpTOC.xml +++ b/help/helpTOC.xml @@ -24,7 +24,6 @@ - diff --git a/help/html/calculations/sorting.html b/help/html/calculations/sorting.html index aeb461a..a0412d0 100755 --- a/help/html/calculations/sorting.html +++ b/help/html/calculations/sorting.html @@ -46,8 +46,7 @@
  • Sort by Pairwise Identity

    -

    Places pairs of sequences together that align with the - greatest fraction of conserved residues.

    +

    Sorts sequences in the selection or alignment according to percent identity with respect to the first sequence in the view.

  • Sort by Tree Order diff --git a/help/html/features/viewingpdbs.html b/help/html/features/viewingpdbs.html index 0fcbbf9..45d979f 100755 --- a/help/html/features/viewingpdbs.html +++ b/help/html/features/viewingpdbs.html @@ -56,7 +56,7 @@

  • Viewing Cached Structures
    If previously downloaded structures are available for your sequences, the structure chooser will automatically offer them - via the Cached PDB Entries view. If you wish + via the Cached Structures view. If you wish to download new structures, select one of the PDBe selection criteria from the drop-down menu.
  • diff --git a/help/html/releases.html b/help/html/releases.html index c0d1f2c..83d2ce4 100755 --- a/help/html/releases.html +++ b/help/html/releases.html @@ -70,8 +70,30 @@ li:before {
    - 2.10.3
    - 17/11/2017
    + 2.10.3b1
    24/1/2018
    +
    + +
    +
    • Updated Certum Codesigning Certificate + (Valid till 30th November 2018)
    +
    + Desktop
      +
        +
      • Only one structure is loaded when several sequences and structures are selected for viewing/superposing
      • +
      • Alignment doesn't appear to scroll vertically via trackpad and scrollwheel
      • +
      • Jalview hangs if up/down arrows pressed in cursor mode when cursor lies in hidden region at start of alignment
      • +
      • Helix annotation has 'notches' when scrolled into view if columns are hidden
      • +
      • Annotation column filter can be slow to reset (ie after hitting cancel) for large numbers of hidden columns
      • +
      • User preference for disabling inclusion of sequence limits when exporting as flat file has no effect
      • +
      • Reproducible cross-reference relationships when retrieving sequences from EnsemblGenomes
      • +
      +
    + + + + +
    + 2.10.3
    17/11/2017
    @@ -89,87 +111,227 @@ li:before { Structure views don't get updated unless their colours have changed -
  • All linked sequences are highlighted for a structure mousover (Jmol) or selection (Chimera)
  • -
  • 'Cancel' button in progress bar for JABAWS AACon, RNAAliFold and Disorder prediction jobs +
  • + All linked sequences are highlighted for + a structure mousover (Jmol) or selection (Chimera) +
  • +
  • + 'Cancel' button in progress bar for + JABAWS AACon, RNAAliFold and Disorder prediction jobs +
  • +
  • + Stop codons are excluded in CDS/Protein + view from Ensembl locus cross-references +
  • +
  • + Start/End limits are shown in Pairwise + Alignment report +
  • +
  • + Sequence fetcher's Free text 'autosearch' + feature can be disabled +
  • +
  • + Retrieve IDs tab added for UniProt and + PDB easier retrieval of sequences for lists of IDs +
  • +
  • + Short names for sequences retrieved from + Uniprot
  • - -
  • Stop codons are excluded in CDS/Protein view from Ensembl locus cross-references
  • -
  • Start/End limits are shown in Pairwise Alignment report
  • -
  • Sequence fetcher's Free text 'autosearch' feature can be disabled
  • -
  • Retrieve IDs tab added for UniProt and PDB easier retrieval of sequences for lists of IDs
  • -
  • Short names for sequences retrieved from Uniprot
  • Scripting
    • Groovy interpreter updated to 2.4.12
    • -
    • Example groovy script for generating a matrix of percent identity scores for current alignment.
    • +
    • Example groovy script for generating a matrix of + percent identity scores for current alignment.
    Testing and Deployment
      -
    • Test to catch memory leaks in Jalview UI
    • +
    • + Test to catch memory leaks in Jalview UI +
    -
    - +
    General
      -
    • Pressing tab after updating the colour threshold text field doesn't trigger an update to the alignment view
    • -
    • Race condition when parsing sequence ID strings in parallel
    • -
    • Overview windows are also closed when alignment window is closed
    • -
    • Export of features doesn't always respect group visibility
    • -
    • Jumping from column 1 to column 100,000 takes a long time in Cursor mode
    • +
    • + Pressing tab after updating the colour + threshold text field doesn't trigger an update to the + alignment view +
    • +
    • + Race condition when parsing sequence ID + strings in parallel +
    • +
    • + Overview windows are also closed when + alignment window is closed +
    • +
    • + Export of features doesn't always respect + group visibility +
    • +
    • + Jumping from column 1 to column 100,000 + takes a long time in Cursor mode +
    Desktop
      -
    • Structures with whitespace chainCode cannot be viewed in Chimera
    • -
    • Protein annotation panel too high in CDS/Protein view -
    • -
    • Can't edit the query after the server error warning icon is shown in Uniprot and PDB Free Text Search Dialogs -
    • -
    • Slow EnsemblGenome ID lookup
    • -
    • Revised Ensembl REST API CDNA query
    • -
    • Hidden column marker in last column not rendered when switching back from Wrapped to normal view
    • -
    • Annotation display corrupted when scrolling right in unwapped alignment view
    • -
    • Existing features on subsequence incorrectly relocated when full sequence retrieved from database
    • -
    • Last reported memory still shown when Desktop->Show Memory is unticked (OSX only)
    • -
    • Amend Features dialog doesn't allow features of same type and group to be selected for amending
    • -
    • Jalview becomes sluggish in wide alignments when hidden columns are present
    • -
    • Jalview freezes when loading and displaying several structures
    • -
    • Black outlines left after resizing or moving a window
    • -
    • Unable to minimise windows within the Jalview desktop on OSX
    • -
    • Mouse wheel doesn't scroll vertically when in wrapped alignment mode
    • -
    • Scale mark not shown when close to right hand end of alignment
    • -
    • Pairwise alignment only aligns selected regions of each selected sequence
    • -
    • Alignment ruler height set incorrectly after canceling the Alignment Window's Font dialog
    • -
    • Show cross-references not enabled after restoring project until a new view is created
    • -
    • Warning popup about use of SEQUENCE_ID in URL links appears when only default EMBL-EBI link is configured (since 2.10.2b2)
    • -
    • Overview redraws whole window when box position is adjusted
    • -
    • Structure viewer doesn't map all chains in a multi-chain structure when viewing alignment involving more than one chain (since 2.10)
    • -
    • Double residue highlights in cursor mode if new selection moves alignment window
    • -
    - Applet
    -
      -
    • Concurrent modification exception when closing alignment panel
    • +
    • + Structures with whitespace chainCode + cannot be viewed in Chimera +
    • +
    • + Protein annotation panel too high in + CDS/Protein view +
    • +
    • + Can't edit the query after the server + error warning icon is shown in Uniprot and PDB Free Text + Search Dialogs +
    • +
    • + Slow EnsemblGenome ID lookup +
    • +
    • + Revised Ensembl REST API CDNA query +
    • +
    • + Hidden column marker in last column not + rendered when switching back from Wrapped to normal view +
    • +
    • + Annotation display corrupted when + scrolling right in unwapped alignment view +
    • +
    • + Existing features on subsequence + incorrectly relocated when full sequence retrieved from + database +
    • +
    • + Last reported memory still shown when + Desktop->Show Memory is unticked (OSX only) +
    • +
    • + Amend Features dialog doesn't allow + features of same type and group to be selected for + amending +
    • +
    • + Jalview becomes sluggish in wide + alignments when hidden columns are present +
    • +
    • + Jalview freezes when loading and + displaying several structures +
    • +
    • + Black outlines left after resizing or + moving a window +
    • +
    • + Unable to minimise windows + within the Jalview desktop on OSX +
    • +
    • + Mouse wheel doesn't scroll vertically + when in wrapped alignment mode +
    • +
    • + Scale mark not shown when close to right + hand end of alignment +
    • +
    • + Pairwise alignment of selected regions of + each selected sequence do not have correct start/end + positions +
    • +
    • + Alignment ruler height set incorrectly + after canceling the Alignment Window's Font dialog +
    • +
    • + Show cross-references not enabled after + restoring project until a new view is created +
    • +
    • + Warning popup about use of SEQUENCE_ID in + URL links appears when only default EMBL-EBI link is + configured (since 2.10.2b2) +
    • +
    • + Overview redraws whole window when box + position is adjusted +
    • +
    • + Structure viewer doesn't map all chains + in a multi-chain structure when viewing alignment + involving more than one chain (since 2.10) +
    • +
    • + Double residue highlights in cursor mode + if new selection moves alignment window +
    • +
    • + Alignment vanishes when using + arrow key in cursor mode to pass hidden column marker +
    • +
    • + Ensembl Genomes example ID changed to one + that produces correctly annotated transcripts and products +
    • +
    • + Toggling a feature group after first time + doesn't update associated structure view +
    - BioJSON
    + Applet
      -
    • - BioJSON export does not preserve non-positional features -
    • +
    • + Concurrent modification exception when + closing alignment panel +
    • +
    + BioJSON
    +
      +
    • + BioJSON export does not preserve + non-positional features +
    - Known Java 9 Issues + New Known Issues
      -
    • Groovy Console very slow to open and is - not responsive when entering characters (Webstart, Java 9.01, - OSX 10.10) +
    • + Delete/Cut selection doesn't relocate + sequence features correctly (for many previous versions of + Jalview) +
    • +
    • + Cursor mode unexpectedly scrolls when + using cursor in wrapped panel other than top +
    • +
    • + Select columns containing feature ignores + graduated colour threshold +
    • +
    • + Edit sequence operation doesn't + always preserve numbering and sequence features
    - New Known Issues + Known Java 9 Issues
      -
    • +
    • + Groovy Console very slow to open and is + not responsive when entering characters (Webstart, Java + 9.01, OSX 10.10) +
    -
    - + diff --git a/help/html/whatsNew.html b/help/html/whatsNew.html index d92f26b..6d75f0f 100755 --- a/help/html/whatsNew.html +++ b/help/html/whatsNew.html @@ -24,31 +24,33 @@

    - What's new in Jalview 2.10.3 ? + What's new in Jalview 2.10.3b1 ?

    - Version 2.10.3 was released in November 2017. The full list of - bug fixes and new features can be found in the 2.10.3 Release Notes, but - the highlights are below. + This is the January 2018 patch release, which addresses critical bugs including trackpad function in OSX, and display of multiple 3D structures. + The full list bugs fixed in this release can be found in the 2.10.3b1 + Release Notes. In addition, Jalview 2.10.3 provides:

      -
    • Faster import and more responsive UI when working with wide alignments and handling hundreds and thousands of sequence features
    • -
    • -
    • Improved usability with PDB and - UniProt Free Text Search - dialog, and new tab for retrieval of sequences for lists of IDs.
    • -
    • Short names assigned to sequences retrieved from UniProt
    • +
    • Faster and more responsive UI when importing and working + with wide alignments and handling hundreds and thousands of + sequence features
    • +
    • Improved usability with PDB and UniProt Free Text + Search dialog, and new tab for retrieval of sequences for lists of + IDs. +
    • +
    • Short names assigned to sequences retrieved from UniProt
    • +
    • Groovy console upgraded to 2.4.12 (improved support for Java 9)

    Experimental Features

    - This release of Jalview introduces an Experimental Features - option in the Jalview Desktop's Tools menu that allows you - to try out features that are still in development. To access the - experimental features below - first enable the Tools→Enable - Experimental Features option, and then restart Jalview. + Remember, please enable the Experimental Features option in + the Jalview Desktop's Tools menu, and then restart Jalview + if you want to try out features below:

    • Annotation transfer between Chimera and Jalview
      Two @@ -56,6 +58,6 @@ the Chimera viewer's Chimera menu allow positional annotation to be exchanged between Chimera and Jalview.
    - + diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 94f7eff..f526699 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -673,7 +673,8 @@ label.2d_rna_structure_line = 2D RNA {0} (alignment) label.2d_rna_sequence_name = 2D RNA - {0} label.edit_name_and_description_current_group = Edit name and description of current group label.from_file = From File -label.enter_pdb_id = Enter PDB Id (or pdbid:chaincode) +label.enter_pdb_id = Enter PDB Id +label.enter_pdb_id_tip = Enter PDB Id (or pdbid:chaincode) label.text_colour = Text Colour... label.structure = Structure label.show_pdbstruct_dialog = 3D Structure Data... @@ -1319,6 +1320,13 @@ label.select_hidden_colour = Select hidden colour label.overview = Overview label.reset_to_defaults = Reset to defaults label.oview_calc = Recalculating overview... -option.enable_disable_autosearch = When ticked, search is performed automatically. +option.enable_disable_autosearch = When ticked, search is performed automatically option.autosearch = Autosearch -label.retrieve_ids = Retrieve IDs \ No newline at end of file +label.retrieve_ids = Retrieve IDs +label.best_quality = Best Quality +label.best_resolution = Best Resolution +label.most_protein_chain = Most Protein Chain +label.most_bound_molecules = Most Bound Molecules +label.most_polymer_residues = Most Polymer Residues +label.cached_structures = Cached Structures +label.free_text_search = Free Text Search diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index e8fd411..77f053e 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -626,6 +626,7 @@ label.2d_rna_sequence_name = 2D RNA - {0} label.edit_name_and_description_current_group = Editar el nombre y la descripción del grupo actual label.from_file = desde fichero label.enter_pdb_id = Introducir PDB Id +label.enter_pdb_id_tip = Introducir PDB Id (o pdbid:chaincode) label.text_colour = Color de texto... label.structure = Estructura label.create_sequence_details_report_annotation_for = Anotación para {0} @@ -1319,3 +1320,13 @@ label.select_hidden_colour = Seleccionar color de las regiones ocultas label.overview = Resumen label.reset_to_defaults = Restablecen a los predeterminados label.oview_calc = Recalculando resumen +option.enable_disable_autosearch = Marcar para buscar automáticamente +option.autosearch = Auto búsqueda +label.retrieve_ids = Recuperar IDs +label.best_quality = Mejor Calidad +label.best_resolution = Mejor Resolución +label.most_protein_chain = Más Cadena de Proteína +label.most_bound_molecules = Más Moléculas Ligadas +label.most_polymer_residues = Más Residuos de Polímeros +label.cached_structures = Estructuras en Caché +label.free_text_search = Búsqueda de texto libre diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index b6a5e0f..9475f00 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -28,6 +28,7 @@ import jalview.util.LinkedIdentityHashSet; import jalview.util.MessageManager; import java.util.ArrayList; +import java.util.Arrays; import java.util.BitSet; import java.util.Collections; import java.util.Enumeration; @@ -1619,40 +1620,21 @@ public class Alignment implements AlignmentI @Override public Iterable findAnnotation(String calcId) { - List aa = new ArrayList<>(); AlignmentAnnotation[] alignmentAnnotation = getAlignmentAnnotation(); if (alignmentAnnotation != null) { - for (AlignmentAnnotation a : alignmentAnnotation) - { - if (a.getCalcId() == calcId || (a.getCalcId() != null - && calcId != null && a.getCalcId().equals(calcId))) - { - aa.add(a); - } - } + return AlignmentAnnotation.findAnnotation( + Arrays.asList(getAlignmentAnnotation()), calcId); } - return aa; + return Arrays.asList(new AlignmentAnnotation[] {}); } @Override public Iterable findAnnotations(SequenceI seq, String calcId, String label) { - ArrayList aa = new ArrayList<>(); - for (AlignmentAnnotation ann : getAlignmentAnnotation()) - { - if ((calcId == null || (ann.getCalcId() != null - && ann.getCalcId().equals(calcId))) - && (seq == null || (ann.sequenceRef != null - && ann.sequenceRef == seq)) - && (label == null - || (ann.label != null && ann.label.equals(label)))) - { - aa.add(ann); - } - } - return aa; + return AlignmentAnnotation.findAnnotations( + Arrays.asList(getAlignmentAnnotation()), seq, calcId, label); } @Override diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 6c33c1b..0098d76 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -1582,4 +1582,70 @@ public class AlignmentAnnotation } } + public static Iterable findAnnotations( + Iterable list, SequenceI seq, String calcId, + String label) + { + + ArrayList aa = new ArrayList<>(); + for (AlignmentAnnotation ann : list) + { + if ((calcId == null || (ann.getCalcId() != null + && ann.getCalcId().equals(calcId))) + && (seq == null || (ann.sequenceRef != null + && ann.sequenceRef == seq)) + && (label == null + || (ann.label != null && ann.label.equals(label)))) + { + aa.add(ann); + } + } + return aa; + } + + /** + * Answer true if any annotation matches the calcId passed in (if not null). + * + * @param list + * annotation to search + * @param calcId + * @return + */ + public static boolean hasAnnotation(List list, + String calcId) + { + + if (calcId != null && !"".equals(calcId)) + { + for (AlignmentAnnotation a : list) + { + if (a.getCalcId() == calcId) + { + return true; + } + } + } + return false; + } + + public static Iterable findAnnotation( + List list, String calcId) + { + + List aa = new ArrayList<>(); + if (calcId == null) + { + return aa; + } + for (AlignmentAnnotation a : list) + { + + if (a.getCalcId() == calcId || (a.getCalcId() != null + && calcId != null && a.getCalcId().equals(calcId))) + { + aa.add(a); + } + } + return aa; + } } diff --git a/src/jalview/datamodel/ContiguousI.java b/src/jalview/datamodel/ContiguousI.java index f2ae4b7..a9b1372 100644 --- a/src/jalview/datamodel/ContiguousI.java +++ b/src/jalview/datamodel/ContiguousI.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel; public interface ContiguousI diff --git a/src/jalview/datamodel/Range.java b/src/jalview/datamodel/Range.java index 7886713..8b6f617 100644 --- a/src/jalview/datamodel/Range.java +++ b/src/jalview/datamodel/Range.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel; /** diff --git a/src/jalview/datamodel/SequenceCursor.java b/src/jalview/datamodel/SequenceCursor.java index b5929bf..24752bf 100644 --- a/src/jalview/datamodel/SequenceCursor.java +++ b/src/jalview/datamodel/SequenceCursor.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel; /** diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index e2f15e1..6b797d7 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -30,6 +30,7 @@ import java.awt.Color; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -1316,39 +1317,16 @@ public class SequenceGroup implements AnnotatedCollectionI @Override public Iterable findAnnotation(String calcId) { - List aa = new ArrayList<>(); - if (calcId == null) - { - return aa; - } - for (AlignmentAnnotation a : getAlignmentAnnotation()) - { - if (calcId.equals(a.getCalcId())) - { - aa.add(a); - } - } - return aa; + return AlignmentAnnotation.findAnnotation( + Arrays.asList(getAlignmentAnnotation()), calcId); } @Override public Iterable findAnnotations(SequenceI seq, String calcId, String label) { - ArrayList aa = new ArrayList<>(); - for (AlignmentAnnotation ann : getAlignmentAnnotation()) - { - if ((calcId == null || (ann.getCalcId() != null - && ann.getCalcId().equals(calcId))) - && (seq == null || (ann.sequenceRef != null - && ann.sequenceRef == seq)) - && (label == null - || (ann.label != null && ann.label.equals(label)))) - { - aa.add(ann); - } - } - return aa; + return AlignmentAnnotation.findAnnotations( + Arrays.asList(getAlignmentAnnotation()), seq, calcId, label); } /** @@ -1359,17 +1337,8 @@ public class SequenceGroup implements AnnotatedCollectionI */ public boolean hasAnnotation(String calcId) { - if (calcId != null && !"".equals(calcId)) - { - for (AlignmentAnnotation a : getAlignmentAnnotation()) - { - if (a.getCalcId() == calcId) - { - return true; - } - } - } - return false; + return AlignmentAnnotation + .hasAnnotation(Arrays.asList(getAlignmentAnnotation()), calcId); } /** diff --git a/src/jalview/datamodel/features/FeatureLocationI.java b/src/jalview/datamodel/features/FeatureLocationI.java index e651c13..378b8db 100644 --- a/src/jalview/datamodel/features/FeatureLocationI.java +++ b/src/jalview/datamodel/features/FeatureLocationI.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.features; import jalview.datamodel.ContiguousI; diff --git a/src/jalview/datamodel/features/FeatureStore.java b/src/jalview/datamodel/features/FeatureStore.java index 51bee57..02ce1c5 100644 --- a/src/jalview/datamodel/features/FeatureStore.java +++ b/src/jalview/datamodel/features/FeatureStore.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.features; import jalview.datamodel.ContiguousI; diff --git a/src/jalview/datamodel/features/NCList.java b/src/jalview/datamodel/features/NCList.java index b8160d3..ae58a69 100644 --- a/src/jalview/datamodel/features/NCList.java +++ b/src/jalview/datamodel/features/NCList.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.features; import jalview.datamodel.ContiguousI; diff --git a/src/jalview/datamodel/features/NCNode.java b/src/jalview/datamodel/features/NCNode.java index 007f3b1..b991750 100644 --- a/src/jalview/datamodel/features/NCNode.java +++ b/src/jalview/datamodel/features/NCNode.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.features; import jalview.datamodel.ContiguousI; diff --git a/src/jalview/datamodel/features/RangeComparator.java b/src/jalview/datamodel/features/RangeComparator.java index 26ffee1..b7d702d 100644 --- a/src/jalview/datamodel/features/RangeComparator.java +++ b/src/jalview/datamodel/features/RangeComparator.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.features; import jalview.datamodel.ContiguousI; diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 8d5ba58..fcf1b53 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.features; import jalview.datamodel.ContiguousI; diff --git a/src/jalview/datamodel/features/SequenceFeaturesI.java b/src/jalview/datamodel/features/SequenceFeaturesI.java index 58beca2..80c4f9a 100644 --- a/src/jalview/datamodel/features/SequenceFeaturesI.java +++ b/src/jalview/datamodel/features/SequenceFeaturesI.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.features; import jalview.datamodel.SequenceFeature; diff --git a/src/jalview/datamodel/xdb/uniprot/UniprotFeature.java b/src/jalview/datamodel/xdb/uniprot/UniprotFeature.java index 4a359ff..b1ed275 100644 --- a/src/jalview/datamodel/xdb/uniprot/UniprotFeature.java +++ b/src/jalview/datamodel/xdb/uniprot/UniprotFeature.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel.xdb.uniprot; /** diff --git a/src/jalview/ext/ensembl/EnsemblCdna.java b/src/jalview/ext/ensembl/EnsemblCdna.java index 6d031b7..952f01e 100644 --- a/src/jalview/ext/ensembl/EnsemblCdna.java +++ b/src/jalview/ext/ensembl/EnsemblCdna.java @@ -24,9 +24,6 @@ import jalview.datamodel.SequenceFeature; import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyI; -import java.util.HashMap; -import java.util.Map; - import com.stevesoft.pat.Regex; /** @@ -47,13 +44,6 @@ public class EnsemblCdna extends EnsemblSeqProxy private static final Regex ACCESSION_REGEX = new Regex( "(ENS([A-Z]{3}|)[TG][0-9]{11}$)" + "|" + "(CCDS[0-9.]{3,}$)"); - private static Map params = new HashMap(); - - static - { - params.put("object_type", "transcript"); - } - /* * fetch exon features on genomic sequence (to identify the cdna regions) * and cds and variation features (to retain) @@ -139,13 +129,13 @@ public class EnsemblCdna extends EnsemblSeqProxy } /** - * Parameter object_type=cdna added to ensure cdna and not peptide is returned - * (JAL-2529) + * Parameter object_type=Transcaript added to ensure cdna and not peptide is + * returned (JAL-2529) */ @Override - protected Map getAdditionalParameters() + protected String getObjectType() { - return params; + return OBJECT_TYPE_TRANSCRIPT; } } diff --git a/src/jalview/ext/ensembl/EnsemblFeatures.java b/src/jalview/ext/ensembl/EnsemblFeatures.java index 7570822..cb6f548 100644 --- a/src/jalview/ext/ensembl/EnsemblFeatures.java +++ b/src/jalview/ext/ensembl/EnsemblFeatures.java @@ -82,7 +82,7 @@ class EnsemblFeatures extends EnsemblRestClient public AlignmentI getSequenceRecords(String query) throws IOException { // TODO: use a vararg String... for getSequenceRecords instead? - List queries = new ArrayList(); + List queries = new ArrayList<>(); queries.add(query); FileParse fp = getSequenceReader(queries); if (fp == null || !fp.isValid()) @@ -109,9 +109,17 @@ class EnsemblFeatures extends EnsemblRestClient urlstring.append("?content-type=text/x-gff3"); /* + * specify object_type=gene in case is shared by transcript and/or protein; + * currently only fetching features for gene sequences; + * refactor in future if needed to fetch for transcripts + */ + urlstring.append("&").append(OBJECT_TYPE).append("=") + .append(OBJECT_TYPE_GENE); + + /* * specify features to retrieve * @see http://rest.ensembl.org/documentation/info/overlap_id - * could make the list a configurable entry in jalview.properties + * could make the list a configurable entry in .jalview_properties */ for (EnsemblFeatureType feature : featuresWanted) { diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java index 50dfa90..0d5fc26 100644 --- a/src/jalview/ext/ensembl/EnsemblGene.java +++ b/src/jalview/ext/ensembl/EnsemblGene.java @@ -98,6 +98,12 @@ public class EnsemblGene extends EnsemblSeqProxy return EnsemblSeqType.GENOMIC; } + @Override + protected String getObjectType() + { + return OBJECT_TYPE_GENE; + } + /** * Returns an alignment containing the gene(s) for the given gene or * transcript identifier, or external identifier (e.g. Uniprot id). If given a @@ -146,6 +152,8 @@ public class EnsemblGene extends EnsemblSeqProxy } if (geneAlignment.getHeight() == 1) { + // ensure id has 'correct' case for the Ensembl identifier + geneId = geneAlignment.getSequenceAt(0).getName(); getTranscripts(geneAlignment, geneId); } if (al == null) @@ -170,7 +178,7 @@ public class EnsemblGene extends EnsemblSeqProxy */ List getGeneIds(String accessions) { - List geneIds = new ArrayList(); + List geneIds = new ArrayList<>(); for (String acc : accessions.split(getAccessionSeparator())) { @@ -305,7 +313,7 @@ public class EnsemblGene extends EnsemblSeqProxy int transcriptLength = 0; final char[] geneChars = gene.getSequence(); int offset = gene.getStart(); // to convert to 0-based positions - List mappedFrom = new ArrayList(); + List mappedFrom = new ArrayList<>(); for (SequenceFeature sf : splices) { @@ -347,7 +355,7 @@ public class EnsemblGene extends EnsemblSeqProxy * transfer features to the new sequence; we use EnsemblCdna to do this, * to filter out unwanted features types (see method retainFeature) */ - List mapTo = new ArrayList(); + List mapTo = new ArrayList<>(); mapTo.add(new int[] { 1, transcriptLength }); MapList mapping = new MapList(mappedFrom, mapTo, 1, 1); EnsemblCdna cdna = new EnsemblCdna(getDomain()); @@ -395,7 +403,7 @@ public class EnsemblGene extends EnsemblSeqProxy protected List getTranscriptFeatures(String accId, SequenceI geneSequence) { - List transcriptFeatures = new ArrayList(); + List transcriptFeatures = new ArrayList<>(); String parentIdentifier = GENE_PREFIX + accId; @@ -407,7 +415,7 @@ public class EnsemblGene extends EnsemblSeqProxy for (SequenceFeature sf : sfs) { String parent = (String) sf.getValue(PARENT); - if (parentIdentifier.equals(parent)) + if (parentIdentifier.equalsIgnoreCase(parent)) { transcriptFeatures.add(sf); } @@ -444,8 +452,9 @@ public class EnsemblGene extends EnsemblSeqProxy if (SequenceOntologyFactory.getInstance().isA(sf.getType(), SequenceOntologyI.GENE)) { - String id = (String) sf.getValue(ID); - if ((GENE_PREFIX + accId).equals(id)) + // NB features as gff use 'ID'; rest services return as 'id' + String id = (String) sf.getValue("ID"); + if ((GENE_PREFIX + accId).equalsIgnoreCase(id)) { return true; } @@ -472,7 +481,7 @@ public class EnsemblGene extends EnsemblSeqProxy if (isTranscript(type)) { String parent = (String) sf.getValue(PARENT); - if (!(GENE_PREFIX + accessionId).equals(parent)) + if (!(GENE_PREFIX + accessionId).equalsIgnoreCase(parent)) { return false; } diff --git a/src/jalview/ext/ensembl/EnsemblGenome.java b/src/jalview/ext/ensembl/EnsemblGenome.java index 458a233..bde3c0f 100644 --- a/src/jalview/ext/ensembl/EnsemblGenome.java +++ b/src/jalview/ext/ensembl/EnsemblGenome.java @@ -103,7 +103,7 @@ public class EnsemblGenome extends EnsemblSeqProxy { if (isTranscript(sf.getType())) { - String id = (String) sf.getValue(ID); + String id = (String) sf.getValue("ID"); if (("transcript:" + accId).equals(id)) { return true; diff --git a/src/jalview/ext/ensembl/EnsemblLookup.java b/src/jalview/ext/ensembl/EnsemblLookup.java index 31da9c0..92763a1 100644 --- a/src/jalview/ext/ensembl/EnsemblLookup.java +++ b/src/jalview/ext/ensembl/EnsemblLookup.java @@ -34,22 +34,13 @@ import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; /** - * A client for the Ensembl lookup REST endpoint; used to find the Parent gene - * identifier given a transcript identifier. + * A client for the Ensembl lookup REST endpoint, used to find the gene + * identifier given a gene, transcript or protein identifier. * * @author gmcarstairs - * */ public class EnsemblLookup extends EnsemblRestClient { - - private static final String OBJECT_TYPE_TRANSLATION = "Translation"; - private static final String PARENT = "Parent"; - private static final String OBJECT_TYPE_TRANSCRIPT = "Transcript"; - private static final String ID = "id"; - private static final String OBJECT_TYPE_GENE = "Gene"; - private static final String OBJECT_TYPE = "object_type"; - /** * Default constructor (to use rest.ensembl.org) */ @@ -84,17 +75,26 @@ public class EnsemblLookup extends EnsemblRestClient protected URL getUrl(List ids) throws MalformedURLException { String identifier = ids.get(0); - return getUrl(identifier); + return getUrl(identifier, null); } /** + * Gets the url for lookup of the given identifier, optionally with objectType + * also specified in the request + * * @param identifier + * @param objectType * @return */ - protected URL getUrl(String identifier) + protected URL getUrl(String identifier, String objectType) { String url = getDomain() + "/lookup/id/" + identifier + CONTENT_TYPE_JSON; + if (objectType != null) + { + url += "&" + OBJECT_TYPE + "=" + objectType; + } + try { return new URL(url); @@ -123,20 +123,34 @@ public class EnsemblLookup extends EnsemblRestClient } /** + * Returns the gene id related to the given identifier, which may be for a + * gene, transcript or protein + * + * @param identifier + * @return + */ + public String getGeneId(String identifier) + { + return getGeneId(identifier, null); + } + + /** * Calls the Ensembl lookup REST endpoint and retrieves the 'Parent' for the * given identifier, or null if not found * * @param identifier + * @param objectType + * (optional) * @return */ - public String getGeneId(String identifier) + public String getGeneId(String identifier, String objectType) { List ids = Arrays.asList(new String[] { identifier }); BufferedReader br = null; try { - URL url = getUrl(identifier); + URL url = getUrl(identifier, objectType); if (url != null) { br = getHttpResponse(url, ids); @@ -181,28 +195,19 @@ public class EnsemblLookup extends EnsemblRestClient String type = val.get(OBJECT_TYPE).toString(); if (OBJECT_TYPE_GENE.equalsIgnoreCase(type)) { + // got the gene - just returns its id geneId = val.get(ID).toString(); } else if (OBJECT_TYPE_TRANSCRIPT.equalsIgnoreCase(type)) { + // got the transcript - return its (Gene) Parent geneId = val.get(PARENT).toString(); } else if (OBJECT_TYPE_TRANSLATION.equalsIgnoreCase(type)) { + // got the protein - get its Parent, restricted to type Transcript String transcriptId = val.get(PARENT).toString(); - try - { - geneId = getGeneId(transcriptId); - } catch (StackOverflowError e) - { - /* - * unlikely data condition error! - */ - System.err - .println("** Ensembl lookup " - + getUrl(transcriptId).toString() - + " looping on Parent!"); - } + geneId = getGeneId(transcriptId, OBJECT_TYPE_TRANSCRIPT); } } catch (ParseException e) { diff --git a/src/jalview/ext/ensembl/EnsemblSeqProxy.java b/src/jalview/ext/ensembl/EnsemblSeqProxy.java index 577111e..b2ebb1a 100644 --- a/src/jalview/ext/ensembl/EnsemblSeqProxy.java +++ b/src/jalview/ext/ensembl/EnsemblSeqProxy.java @@ -48,8 +48,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; /** * Base class for Ensembl sequence fetchers @@ -61,10 +59,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient { private static final String ALLELES = "alleles"; - protected static final String PARENT = "Parent"; - - protected static final String ID = "ID"; - protected static final String NAME = "Name"; protected static final String DESCRIPTION = "description"; @@ -209,7 +203,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient try { /* - * get 'dummy' genomic sequence with exon, cds and variation features + * get 'dummy' genomic sequence with gene, transcript, + * exon, cds and variation features */ SequenceI genomicSequence = null; EnsemblFeatures gffFetcher = new EnsemblFeatures(getDomain()); @@ -225,7 +220,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient /* * transfer features to the query sequence */ - SequenceI querySeq = alignment.findName(accId); + SequenceI querySeq = alignment.findName(accId, true); if (transferFeatures(accId, genomicSequence, querySeq)) { @@ -472,14 +467,11 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient urlstring.append("?type=").append(getSourceEnsemblType().getType()); urlstring.append(("&Accept=text/x-fasta")); - Map params = getAdditionalParameters(); - if (params != null) + String objectType = getObjectType(); + if (objectType != null) { - for (Entry entry : params.entrySet()) - { - urlstring.append("&").append(entry.getKey()).append("=") - .append(entry.getValue()); - } + urlstring.append("&").append(OBJECT_TYPE).append("=") + .append(objectType); } URL url = new URL(urlstring.toString()); @@ -487,11 +479,11 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient } /** - * Override this method to add any additional x=y URL parameters needed + * Override this method to specify object_type request parameter * * @return */ - protected Map getAdditionalParameters() + protected String getObjectType() { return null; } @@ -560,7 +552,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient protected MapList getGenomicRangesFromFeatures(SequenceI sourceSequence, String accId, int start) { - // SequenceFeature[] sfs = sourceSequence.getSequenceFeatures(); List sfs = sourceSequence.getFeatures() .getPositionalFeatures(); if (sfs.isEmpty()) @@ -572,7 +563,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient * generously initial size for number of cds regions * (worst case titin Q8WZ42 has c. 313 exons) */ - List regions = new ArrayList(100); + List regions = new ArrayList<>(100); int mappedLength = 0; int direction = 1; // forward boolean directionSet = false; @@ -871,7 +862,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient { String parent = (String) sf.getValue(PARENT); // using contains to allow for prefix "gene:", "transcript:" etc - if (parent != null && !parent.contains(identifier)) + if (parent != null + && !parent.toUpperCase().contains(identifier.toUpperCase())) { // this genomic feature belongs to a different transcript return false; @@ -899,14 +891,14 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient protected List findFeatures(SequenceI sequence, String term, String parentId) { - List result = new ArrayList(); + List result = new ArrayList<>(); List sfs = sequence.getFeatures() .getFeaturesByOntology(term); for (SequenceFeature sf : sfs) { String parent = (String) sf.getValue(PARENT); - if (parent != null && parent.equals(parentId)) + if (parent != null && parent.equalsIgnoreCase(parentId)) { result.add(sf); } diff --git a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java index 598dba1..c4abb20 100644 --- a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java +++ b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java @@ -45,6 +45,18 @@ abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl protected static final String ENSEMBL_REST = "http://rest.ensembl.org"; + protected static final String OBJECT_TYPE_TRANSLATION = "Translation"; + + protected static final String OBJECT_TYPE_TRANSCRIPT = "Transcript"; + + protected static final String OBJECT_TYPE_GENE = "Gene"; + + protected static final String PARENT = "Parent"; + + protected static final String ID = "id"; + + protected static final String OBJECT_TYPE = "object_type"; + /* * possible values for the 'feature' parameter of the /overlap REST service * @see http://rest.ensembl.org/documentation/info/overlap_id diff --git a/src/jalview/ext/ensembl/EnsemblSymbol.java b/src/jalview/ext/ensembl/EnsemblSymbol.java index 75598a0..e3b6c93 100644 --- a/src/jalview/ext/ensembl/EnsemblSymbol.java +++ b/src/jalview/ext/ensembl/EnsemblSymbol.java @@ -44,8 +44,6 @@ public class EnsemblSymbol extends EnsemblXref { private static final String GENE = "gene"; private static final String TYPE = "type"; - private static final String ID = "id"; - /** * Constructor given the target domain to fetch data from * diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index 9802d4b..86710e1 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -92,7 +92,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected JTabbedPane tabs = new JTabbedPane(); protected IProgressIndicator progressIndicator; - protected JComboBox cmb_searchTarget = new JComboBox(); + protected JComboBox cmb_searchTarget = new JComboBox<>(); protected JButton btn_ok = new JButton(); @@ -151,7 +151,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected int pageLimit; - protected HashSet paginatorCart = new HashSet(); + protected HashSet paginatorCart = new HashSet<>(); private static final int MIN_WIDTH = 670; @@ -293,7 +293,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI private void jbInit() throws Exception { - txt_search = new JvCacheableInputBox(getCacheKey()); + txt_search = new JvCacheableInputBox<>(getCacheKey()); populateCmbSearchTargetOptions(); Integer width = getTempUserPrefs().get("FTSPanel.width") == null ? 800 : getTempUserPrefs().get("FTSPanel.width"); @@ -681,7 +681,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI if (tabs != null) { tabs.setOpaque(true); - tabs.insertTab("Free Text Search", null, this, "", 0); + tabs.insertTab(MessageManager.getString("label.free_text_search"), + null, this, "", 0); mainFrame.setContentPane(tabs); tabs.setVisible(true); } @@ -871,7 +872,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI */ public void populateCmbSearchTargetOptions() { - List searchableTargets = new ArrayList(); + List searchableTargets = new ArrayList<>(); try { Collection foundFTSTargets = getFTSRestClient() diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 6635dbe..aa8369a 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -527,6 +527,8 @@ public class Preferences extends GPreferences userIdWidthlabel.setEnabled(!autoIdWidth.isSelected()); Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH"); userIdWidth.setText(wi == null ? "" : wi.toString()); + // TODO: refactor to use common enum via FormatAdapter and allow extension + // for new flat file formats blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true)); clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true)); fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true)); diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index cdf84b7..fb81f4d 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -782,8 +782,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI * white fill the region to be drawn (so incremental fast paint doesn't * scribble over an existing image) */ - gg.setColor(Color.white); - gg.fillRect(0, ypos, (endx - startColumn + 1) * charWidth, + g.setColor(Color.white); + g.fillRect(0, ypos, (endx - startColumn + 1) * charWidth, wrappedRepeatHeightPx); drawPanel(g, startColumn, endx, 0, av.getAlignment().getHeight() - 1, @@ -1389,9 +1389,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI int startRes, int endRes, int startSeq, int endSeq, int verticalOffset) { - int charHeight = av.getCharHeight(); - int charWidth = av.getCharWidth(); - + int charHeight = av.getCharHeight(); + int charWidth = av.getCharWidth(); int visWidth = (endRes - startRes + 1) * charWidth; int oldY = -1; @@ -1399,140 +1398,141 @@ public class SeqCanvas extends JComponent implements ViewportListenerI boolean inGroup = false; int top = -1; int bottom = -1; - - int sx = -1; int sy = -1; - int xwidth = -1; - for (i = startSeq; i <= endSeq; i++) - { - // position of start residue of group relative to startRes, in pixels - sx = (group.getStartRes() - startRes) * charWidth; - - // width of group in pixels - xwidth = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) - - 1; + List seqs = group.getSequences(null); - sy = verticalOffset + (i - startSeq) * charHeight; + // position of start residue of group relative to startRes, in pixels + int sx = (group.getStartRes() - startRes) * charWidth; - if (sx + xwidth < 0 || sx > visWidth) - { - continue; - } + // width of group in pixels + int xwidth = (((group.getEndRes() + 1) - group.getStartRes()) + * charWidth) - 1; - if ((sx <= (endRes - startRes) * charWidth) - && group.getSequences(null) - .contains(av.getAlignment().getSequenceAt(i))) + if (!(sx + xwidth < 0 || sx > visWidth)) + { + for (i = startSeq; i <= endSeq; i++) { - if ((bottom == -1) && !group.getSequences(null) - .contains(av.getAlignment().getSequenceAt(i + 1))) - { - bottom = sy + charHeight; - } - - if (!inGroup) - { - if (((top == -1) && (i == 0)) || !group.getSequences(null) - .contains(av.getAlignment().getSequenceAt(i - 1))) - { - top = sy; - } + sy = verticalOffset + (i - startSeq) * charHeight; - oldY = sy; - inGroup = true; - } - } - else - { - if (inGroup) + if ((sx <= (endRes - startRes) * charWidth) + && seqs.contains(av.getAlignment().getSequenceAt(i))) { - // if start position is visible, draw vertical line to left of - // group - if (sx >= 0 && sx < visWidth) - { - g.drawLine(sx, oldY, sx, sy); - } - - // if end position is visible, draw vertical line to right of - // group - if (sx + xwidth < visWidth) + if ((bottom == -1) + && !seqs.contains(av.getAlignment().getSequenceAt(i + 1))) { - g.drawLine(sx + xwidth, oldY, sx + xwidth, sy); + bottom = sy + charHeight; } - if (sx < 0) + if (!inGroup) { - xwidth += sx; - sx = 0; - } - - // don't let width extend beyond current block, or group extent - // fixes JAL-2672 - if (sx + xwidth >= (endRes - startRes + 1) * charWidth) - { - xwidth = (endRes - startRes + 1) * charWidth - sx; - } - - // draw horizontal line at top of group - if (top != -1) - { - g.drawLine(sx, top, sx + xwidth, top); - top = -1; - } + if (((top == -1) && (i == 0)) || !seqs + .contains(av.getAlignment().getSequenceAt(i - 1))) + { + top = sy; + } - // draw horizontal line at bottom of group - if (bottom != -1) - { - g.drawLine(sx, bottom, sx + xwidth, bottom); - bottom = -1; + oldY = sy; + inGroup = true; } + } + else if (inGroup) + { + drawVerticals(g, sx, xwidth, visWidth, oldY, sy); + drawHorizontals(g, sx, xwidth, visWidth, top, bottom); + // reset top and bottom + top = -1; + bottom = -1; inGroup = false; } } - } - - if (inGroup) - { - sy = verticalOffset + ((i - startSeq) * charHeight); - if (sx >= 0 && sx < visWidth) + if (inGroup) { - g.drawLine(sx, oldY, sx, sy); + sy = verticalOffset + ((i - startSeq) * charHeight); + drawVerticals(g, sx, xwidth, visWidth, oldY, sy); + drawHorizontals(g, sx, xwidth, visWidth, top, bottom); } + } + } - if (sx + xwidth < visWidth) - { - g.drawLine(sx + xwidth, oldY, sx + xwidth, sy); - } + /** + * Draw horizontal selection group boundaries at top and bottom positions + * + * @param g + * graphics object to draw on + * @param sx + * start x position + * @param xwidth + * width of gap + * @param visWidth + * visWidth maximum available width + * @param top + * position to draw top of group at + * @param bottom + * position to draw bottom of group at + */ + private void drawHorizontals(Graphics2D g, int sx, int xwidth, + int visWidth, int top, int bottom) + { + int width = xwidth; + int startx = sx; + if (startx < 0) + { + width += startx; + startx = 0; + } - if (sx < 0) - { - xwidth += sx; - sx = 0; - } + // don't let width extend beyond current block, or group extent + // fixes JAL-2672 + if (startx + width >= visWidth) + { + width = visWidth - startx; + } - if (sx + xwidth > visWidth) - { - xwidth = visWidth; - } - else if (sx + xwidth >= (endRes - startRes + 1) * charWidth) - { - xwidth = (endRes - startRes + 1) * charWidth; - } + if (top != -1) + { + g.drawLine(startx, top, startx + width, top); + } - if (top != -1) - { - g.drawLine(sx, top, sx + xwidth, top); - top = -1; - } + if (bottom != -1) + { + g.drawLine(startx, bottom - 1, startx + width, bottom - 1); + } + } - if (bottom != -1) - { - g.drawLine(sx, bottom - 1, sx + xwidth, bottom - 1); - bottom = -1; - } + /** + * Draw vertical lines at sx and sx+xwidth providing they lie within + * [0,visWidth) + * + * @param g + * graphics object to draw on + * @param sx + * start x position + * @param xwidth + * width of gap + * @param visWidth + * visWidth maximum available width + * @param oldY + * top y value + * @param sy + * bottom y value + */ + private void drawVerticals(Graphics2D g, int sx, int xwidth, int visWidth, + int oldY, int sy) + { + // if start position is visible, draw vertical line to left of + // group + if (sx >= 0 && sx < visWidth) + { + g.drawLine(sx, oldY, sx, sy); + } - inGroup = false; + // if end position is visible, draw vertical line to right of + // group + if (sx + xwidth < visWidth) + { + g.drawLine(sx + xwidth, oldY, sx + xwidth, sy); } } @@ -1619,7 +1619,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI */ protected boolean drawMappedPositions(SearchResultsI results) { - if (results == null) + if ((results == null) || (gg == null)) // JAL-2784 check gg is not null { return false; } @@ -1775,12 +1775,19 @@ public class SeqCanvas extends JComponent implements ViewportListenerI { fastPaint(scrollX, 0); } - // bizarrely, we only need to scroll on the x value here as fastpaint - // copies the full height of the image anyway. Passing in the y value - // causes nasty repaint artefacts, which only disappear on a full - // repaint. + } + else if (eventName.equals(ViewportRanges.STARTSEQ)) + { + // scroll + fastPaint(0, (int) evt.getNewValue() - (int) evt.getOldValue()); + } + else if (eventName.equals(ViewportRanges.STARTRESANDSEQ)) + { + if (av.getWrapAlignment()) + { + fastPaintWrapped(scrollX); } - + } } /** @@ -2048,7 +2055,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI */ protected boolean drawMappedPositionsWrapped(SearchResultsI results) { - if (results == null) + if ((results == null) || (gg == null)) // JAL-2784 check gg is not null { return false; } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 9359569..84b85e9 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -434,7 +434,10 @@ public class SeqPanel extends JPanel { if (av.getWrapAlignment()) { - av.getRanges().scrollToWrappedVisible(seqCanvas.cursorX); + // scrollToWrappedVisible expects x-value to have hidden cols subtracted + int x = av.getAlignment().getHiddenColumns() + .absoluteToVisibleColumn(seqCanvas.cursorX); + av.getRanges().scrollToWrappedVisible(x); } else { diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 37632ef..217f653 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -525,7 +525,7 @@ public class StructureChooser extends GStructureChooser * structures */ protected void populateFilterComboBox(boolean haveData, - boolean cachedPDBExists) + boolean cachedPDBExist) { /* * temporarily suspend the change listener behaviour @@ -535,25 +535,33 @@ public class StructureChooser extends GStructureChooser cmb_filterOption.removeAllItems(); if (haveData) { - cmb_filterOption.addItem(new FilterOption("Best Quality", + cmb_filterOption.addItem(new FilterOption( + MessageManager.getString("label.best_quality"), "overall_quality", VIEWS_FILTER, false)); - cmb_filterOption.addItem(new FilterOption("Best Resolution", + cmb_filterOption.addItem(new FilterOption( + MessageManager.getString("label.best_resolution"), "resolution", VIEWS_FILTER, false)); - cmb_filterOption.addItem(new FilterOption("Most Protein Chain", + cmb_filterOption.addItem(new FilterOption( + MessageManager.getString("label.most_protein_chain"), "number_of_protein_chains", VIEWS_FILTER, false)); - cmb_filterOption.addItem(new FilterOption("Most Bound Molecules", + cmb_filterOption.addItem(new FilterOption( + MessageManager.getString("label.most_bound_molecules"), "number_of_bound_molecules", VIEWS_FILTER, false)); - cmb_filterOption.addItem(new FilterOption("Most Polymer Residues", + cmb_filterOption.addItem(new FilterOption( + MessageManager.getString("label.most_polymer_residues"), "number_of_polymer_residues", VIEWS_FILTER, true)); } cmb_filterOption.addItem( - new FilterOption("Enter PDB Id", "-", VIEWS_ENTER_ID, false)); + new FilterOption(MessageManager.getString("label.enter_pdb_id"), + "-", VIEWS_ENTER_ID, false)); cmb_filterOption.addItem( - new FilterOption("From File", "-", VIEWS_FROM_FILE, false)); + new FilterOption(MessageManager.getString("label.from_file"), + "-", VIEWS_FROM_FILE, false)); - if (cachedPDBExists) + if (cachedPDBExist) { - FilterOption cachedOption = new FilterOption("Cached PDB Entries", + FilterOption cachedOption = new FilterOption( + MessageManager.getString("label.cached_structures"), "-", VIEWS_LOCAL_PDB, false); cmb_filterOption.addItem(cachedOption); cmb_filterOption.setSelectedItem(cachedOption); diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index b142613..fb37b77 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -154,6 +154,10 @@ public class StructureViewer PDBEntry pdb = pdbs[i]; SequenceI seq = seqs[i]; String pdbFile = pdb.getFile(); + if (pdbFile == null || pdbFile.length() == 0) + { + pdbFile = pdb.getId(); + } if (!pdbsSeen.containsKey(pdbFile)) { pdbsSeen.put(pdbFile, pdb); diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 6a28b1d..6d3c18a 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -161,7 +161,8 @@ public class FormatAdapter extends AppletFormatAdapter public boolean getCacheSuffixDefault(FileFormatI format) { - return Cache.getDefault(format.getName() + "_JVSUFFIX", true); + return Cache.getDefault(format.getName().toUpperCase() + "_JVSUFFIX", + true); } public String formatSequences(FileFormatI format, AlignmentI alignment, diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index 7c4672a..9bcaa5a 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -91,7 +91,7 @@ public abstract class GStructureChooser extends JPanel protected JInternalFrame mainFrame = new JInternalFrame(frameTitle); - protected JComboBox cmb_filterOption = new JComboBox(); + protected JComboBox cmb_filterOption = new JComboBox<>(); protected AlignmentPanel ap; @@ -182,7 +182,7 @@ public abstract class GStructureChooser extends JPanel protected FTSDataColumnI[] previousWantedFields; - protected static Map tempUserPrefs = new HashMap(); + protected static Map tempUserPrefs = new HashMap<>(); private JTable tbl_summary = new JTable() { @@ -474,7 +474,7 @@ public abstract class GStructureChooser extends JPanel chk_rememberSettings.setFont(new java.awt.Font("Verdana", 0, 12)); chk_rememberSettings.setVisible(false); txt_search.setToolTipText(JvSwingUtils.wrapTooltip(true, - MessageManager.getString("label.enter_pdb_id"))); + MessageManager.getString("label.enter_pdb_id_tip"))); cmb_filterOption.setToolTipText( MessageManager.getString("info.select_filter_option")); txt_search.getDocument().addDocumentListener(new DocumentListener() @@ -803,7 +803,7 @@ public abstract class GStructureChooser extends JPanel */ public class AssciateSeqPanel extends JPanel implements ItemListener { - private JComboBox cmb_assSeq = new JComboBox(); + private JComboBox cmb_assSeq = new JComboBox<>(); private JLabel lbl_associateSeq = new JLabel(); diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 25a81f9..adca17e 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -162,7 +162,8 @@ public class AnnotationRenderer boolean validRes, boolean validEnd) { g.setColor(STEM_COLOUR); - int sCol = (lastSSX / charWidth) + startRes; + int sCol = (lastSSX / charWidth) + + hiddenColumns.visibleToAbsoluteColumn(startRes); int x1 = lastSSX; int x2 = (x * charWidth); @@ -228,7 +229,8 @@ public class AnnotationRenderer // System.out.println(nonCanColor); g.setColor(nonCanColor); - int sCol = (lastSSX / charWidth) + startRes; + int sCol = (lastSSX / charWidth) + + hiddenColumns.visibleToAbsoluteColumn(startRes); int x1 = lastSSX; int x2 = (x * charWidth); @@ -1147,7 +1149,8 @@ public class AnnotationRenderer { g.setColor(HELIX_COLOUR); - int sCol = (lastSSX / charWidth) + startRes; + int sCol = (lastSSX / charWidth) + + hiddenColumns.visibleToAbsoluteColumn(startRes); int x1 = lastSSX; int x2 = (x * charWidth); diff --git a/src/jalview/util/IntRangeComparator.java b/src/jalview/util/IntRangeComparator.java index cb32a0e..a0a29f2 100644 --- a/src/jalview/util/IntRangeComparator.java +++ b/src/jalview/util/IntRangeComparator.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.util; import java.util.Comparator; diff --git a/src/jalview/viewmodel/ViewportRanges.java b/src/jalview/viewmodel/ViewportRanges.java index b06ae59..691e492 100644 --- a/src/jalview/viewmodel/ViewportRanges.java +++ b/src/jalview/viewmodel/ViewportRanges.java @@ -544,7 +544,8 @@ public class ViewportRanges extends ViewportProperties * the startRes changed, else false. * * @param res - * residue position to scroll to + * residue position to scroll to NB visible position not absolute + * alignment position * @return */ public boolean scrollToWrappedVisible(int res) @@ -592,9 +593,9 @@ public class ViewportRanges extends ViewportProperties * Scroll so that (x,y) is visible. Fires a property change event. * * @param x - * x position in alignment + * x position in alignment (absolute position) * @param y - * y position in alignment + * y position in alignment (absolute position) */ public void scrollToVisible(int x, int y) { diff --git a/test/jalview/ext/ensembl/EnsemblCdnaTest.java b/test/jalview/ext/ensembl/EnsemblCdnaTest.java index 6611e05..779962c 100644 --- a/test/jalview/ext/ensembl/EnsemblCdnaTest.java +++ b/test/jalview/ext/ensembl/EnsemblCdnaTest.java @@ -228,6 +228,9 @@ public class EnsemblCdnaTest sf.setValue("Parent", "transcript:" + accId); assertTrue(testee.retainFeature(sf, accId)); + // test is not case-sensitive + assertTrue(testee.retainFeature(sf, accId.toLowerCase())); + // feature with wrong parent is not retained sf.setValue("Parent", "transcript:XYZ"); assertFalse(testee.retainFeature(sf, accId)); diff --git a/test/jalview/ext/ensembl/EnsemblGeneTest.java b/test/jalview/ext/ensembl/EnsemblGeneTest.java index 5920b89..1b1a2b4 100644 --- a/test/jalview/ext/ensembl/EnsemblGeneTest.java +++ b/test/jalview/ext/ensembl/EnsemblGeneTest.java @@ -173,7 +173,8 @@ public class EnsemblGeneTest // NMD_transcript_variant treated like transcript in Ensembl SequenceFeature sf3 = new SequenceFeature("NMD_transcript_variant", "", 22000, 22500, 0f, null); - sf3.setValue("Parent", "gene:" + geneId); + // id matching should not be case-sensitive + sf3.setValue("Parent", "gene:" + geneId.toLowerCase()); sf3.setValue("transcript_id", "transcript3"); genomic.addSequenceFeature(sf3); @@ -259,6 +260,9 @@ public class EnsemblGeneTest sf.setValue("ID", "gene:" + accId); assertTrue(testee.identifiesSequence(sf, accId)); + // test is not case-sensitive + assertTrue(testee.identifiesSequence(sf, accId.toLowerCase())); + // transcript not valid: sf = new SequenceFeature("transcript", "", 1, 2, 0f, null); sf.setValue("ID", "gene:" + accId); diff --git a/test/jalview/gui/StructureChooserTest.java b/test/jalview/gui/StructureChooserTest.java index 4535c93..91fe602 100644 --- a/test/jalview/gui/StructureChooserTest.java +++ b/test/jalview/gui/StructureChooserTest.java @@ -65,7 +65,7 @@ public class StructureChooserTest PDBEntry dbRef = new PDBEntry(); dbRef.setId("1tim"); - Vector pdbIds = new Vector(); + Vector pdbIds = new Vector<>(); pdbIds.add(dbRef); seq.setPDBId(pdbIds); @@ -133,7 +133,7 @@ public class StructureChooserTest assertTrue(sc.getCmbFilterOption().getSelectedItem() != null); FilterOption filterOpt = (FilterOption) sc.getCmbFilterOption() .getSelectedItem(); - assertEquals("Cached PDB Entries", filterOpt.getName()); + assertEquals("Cached Structures", filterOpt.getName()); } @Test(groups = { "Network" }) diff --git a/test/jalview/gui/StructureViewerTest.java b/test/jalview/gui/StructureViewerTest.java index 4d5b114..86342d2 100644 --- a/test/jalview/gui/StructureViewerTest.java +++ b/test/jalview/gui/StructureViewerTest.java @@ -39,8 +39,10 @@ public class StructureViewerTest PDBEntry pdbe4 = new PDBEntry("1GAQ", "A", Type.PDB, null); PDBEntry pdbe5 = new PDBEntry("3A6S", "B", Type.PDB, "path2"); PDBEntry pdbe6 = new PDBEntry("1GAQ", "B", Type.PDB, null); + PDBEntry pdbe7 = new PDBEntry("1FOO", "Q", Type.PDB, null); + PDBEntry[] pdbs = new PDBEntry[] { pdbe1, pdbe2, pdbe3, pdbe4, pdbe5, - pdbe6 }; + pdbe6, pdbe7 }; /* * seq1 ... seq6 associated with pdbe1 ... pdbe6 @@ -61,6 +63,7 @@ public class StructureViewerTest assertTrue(uniques.containsKey(pdbe4)); assertFalse(uniques.containsKey(pdbe5)); assertFalse(uniques.containsKey(pdbe6)); + assertTrue(uniques.containsKey(pdbe7)); // 1A70 associates with seq1 and seq3 SequenceI[] ss = uniques.get(pdbe1); @@ -79,5 +82,10 @@ public class StructureViewerTest assertEquals(ss.length, 2); assertSame(seqs[3], ss[0]); assertSame(seqs[5], ss[1]); + + // 1FOO has seq7 + ss = uniques.get(pdbe7); + assertEquals(ss.length, 1); + assertSame(seqs[6], ss[0]); } } diff --git a/utils/InstallAnywhere/Jalview.iap_xml b/utils/InstallAnywhere/Jalview.iap_xml index abe9d4b..a649cb4 100755 --- a/utils/InstallAnywhere/Jalview.iap_xml +++ b/utils/InstallAnywhere/Jalview.iap_xml @@ -2025,7 +2025,7 @@ and any path to a file to save to the file]]> - + false @@ -2043,7 +2043,7 @@ and any path to a file to save to the file]]> true - + 6149494 @@ -5270,7 +5270,7 @@ Press "Done" to quit the installer.]]> - + @@ -5366,7 +5366,7 @@ Press "Done" to quit the installer.]]> - +