From: gmungoc Date: Thu, 15 Mar 2018 16:24:06 +0000 (+0000) Subject: JAL-2893 enabling Get Crossreferences to ENSEMBLGENOMES X-Git-Tag: Release_2_10_4~42 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5af80dd011bdfeab879472802bf2a9646e538f68;p=jalview.git JAL-2893 enabling Get Crossreferences to ENSEMBLGENOMES --- 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/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 0715857..ef7615b 100644 --- a/test/jalview/io/CrossRef2xmlTests.java +++ b/test/jalview/io/CrossRef2xmlTests.java @@ -42,6 +42,7 @@ import java.util.List; import org.testng.Assert; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @Test(singleThreaded = true) @@ -56,6 +57,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 @@ -63,8 +72,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<>(); @@ -94,8 +108,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase List keyseq = new ArrayList<>(); HashMap 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; @@ -105,7 +119,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; @@ -117,7 +131,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); @@ -411,7 +426,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase pass1++; } } while (pass1 < 3); - } + if (failedXrefMenuItems.size() > 0) { for (String s : failedXrefMenuItems)