Merge remote-tracking branch 'origin/releases/Release_2_10_4_Branch' into develop
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 16 Mar 2018 15:03:11 +0000 (15:03 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 16 Mar 2018 15:03:11 +0000 (15:03 +0000)
Conflicts:
src/jalview/ext/ensembl/EnsemblLookup.java

help/html/releases.html
src/jalview/bin/Cache.java
src/jalview/datamodel/DBRefSource.java
src/jalview/ext/ensembl/EnsemblGenomes.java
src/jalview/ext/ensembl/EnsemblLookup.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/Preferences.java
test/jalview/analysis/CrossRefTest.java
test/jalview/datamodel/AlignmentTest.java
test/jalview/io/CrossRef2xmlTests.java

index 68cd198..006ee5c 100755 (executable)
@@ -95,6 +95,12 @@ li:before {
             <li>
               <!-- JAL-2666 -->Linked scrolling via protein horizontal scroll bar doesn't work for some CDS/Protein views 
             </li>
+            <li><!-- JAL-2930 -->Trackpad scrolling is broken on OSX on Java 1.8u153 onwards and Java 1.9u4+.</li>
+            <li><!-- JAL-2924 -->Tooltip shouldn't be displayed for empty columns in annotation row</li>
+            <li><!-- JAL-2913 -->Preferences panel's ID Width control is honored in interactive and batch mode</li>
+            </ul><em>Applet</em><ul>
+            <li><!-- JAL-2926 -->Copy consensus sequence option in applet should copy the group consensus when popup is opened on it</li>
+             
           </ul>
       </div>
       </td>
index fcc4f6d..dcd6546 100755 (executable)
@@ -178,7 +178,7 @@ import org.apache.log4j.SimpleLayout;
  * <li>FIGURE_AUTOIDWIDTH (false) Expand the left hand column of an exported
  * alignment figure to accommodate even the longest sequence ID or annotation
  * label.</li>
- * <li>FIGURE_USERIDWIDTH Specifies the width to use for the left-hand column
+ * <li>FIGURE_FIXEDIDWIDTH Specifies the width to use for the left-hand column
  * when exporting an alignment as a figure (setting FIGURE_AUTOIDWIDTH to true
  * will override this).</li>
  * <li>STRUCT_FROM_PDB (false) derive secondary structure annotation from PDB
index 0ac14e5..7a30141 100755 (executable)
@@ -96,7 +96,7 @@ public class DBRefSource
    * List of databases whose sequences might have coding regions annotated
    */
   public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB,
-      ENSEMBL };
+      ENSEMBL, ENSEMBLGENOMES };
 
   public static final String[] CODINGDBS = { EMBLCDS, GENEDB, ENSEMBL };
 
@@ -105,7 +105,7 @@ public class DBRefSource
 
   public static String[] allSources()
   {
-    List<String> src = new ArrayList<String>();
+    List<String> src = new ArrayList<>();
     for (Field f : DBRefSource.class.getFields())
     {
       if (String.class.equals(f.getType()))
index 6dd69a8..9fc6a53 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.ext.ensembl;
 
 import jalview.bin.Cache;
+import jalview.datamodel.DBRefSource;
 
 /**
  * A class to behave much like EnsemblGene but referencing the ensemblgenomes
@@ -45,7 +46,7 @@ public class EnsemblGenomes extends EnsemblGene
   @Override
   public String getDbName()
   {
-    return "EnsemblGenomes";
+    return DBRefSource.ENSEMBLGENOMES;
   }
 
   @Override
@@ -60,7 +61,7 @@ public class EnsemblGenomes extends EnsemblGene
   @Override
   public String getDbSource()
   {
-    return "EnsemblGenomes";
+    return DBRefSource.ENSEMBLGENOMES;
   }
 
 }
index ed1b4fa..102dffb 100644 (file)
@@ -49,11 +49,6 @@ public class EnsemblLookup extends EnsemblRestClient
   private static final String SPECIES = "species";
 
   /**
-   * keep track of last identifier retrieved to break loops
-   */
-  private String lastId;
-
-  /**
    * Default constructor (to use rest.ensembl.org)
    */
   public EnsemblLookup()
@@ -265,18 +260,8 @@ public class EnsemblLookup extends EnsemblRestClient
     BufferedReader br = null;
     try
     {
-
       URL url = getUrl(identifier, objectType);
 
-      if (identifier.equals(lastId))
-      {
-        System.err.println("** Ensembl lookup " + url.toString()
-                + " looping on Parent!");
-        return null;
-      }
-
-      lastId = identifier;
-
       if (url != null)
       {
         br = getHttpResponse(url, ids);
@@ -303,46 +288,6 @@ 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,
-   * specifying that object_type should be Transcript.
-   * 
-   * @param jsonObject
-   * @return
-   */
-  protected String parseGeneId(JSONObject json)
-  {
-    if (json == null)
-    {
-      // e.g. lookup failed with 404 not found
-      return null;
-    }
-
-    String geneId = null;
-    String type = json.get(OBJECT_TYPE).toString();
-    if (OBJECT_TYPE_GENE.equalsIgnoreCase(type))
-    {
-      // got the gene - just returns its id
-      geneId = json.get(JSON_ID).toString();
-    }
-    else if (OBJECT_TYPE_TRANSCRIPT.equalsIgnoreCase(type))
-    {
-      // got the transcript - return its (Gene) Parent
-      geneId = json.get(PARENT).toString();
-    }
-    else if (OBJECT_TYPE_TRANSLATION.equalsIgnoreCase(type))
-    {
-      // got the protein - look up its Parent, restricted to type Transcript
-      String transcriptId = json.get(PARENT).toString();
-      geneId = parseGeneId(getResult(transcriptId, OBJECT_TYPE_TRANSCRIPT));
-    }
-
-    return geneId;
-  }
-
-  /**
    * Calls the /lookup/id rest service for the given id, and if successful,
    * parses and returns the gene's chromosomal coordinates
    * 
index 55fd185..f5634d2 100644 (file)
@@ -1274,7 +1274,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
     }
     Integer idwidth = null;
     if (onscreen || (idwidth = Cache
-            .getIntegerProperty("FIGURE_USERIDWIDTH")) == null)
+            .getIntegerProperty("FIGURE_FIXEDIDWIDTH")) == null)
     {
       int w = getIdPanel().getWidth();
       return (w > 0 ? w : calculateIdWidth().width + 4);
index dedbba0..821454f 100644 (file)
@@ -1031,9 +1031,10 @@ public class FeatureSettings extends JPanel
     Object[][] data = ((FeatureTableModel) table.getModel()).getData();
     for (int i = 0; i < data.length; i++)
     {
-      data[i][2] = !(Boolean) data[i][2];
+      data[i][SHOW_COLUMN] = !(Boolean) data[i][SHOW_COLUMN];
     }
-    af.alignPanel.paintAlignment(true, true);
+    updateFeatureRenderer(data, true);
+    table.repaint();
   }
 
   public void orderByAvWidth()
index aa8369a..5aab26d 100755 (executable)
@@ -525,7 +525,7 @@ public class Preferences extends GPreferences
     autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
     userIdWidth.setEnabled(!autoIdWidth.isSelected());
     userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
-    Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH");
+    Integer wi = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH");
     userIdWidth.setText(wi == null ? "" : wi.toString());
     // TODO: refactor to use common enum via FormatAdapter and allow extension
     // for new flat file formats
@@ -784,7 +784,7 @@ public class Preferences extends GPreferences
     Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH",
             Boolean.toString(autoIdWidth.isSelected()));
     userIdWidth_actionPerformed();
-    Cache.applicationProperties.setProperty("FIGURE_USERIDWIDTH",
+    Cache.applicationProperties.setProperty("FIGURE_FIXEDIDWIDTH",
             userIdWidth.getText());
 
     /*
index 95be1ff..0265af3 100644 (file)
@@ -106,7 +106,7 @@ public class CrossRefTest
   public void testFindXrefSourcesForSequence_proteinToDna()
   {
     SequenceI seq = new Sequence("Seq1", "MGKYQARLSS");
-    List<String> sources = new ArrayList<String>();
+    List<String> sources = new ArrayList<>();
     AlignmentI al = new Alignment(new SequenceI[] {});
 
     /*
@@ -132,8 +132,9 @@ public class CrossRefTest
     sources = new CrossRef(new SequenceI[] { seq }, al)
             .findXrefSourcesForSequences(false);
     // method is patched to remove EMBL from the sources to match
-    assertEquals(3, sources.size());
-    assertEquals("[EMBLCDS, GENEDB, ENSEMBL]", sources.toString());
+    assertEquals(4, sources.size());
+    assertEquals("[EMBLCDS, GENEDB, ENSEMBL, ENSEMBLGENOMES]",
+            sources.toString());
 
     /*
      * add a sequence to the alignment which has a dbref to UNIPROT|A1234
@@ -270,7 +271,7 @@ public class CrossRefTest
     pep1.addDBRef(new DBRefEntry("UNIPROT", "0", "Q9ZTS2"));
     AlignmentI al = new Alignment(new SequenceI[] { dna1, pep1 });
 
-    List<SequenceI> result = new ArrayList<SequenceI>();
+    List<SequenceI> result = new ArrayList<>();
 
     /*
      * first search for a dbref nowhere on the alignment:
index 266b90a..1d1ebd6 100644 (file)
@@ -248,7 +248,9 @@ public class AlignmentTest
                   if (raiseAssert)
                   {
                     Assert.fail(message
-                            + " DBRefEntry for sequence in alignment had map to sequence not in dataset");
+                            + " DBRefEntry " + dbr + " for sequence "
+                            + seqds
+                            + " in alignment has map to sequence not in dataset");
                   }
                   return false;
                 }
index b3db4de..2b8a62f 100644 (file)
@@ -45,6 +45,7 @@ import junit.extensions.PA;
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 @Test(singleThreaded = true)
@@ -59,6 +60,14 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
   }
 
+  @DataProvider(name = "initialAccessions")
+  static Object[][] getAccessions()
+  {
+    return new String[][] { { "UNIPROT", "P00338" },
+        { "UNIPROT", "Q8Z9G6" },
+        { "ENSEMBLGENOMES", "CAD01290" } };
+  }
+
   /**
    * test store and recovery of all reachable cross refs from all reachable
    * crossrefs for one or more fetched db refs. Currently, this test has a known
@@ -66,8 +75,13 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
    * 
    * @throws Exception
    */
-  @Test(groups = { "Operational" }, enabled = true)
-  public void testRetrieveAndShowCrossref() throws Exception
+  @Test(
+    groups =
+    { "Operational" },
+    dataProvider = "initialAccessions",
+    enabled = true)
+  public void testRetrieveAndShowCrossref(String forSource,
+          String forAccession) throws Exception
   {
 
     List<String> failedDBRetr = new ArrayList<>();
@@ -97,8 +111,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
     List<String> keyseq = new ArrayList<>();
     Map<String, File> savedProjects = new HashMap<>();
 
-    for (String[] did : new String[][] { { "UNIPROT", "P00338" } })
-    {
+//    for (String[] did : new String[][] { { "UNIPROT", "P00338" } })
+//    {
       // pass counters - 0 - first pass, 1 means retrieve project rather than
       // perform action
       int pass1 = 0, pass2 = 0, pass3 = 0;
@@ -108,7 +122,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
       // { pass 2 = 0 { pass 3 = 0 } }
       do
       {
-        String first = did[0] + " " + did[1];
+        String first = forSource + " " + forAccession;//did[0] + " " + did[1];
         AlignFrame af = null;
         boolean dna;
         AlignmentI retral;
@@ -120,7 +134,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
           // retrieve dbref
 
           List<AlignFrame> afs = jalview.gui.SequenceFetcher.fetchAndShow(
-                  did[0], did[1]);
+                forSource, forAccession);
+        // did[0], did[1]);
           if (afs.size() == 0)
           {
             failedDBRetr.add("Didn't retrieve " + first);
@@ -416,7 +431,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
           pass1++;
         }
       } while (pass1 < 3);
-    }
+
     if (failedXrefMenuItems.size() > 0)
     {
       for (String s : failedXrefMenuItems)