From: gmungoc Date: Tue, 21 Jun 2016 09:08:48 +0000 (+0100) Subject: JAL-2113 tidy up canonicalisation of Uniprot xrefs in EMBL data X-Git-Tag: Release_2_10_0~140^2~5^2~49^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f4debc094f95109d1eb0518914d8ada444cd3f5d;p=jalview.git JAL-2113 tidy up canonicalisation of Uniprot xrefs in EMBL data --- diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index ac0d339..43581da 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -210,13 +210,14 @@ public class EmblEntry } } + SequenceIdMatcher matcher = new SequenceIdMatcher(peptides); try { for (EmblFeature feature : features) { if (FeatureProperties.isCodingFeature(sourceDb, feature.getName())) { - parseCodingFeature(feature, sourceDb, dna, peptides); + parseCodingFeature(feature, sourceDb, dna, peptides, matcher); } } } catch (Exception e) @@ -244,9 +245,11 @@ public class EmblEntry * parent dna sequence for this record * @param peptides * list of protein product sequences for Embl entry + * @param matcher + * helper to match xrefs in already retrieved sequences */ void parseCodingFeature(EmblFeature feature, String sourceDb, - SequenceI dna, List peptides) + SequenceI dna, List peptides, SequenceIdMatcher matcher) { boolean isEmblCdna = sourceDb.equals(DBRefSource.EMBLCDS); @@ -256,7 +259,6 @@ public class EmblEntry String prname = ""; String prid = null; Map vals = new Hashtable(); - SequenceIdMatcher matcher = new SequenceIdMatcher(peptides); /* * codon_start 1/2/3 in EMBL corresponds to phase 0/1/2 in CDS diff --git a/test/jalview/datamodel/xdb/embl/EmblEntryTest.java b/test/jalview/datamodel/xdb/embl/EmblEntryTest.java index e8760bd..3de5e3f 100644 --- a/test/jalview/datamodel/xdb/embl/EmblEntryTest.java +++ b/test/jalview/datamodel/xdb/embl/EmblEntryTest.java @@ -3,6 +3,7 @@ package jalview.datamodel.xdb.embl; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertSame; +import jalview.analysis.SequenceIdMatcher; import jalview.datamodel.DBRefEntry; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; @@ -37,6 +38,7 @@ public class EmblEntryTest // not the whole sequence but enough for this test... SequenceI dna = new Sequence("J03321", "GGATCCGTAAGTTAGACGAAATT"); List peptides = new ArrayList(); + SequenceIdMatcher matcher = new SequenceIdMatcher(peptides); EmblFile ef = EmblTestHelper.getEmblFile(); /* @@ -48,7 +50,7 @@ public class EmblEntryTest { if ("CDS".equals(feature.getName())) { - testee.parseCodingFeature(feature, "EMBL", dna, peptides); + testee.parseCodingFeature(feature, "EMBL", dna, peptides, matcher); } }