From: Jim Procter Date: Fri, 3 Sep 2021 15:45:16 +0000 (+0100) Subject: JAL-3863 passing test to verify a uniprot accession with canonical flag set is transf... X-Git-Tag: Release_2_11_2_0~39^2~26 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c49fa6aa001663914b33fc53a1d002bfc6a291ba;p=jalview.git JAL-3863 passing test to verify a uniprot accession with canonical flag set is transferred via the DBRefFetcher (and the SequenceI.transferAnnotation method it calls) --- diff --git a/src/jalview/api/DBRefEntryI.java b/src/jalview/api/DBRefEntryI.java index 672d6b4..ed6358e 100644 --- a/src/jalview/api/DBRefEntryI.java +++ b/src/jalview/api/DBRefEntryI.java @@ -112,4 +112,6 @@ public interface DBRefEntryI * associated sequence object */ public boolean isPrimaryCandidate(); + + public boolean isCanonical(); } diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index ae06650..b6cae62 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -113,7 +113,7 @@ public class DBRefEntry implements DBRefEntryI : new String(entry.getVersion())), (entry.getAccessionId() == null ? "" : new String(entry.getAccessionId())), - (entry.getMap() == null ? null : new Mapping(entry.getMap()))); + (entry.getMap() == null ? null : new Mapping(entry.getMap())),entry.isCanonical()); } @Override diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 129d7b3..5ae7dd9 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -2175,4 +2175,15 @@ public class SequenceTest assertEquals(0, seq.firstResidueOutsideIterator(cs.iterator())); } + @Test(groups= {"Functional"}) + public void testTransferAnnotation() { + Sequence origSeq = new Sequence("MYSEQ","THISISASEQ"); + Sequence toSeq = new Sequence("MYSEQ","THISISASEQ"); + origSeq.addDBRef(new DBRefEntry("UNIPROT", "0", "Q12345", null, true)); + toSeq.transferAnnotation(origSeq, null); + assertTrue(toSeq.getDBRefs().size()>0); + + assertTrue(toSeq.getDBRefs().get(0).isCanonical()); + + } } diff --git a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java index a7e5806..914520f 100644 --- a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java +++ b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java @@ -30,10 +30,12 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; import jalview.datamodel.FeatureProperties; +import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.JvOptionPane; import jalview.util.DBRefUtils; +import jalview.ws.DBRefFetcher; import jalview.ws.SequenceFetcher; import jalview.ws.dbsources.Pdb; import jalview.ws.dbsources.Uniprot; @@ -77,6 +79,26 @@ public class DbRefFetcherTest { } + @Test(groups= {"Network"}) + public void checkUniprotCanonicalFlagSet() + { + // TODO - mock this - for moment it is a live request. + SequenceI uniprotSeq = new Sequence("FER1_SPIOL", + "MAATTTTMMGMATTFVPKPQAPPMMAALPSNTGRSLFGLKTGSRGGRMTMAAYKVTLVTPTGNVEFQCPDDV" + + "YILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLDDDQIDEGWVLTCAAYPVSDVTIETHKEEE" + + "LTA"); + DBRefFetcher dbr = new DBRefFetcher(new SequenceI[] { uniprotSeq }); + dbr.fetchDBRefs(true); + List primRefs = uniprotSeq.getPrimaryDBRefs(); + assertNotNull(primRefs); + assertTrue(primRefs.size()>0); + boolean canonicalUp=false; + for (DBRefEntry ref:primRefs) { + assertEquals(DBRefSource.UNIPROT, ref.getCanonicalSourceName()); + canonicalUp |= ref.isCanonical(); + } + assertTrue("No Canonical Uniprot reference detected", canonicalUp); + } /** * Tests that standard protein database sources include Uniprot (as the first) * and also PDB. (Additional sources are dependent on availability of DAS