Merge branch 'develop' into features/JAL-1793VCF
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 26 Jan 2018 14:53:22 +0000 (14:53 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 26 Jan 2018 14:53:22 +0000 (14:53 +0000)
Conflicts:
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/ext/ensembl/EnsemblGene.java
src/jalview/ext/ensembl/EnsemblLookup.java
src/jalview/ext/ensembl/EnsemblSeqProxy.java

22 files changed:
RELEASE
benchmarking/README
help/help.jhm
help/html/releases.html
help/html/whatsNew.html
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/ext/ensembl/EnsemblCdna.java
src/jalview/ext/ensembl/EnsemblFeatures.java
src/jalview/ext/ensembl/EnsemblGene.java
src/jalview/ext/ensembl/EnsemblGenome.java
src/jalview/ext/ensembl/EnsemblLookup.java
src/jalview/ext/ensembl/EnsemblSeqProxy.java
src/jalview/ext/ensembl/EnsemblSequenceFetcher.java
src/jalview/ext/ensembl/EnsemblSymbol.java
src/jalview/fts/core/GFTSPanel.java
src/jalview/gui/StructureChooser.java
src/jalview/jbgui/GStructureChooser.java
test/jalview/ext/ensembl/EnsemblCdnaTest.java
test/jalview/ext/ensembl/EnsemblGeneTest.java
test/jalview/ext/ensembl/EnsemblSeqProxyTest.java
test/jalview/gui/StructureChooserTest.java

diff --git a/RELEASE b/RELEASE
index f1faf34..eb9d7cd 100644 (file)
--- 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
index fac0bf6..ccf53c1 100644 (file)
@@ -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
@@ -24,4 +27,14 @@ to install the jalview.jar file in the local maven repository. The pom.xml in th
   To get JSON output instead use:
   java -jar target/benchmarks.jar -rf json
   
-  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.
index 010bca8..732f01b 100755 (executable)
@@ -22,7 +22,7 @@
    <mapID target="home" url="html/index.html" />
    
    <mapID target="new" url="html/whatsNew.html"/>
-   <mapID target="release" url="html/releases.html#Jalview.2.10.3"/>
+   <mapID target="release" url="html/releases.html#Jalview.2.10.3b1"/>
    <mapID target="alannotation" url="html/features/annotation.html"/>
    <mapID target="keys" url="html/keys.html"/>
    <mapID target="newkeys" url="html/features/newkeystrokes.html"/>
index a36e31a..83d2ce4 100755 (executable)
@@ -68,22 +68,26 @@ li:before {
       </td>
     </tr>
     <tr>
-      <td width=="60" nowrap>
+      <td width="60" nowrap>
         <div align="center">
-          <strong><a name="Jalview.2.10.3b1">2.10.3b1</a><br /> <em>5/12/2017</em></strong>
+          <strong><a name="Jalview.2.10.3b1">2.10.3b1</a><br /> <em>24/1/2018</em></strong>
         </div>
       </td>
       <td><div align="left">
-          <em></em>
-      </td>
+          <ul><li>Updated Certum Codesigning Certificate
+              (Valid till 30th November 2018)</li></ul></div></td>
       <td><div align="left">
+          <em>Desktop</em><ul>
           <ul>
+            <li><!-- JAL-2859-->Only one structure is loaded when several sequences and structures are selected for viewing/superposing</li>
             <li><!-- JAL-2851-->Alignment doesn't appear to scroll vertically via trackpad and scrollwheel</li>
             <li><!-- JAL-2842-->Jalview hangs if up/down arrows pressed in cursor mode when cursor lies in hidden region at start of alignment</li>
             <li><!-- JAL-2827-->Helix annotation has 'notches' when scrolled into view if columns are hidden</li>
             <li><!-- JAL-2740-->Annotation column filter can be slow to reset (ie after hitting cancel) for large numbers of hidden columns</li>
-            <li><!-- JAL-2849-->User preference for disabling inclusion of sequence limits when exporting as flat file has no effect</li>
-          <ul>
+            <li><!-- JAL-2849-->User preference for disabling inclusion of sequence limits when exporting as flat file has no effect</li>             
+            <li><!-- JAL-2679-->Reproducible cross-reference relationships when retrieving sequences from EnsemblGenomes</li>  
+          </ul>
+          </div>
       </td>
     </tr>
     <tr>
index 4bf1cec..6d75f0f 100755 (executable)
 </head>
 <body>
   <p>
-    <strong>What's new in Jalview 2.10.3 ?</strong>
+    <strong>What's new in Jalview 2.10.3b1 ?</strong>
   </p>
   <p>
-    Version 2.10.3 was released in November 2017. The major focus was to
-    improve Jalview's sequence features datamodel and the scalability of
-    the alignment rendering system. The full list of bug fixes and new
-    features can be found in the <a href="releases.html#Jalview.2.10.3">2.10.3
-      Release Notes</a>. Key improvements include:
+    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 <a href="releases.html#Jalview.2.10.3b1">2.10.3b1
+      Release Notes</a>. In addition, Jalview 2.10.3 provides:
   </p>
   <ul>
     <li>Faster and more responsive UI when importing and working
index 1277a86..0f801eb 100644 (file)
@@ -678,7 +678,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...
@@ -1345,7 +1346,7 @@ label.score = Score
 label.colour_by_label = Colour by label
 label.variable_colour = Variable colour
 label.select_colour = Select colour
-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
 label.display_settings_for = Display settings for {0} features
@@ -1359,3 +1360,10 @@ label.filters_tooltip = Click to set or amend filters
 label.or = Or
 label.and = And
 label.sequence_feature_colours = Sequence Feature Colours
+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
index 616cb9d..d035e73 100644 (file)
@@ -337,6 +337,8 @@ label.optimise_order = Optimizar orden
 label.seq_sort_by_score = Ordenar las secuencias por puntuación
 label.load_colours = Cargar colores
 label.save_colours = Guardar colores
+label.load_colours_tooltip = Cargar colores y filtros desde fichero
+label.save_colours_tooltip = Guardar colores y filtros en fichero
 label.fetch_das_features = Recuperar funciones DAS
 label.selected_database_to_fetch_from = Seleccionada {0} Base de datos {1} para buscar de {2} 
 label.database_param = Base de datos: {0}
@@ -630,6 +632,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}
@@ -1344,8 +1347,8 @@ label.score = Puntuaci
 label.colour_by_label = Colorear por texto
 label.variable_colour = Color variable
 label.select_colour = Seleccionar color
-option.enable_disable_autosearch = Marque para buscar automáticamente
-option.autosearch = Búsqueda automática
+option.enable_disable_autosearch = Marcar para buscar automáticamente
+option.autosearch = Auto búsqueda
 label.retrieve_ids = Recuperar IDs
 label.display_settings_for = Visualización de características {0}
 label.simple = Simple
@@ -1356,4 +1359,12 @@ label.by_text_of = Por texto de
 label.by_range_of = Por rango de
 label.filters_tooltip = Haga clic para configurar o modificar los filtros
 label.or = O
-label.and = Y
\ No newline at end of file
+label.and = Y
+label.sequence_feature_colours = Colores de características de las secuencias
+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
index 6d031b7..952f01e 100644 (file)
@@ -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<String, String> params = new HashMap<String, String>();
-
-  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<String, String> getAdditionalParameters()
+  protected String getObjectType()
   {
-    return params;
+    return OBJECT_TYPE_TRANSCRIPT;
   }
 
 }
index 7570822..cb6f548 100644 (file)
@@ -82,7 +82,7 @@ class EnsemblFeatures extends EnsemblRestClient
   public AlignmentI getSequenceRecords(String query) throws IOException
   {
     // TODO: use a vararg String... for getSequenceRecords instead?
-    List<String> queries = new ArrayList<String>();
+    List<String> 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)
     {
index cdcfa96..7e6f653 100644 (file)
@@ -100,6 +100,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
@@ -149,7 +155,11 @@ public class EnsemblGene extends EnsemblSeqProxy
       
       if (geneAlignment.getHeight() == 1)
       {
+        // ensure id has 'correct' case for the Ensembl identifier
+        geneId = geneAlignment.getSequenceAt(0).getName();
+
         findGeneLoci(geneAlignment.getSequenceAt(0), geneId);
+
         getTranscripts(geneAlignment, geneId);
       }
       if (al == null)
@@ -235,7 +245,7 @@ public class EnsemblGene extends EnsemblSeqProxy
    */
   List<String> getGeneIds(String accessions)
   {
-    List<String> geneIds = new ArrayList<String>();
+    List<String> geneIds = new ArrayList<>();
 
     for (String acc : accessions.split(getAccessionSeparator()))
     {
@@ -370,7 +380,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<int[]> mappedFrom = new ArrayList<int[]>();
+    List<int[]> mappedFrom = new ArrayList<>();
 
     for (SequenceFeature sf : splices)
     {
@@ -412,7 +422,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<int[]> mapTo = new ArrayList<int[]>();
+    List<int[]> mapTo = new ArrayList<>();
     mapTo.add(new int[] { 1, transcriptLength });
     MapList mapping = new MapList(mappedFrom, mapTo, 1, 1);
     EnsemblCdna cdna = new EnsemblCdna(getDomain());
@@ -498,7 +508,7 @@ public class EnsemblGene extends EnsemblSeqProxy
   protected List<SequenceFeature> getTranscriptFeatures(String accId,
           SequenceI geneSequence)
   {
-    List<SequenceFeature> transcriptFeatures = new ArrayList<SequenceFeature>();
+    List<SequenceFeature> transcriptFeatures = new ArrayList<>();
 
     String parentIdentifier = GENE_PREFIX + accId;
 
@@ -510,7 +520,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);
       }
@@ -547,8 +557,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;
       }
@@ -575,7 +586,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;
       }
index 458a233..bde3c0f 100644 (file)
@@ -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;
index 0d1b554..4c43281 100644 (file)
@@ -39,7 +39,9 @@ import org.json.simple.parser.JSONParser;
 import org.json.simple.parser.ParseException;
 
 /**
- * A client for the Ensembl lookup REST endpoint
+ * A client for the Ensembl /lookup REST endpoint, used to find the gene
+ * identifier given a gene, transcript or protein identifier, or to extract the
+ * species or chromosomal coordinates from the same service response
  * 
  * @author gmcarstairs
  */
@@ -47,14 +49,6 @@ public class EnsemblLookup extends EnsemblRestClient
 {
   private static final String SPECIES = "species";
 
-  private static final String PARENT = "Parent";
-
-  private static final String OBJECT_TYPE_TRANSLATION = "Translation";
-  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)
    */
@@ -89,17 +83,26 @@ public class EnsemblLookup extends EnsemblRestClient
   protected URL getUrl(List<String> 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);
@@ -128,20 +131,15 @@ public class EnsemblLookup extends EnsemblRestClient
   }
 
   /**
-   * Calls the Ensembl lookup REST endpoint and returns
-   * <ul>
-   * <li>the 'id' for the identifier if its type is "Gene"</li>
-   * <li>the 'Parent' if its type is 'Transcript'</li>
-   * <ul>
-   * If the type is 'Translation', does a recursive call to this method, passing
-   * in the 'Parent' (transcript id).
+   * 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 (String) getResult(identifier, br -> parseGeneId(br));
+    return (String) getResult(identifier, null, br -> parseGeneId(br));
   }
 
   /**
@@ -153,7 +151,8 @@ public class EnsemblLookup extends EnsemblRestClient
    */
   public String getSpecies(String identifier)
   {
-    return (String) getResult(identifier, br -> getAttribute(br, SPECIES));
+    return (String) getResult(identifier, null,
+            br -> getAttribute(br, SPECIES));
   }
 
   /**
@@ -161,10 +160,12 @@ public class EnsemblLookup extends EnsemblRestClient
    * response to the supplied parser
    * 
    * @param identifier
+   * @param objectType
+   *          (optional)
    * @param parser
    * @return
    */
-  protected Object getResult(String identifier,
+  protected Object getResult(String identifier, String objectType,
           Function<BufferedReader, Object> parser)
   {
     List<String> ids = Arrays.asList(new String[] { identifier });
@@ -172,7 +173,7 @@ public class EnsemblLookup extends EnsemblRestClient
     BufferedReader br = null;
     try
     {
-      URL url = getUrl(identifier);
+      URL url = getUrl(identifier, objectType);
       if (url != null)
       {
         br = getHttpResponse(url, ids);
@@ -224,7 +225,8 @@ public class EnsemblLookup extends EnsemblRestClient
    * Parses the JSON response and returns the gene identifier, or null if not
    * found. If the returned object_type is Gene, returns the id, if Transcript
    * returns the Parent. If it is Translation (peptide identifier), then the
-   * Parent is the transcript identifier, so we redo the search with this value.
+   * Parent is the transcript identifier, so we redo the search with this value,
+   * specifying that object_type should be Transcript.
    * 
    * @param br
    * @return
@@ -239,28 +241,20 @@ public class EnsemblLookup extends EnsemblRestClient
       String type = val.get(OBJECT_TYPE).toString();
       if (OBJECT_TYPE_GENE.equalsIgnoreCase(type))
       {
-        geneId = val.get(ID).toString();
+        // got the gene - just returns its id
+        geneId = val.get(JSON_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 = (String) getResult(transcriptId, OBJECT_TYPE_TRANSCRIPT,
+                reader -> parseGeneId(reader));
       }
     } catch (ParseException | IOException e)
     {
@@ -278,7 +272,8 @@ public class EnsemblLookup extends EnsemblRestClient
    */
   public GeneLociI getGeneLoci(String geneId)
   {
-    return (GeneLociI) getResult(geneId, br -> parseGeneLoci(br));
+    return (GeneLociI) getResult(geneId, OBJECT_TYPE_GENE,
+            br -> parseGeneLoci(br));
   }
 
   /**
@@ -341,6 +336,7 @@ public class EnsemblLookup extends EnsemblRestClient
             | NumberFormatException | ClassCastException e)
     {
       Cache.log.error("Error looking up gene loci: " + e.getMessage());
+      e.printStackTrace();
     }
     return null;
   }
index 35ceea3..9229379 100644 (file)
@@ -49,8 +49,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
@@ -60,10 +58,6 @@ import java.util.Map.Entry;
  */
 public abstract class EnsemblSeqProxy extends EnsemblRestClient
 {
-  protected static final String PARENT = "Parent";
-
-  protected static final String ID = "ID";
-
   protected static final String NAME = "Name";
 
   protected static final String DESCRIPTION = "description";
@@ -208,7 +202,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());
@@ -224,7 +219,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))
         {
 
@@ -471,14 +466,11 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
     urlstring.append("?type=").append(getSourceEnsemblType().getType());
     urlstring.append(("&Accept=text/x-fasta"));
 
-    Map<String, String> params = getAdditionalParameters();
-    if (params != null)
+    String objectType = getObjectType();
+    if (objectType != null)
     {
-      for (Entry<String, String> 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());
@@ -486,11 +478,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<String, String> getAdditionalParameters()
+  protected String getObjectType()
   {
     return null;
   }
@@ -559,7 +551,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
   protected MapList getGenomicRangesFromFeatures(SequenceI sourceSequence,
           String accId, int start)
   {
-    // SequenceFeature[] sfs = sourceSequence.getSequenceFeatures();
     List<SequenceFeature> sfs = sourceSequence.getFeatures()
             .getPositionalFeatures();
     if (sfs.isEmpty())
@@ -571,7 +562,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
      * generously initial size for number of cds regions
      * (worst case titin Q8WZ42 has c. 313 exons)
      */
-    List<int[]> regions = new ArrayList<int[]>(100);
+    List<int[]> 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<SequenceFeature> findFeatures(SequenceI sequence,
           String term, String parentId)
   {
-    List<SequenceFeature> result = new ArrayList<SequenceFeature>();
+    List<SequenceFeature> result = new ArrayList<>();
 
     List<SequenceFeature> 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);
       }
index 598dba1..cfb3c6d 100644 (file)
@@ -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 JSON_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
index 65be906..40d6cad 100644 (file)
@@ -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
    * 
@@ -77,7 +75,7 @@ public class EnsemblSymbol extends EnsemblXref
       while (rvals.hasNext())
       {
         JSONObject val = (JSONObject) rvals.next();
-        String id = val.get(ID).toString();
+        String id = val.get(JSON_ID).toString();
         String type = val.get(TYPE).toString();
         if (id != null && GENE.equals(type))
         {
index 9802d4b..86710e1 100644 (file)
@@ -92,7 +92,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
   protected JTabbedPane tabs = new JTabbedPane();
   protected IProgressIndicator progressIndicator;
 
-  protected JComboBox<FTSDataColumnI> cmb_searchTarget = new JComboBox<FTSDataColumnI>();
+  protected JComboBox<FTSDataColumnI> 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<String> paginatorCart = new HashSet<String>();
+  protected HashSet<String> 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<String>(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<FTSDataColumnI> searchableTargets = new ArrayList<FTSDataColumnI>();
+    List<FTSDataColumnI> searchableTargets = new ArrayList<>();
     try
     {
       Collection<FTSDataColumnI> foundFTSTargets = getFTSRestClient()
index 7c386f1..217f653 100644 (file)
@@ -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 Structures",
+      FilterOption cachedOption = new FilterOption(
+              MessageManager.getString("label.cached_structures"),
               "-", VIEWS_LOCAL_PDB, false);
       cmb_filterOption.addItem(cachedOption);
       cmb_filterOption.setSelectedItem(cachedOption);
index 7c4672a..9bcaa5a 100644 (file)
@@ -91,7 +91,7 @@ public abstract class GStructureChooser extends JPanel
 
   protected JInternalFrame mainFrame = new JInternalFrame(frameTitle);
 
-  protected JComboBox<FilterOption> cmb_filterOption = new JComboBox<FilterOption>();
+  protected JComboBox<FilterOption> cmb_filterOption = new JComboBox<>();
 
   protected AlignmentPanel ap;
 
@@ -182,7 +182,7 @@ public abstract class GStructureChooser extends JPanel
 
   protected FTSDataColumnI[] previousWantedFields;
 
-  protected static Map<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
+  protected static Map<String, Integer> 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<AssociateSeqOptions> cmb_assSeq = new JComboBox<AssociateSeqOptions>();
+    private JComboBox<AssociateSeqOptions> cmb_assSeq = new JComboBox<>();
 
     private JLabel lbl_associateSeq = new JLabel();
 
index 6611e05..779962c 100644 (file)
@@ -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));
index 5920b89..1b1a2b4 100644 (file)
@@ -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);
index e2af26b..42afa82 100644 (file)
@@ -21,9 +21,7 @@
 package jalview.ext.ensembl;
 
 import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertSame;
-import static org.testng.AssertJUnit.assertTrue;
 
 import jalview.datamodel.Alignment;
 import jalview.datamodel.SequenceFeature;
index 4535c93..91fe602 100644 (file)
@@ -65,7 +65,7 @@ public class StructureChooserTest
     PDBEntry dbRef = new PDBEntry();
     dbRef.setId("1tim");
 
-    Vector<PDBEntry> pdbIds = new Vector<PDBEntry>();
+    Vector<PDBEntry> 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" })