From: Jim Procter Date: Tue, 22 Aug 2017 21:13:07 +0000 (+0100) Subject: JAL-2681 cross-ref selection for targeted debugging X-Git-Tag: Release_2_10_3b1~142^2~4^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cff3462c5aecd2344485f26214e4a086091c03b8;p=jalview.git JAL-2681 cross-ref selection for targeted debugging --- diff --git a/test/jalview/io/CrossRef2xmlTests.java b/test/jalview/io/CrossRef2xmlTests.java index 9e24262..0715857 100644 --- a/test/jalview/io/CrossRef2xmlTests.java +++ b/test/jalview/io/CrossRef2xmlTests.java @@ -31,10 +31,12 @@ import jalview.gui.CrossRefAction; import jalview.gui.Desktop; import jalview.gui.Jalview2XML; import jalview.gui.JvOptionPane; +import jalview.util.DBRefUtils; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -68,6 +70,10 @@ public class CrossRef2xmlTests extends Jalview2xmlBase List failedDBRetr = new ArrayList<>(); List failedXrefMenuItems = new ArrayList<>(); List failedProjectRecoveries = new ArrayList<>(); + // only search for ensembl or Uniprot crossrefs + List limit=Arrays.asList(new String[] { + DBRefUtils.getCanonicalName("ENSEMBL"), + DBRefUtils.getCanonicalName("Uniprot")}); // for every set of db queries // retrieve db query // verify presence of expected xrefs @@ -88,8 +94,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase List keyseq = new ArrayList<>(); HashMap savedProjects = new HashMap<>(); - for (String[] did : new String[][] { { "ENSEMBL", "ENSG00000157764" }, - { "UNIPROT", "P01731" } }) + for (String[] did : new String[][] { { "UNIPROT", "P00338" } }) { // pass counters - 0 - first pass, 1 means retrieve project rather than // perform action @@ -162,7 +167,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase ptypes = (seqs == null || seqs.length == 0) ? null : new CrossRef( seqs, dataset).findXrefSourcesForSequences(dna); - + filterDbRefs(ptypes, limit); + // start of pass2: retrieve each cross-ref for fetched or restored // project. do // first cross ref and recover crossref loop @@ -436,6 +442,25 @@ public class CrossRef2xmlTests extends Jalview2xmlBase } } + private void filterDbRefs(List ptypes, List limit) + { + if (limit != null) + { + int p = 0; + while (ptypes.size() > p) + { + if (!limit.contains(ptypes.get(p))) + { + ptypes.remove(p); + } + else + { + p++; + } + } + } + } + /** * wrapper to trap known defect for AH002001 testcase *