From: gmungoc Date: Fri, 16 Mar 2018 15:03:11 +0000 (+0000) Subject: Merge remote-tracking branch 'origin/releases/Release_2_10_4_Branch' into develop X-Git-Tag: Release_2_11_0~51 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=c697eb1e696468bddf7c976a85528fbedbebfbd6;hp=7d6fd8e1601086ff43abb35151339d12e2b99141 Merge remote-tracking branch 'origin/releases/Release_2_10_4_Branch' into develop Conflicts: src/jalview/ext/ensembl/EnsemblLookup.java --- diff --git a/help/html/releases.html b/help/html/releases.html index 68cd198..006ee5c 100755 --- a/help/html/releases.html +++ b/help/html/releases.html @@ -95,6 +95,12 @@ li:before {
  • Linked scrolling via protein horizontal scroll bar doesn't work for some CDS/Protein views
  • +
  • Trackpad scrolling is broken on OSX on Java 1.8u153 onwards and Java 1.9u4+.
  • +
  • Tooltip shouldn't be displayed for empty columns in annotation row
  • +
  • Preferences panel's ID Width control is honored in interactive and batch mode
  • + Applet diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index fcc4f6d..dcd6546 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -178,7 +178,7 @@ import org.apache.log4j.SimpleLayout; *
  • FIGURE_AUTOIDWIDTH (false) Expand the left hand column of an exported * alignment figure to accommodate even the longest sequence ID or annotation * label.
  • - *
  • FIGURE_USERIDWIDTH Specifies the width to use for the left-hand column + *
  • 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).
  • *
  • STRUCT_FROM_PDB (false) derive secondary structure annotation from PDB diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index 0ac14e5..7a30141 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -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 src = new ArrayList(); + List src = new ArrayList<>(); for (Field f : DBRefSource.class.getFields()) { if (String.class.equals(f.getType())) diff --git a/src/jalview/ext/ensembl/EnsemblGenomes.java b/src/jalview/ext/ensembl/EnsemblGenomes.java index 6dd69a8..9fc6a53 100644 --- a/src/jalview/ext/ensembl/EnsemblGenomes.java +++ b/src/jalview/ext/ensembl/EnsemblGenomes.java @@ -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; } } diff --git a/src/jalview/ext/ensembl/EnsemblLookup.java b/src/jalview/ext/ensembl/EnsemblLookup.java index ed1b4fa..102dffb 100644 --- a/src/jalview/ext/ensembl/EnsemblLookup.java +++ b/src/jalview/ext/ensembl/EnsemblLookup.java @@ -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 * diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 55fd185..f5634d2 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -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); diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index dedbba0..821454f 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -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() diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index aa8369a..5aab26d 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -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()); /* diff --git a/test/jalview/analysis/CrossRefTest.java b/test/jalview/analysis/CrossRefTest.java index 95be1ff..0265af3 100644 --- a/test/jalview/analysis/CrossRefTest.java +++ b/test/jalview/analysis/CrossRefTest.java @@ -106,7 +106,7 @@ public class CrossRefTest public void testFindXrefSourcesForSequence_proteinToDna() { SequenceI seq = new Sequence("Seq1", "MGKYQARLSS"); - List sources = new ArrayList(); + List 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 result = new ArrayList(); + List result = new ArrayList<>(); /* * first search for a dbref nowhere on the alignment: diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index 266b90a..1d1ebd6 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -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; } diff --git a/test/jalview/io/CrossRef2xmlTests.java b/test/jalview/io/CrossRef2xmlTests.java index b3db4de..2b8a62f 100644 --- a/test/jalview/io/CrossRef2xmlTests.java +++ b/test/jalview/io/CrossRef2xmlTests.java @@ -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 failedDBRetr = new ArrayList<>(); @@ -97,8 +111,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase List keyseq = new ArrayList<>(); Map 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 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)