X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fdbsources%2FUniprotTest.java;h=72e599d924a429f40ac02f227cb2ddfd129606cd;hb=78d4775e4450ba6579c5d9824a78ad99cbccda22;hp=a92b5c4fd7c3ed5579a69e46503cc01865a09f47;hpb=8f118c154e74caaef6bec19acd0466904ac424d4;p=jalview.git diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index a92b5c4..72e599d 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -89,19 +89,19 @@ public class UniprotTest assertEquals("signal peptide", sf.getType()); assertNull(sf.getDescription()); assertNull(sf.getStatus()); - assertEquals(1, sf.getPosition()); // wrong - Castor bug?? + assertEquals(1, sf.getPosition()); assertEquals(1, sf.getBegin()); assertEquals(18, sf.getEnd()); sf = features.get(1); assertEquals("propeptide", sf.getType()); assertEquals("Activation peptide", sf.getDescription()); - assertEquals(19, sf.getPosition()); // wrong - Castor bug?? + assertEquals(19, sf.getPosition()); assertEquals(19, sf.getBegin()); assertEquals(20, sf.getEnd()); sf = features.get(2); assertEquals("chain", sf.getType()); assertEquals("Granzyme B", sf.getDescription()); - assertEquals(21, sf.getPosition()); // wrong - Castor bug?? + assertEquals(21, sf.getPosition()); assertEquals(21, sf.getBegin()); assertEquals(247, sf.getEnd()); @@ -125,19 +125,36 @@ public class UniprotTest } /** - * Test the method that formats the sequence name in Fasta style + * Test the method that formats the sequence id */ @Test(groups = { "Functional" }) - public void testConstructSequenceFastaHeader() + public void testGetUniprotEntryId() { - Uniprot u = new Uniprot(); - Reader reader = new StringReader(UNIPROT_XML); - Vector entries = u.getUniprotEntries(reader); - UniprotEntry entry = entries.get(0); + UniprotEntry entry = new Uniprot().getUniprotEntries( + new StringReader(UNIPROT_XML)).get(0); + + /* + * name formatted as source | accession ids | names + * source database converted to Jalview canonical name + */ + String expectedName = "UNIPROT|A9CKP4|A9CKP5|A9CKP4_AGRT5|A9CKP4_AGRT6"; + assertEquals(expectedName, Uniprot.getUniprotEntryId(entry)); + } - // source + accession ids + names + protein names - String expectedName = ">UniProt/Swiss-Prot|A9CKP4|A9CKP5|A9CKP4_AGRT5|A9CKP4_AGRT6 Mitogen-activated protein kinase 13 Henry"; - assertEquals(expectedName, Uniprot.constructSequenceFastaHeader(entry) - .toString()); + /** + * Test the method that formats the sequence description + */ + @Test(groups = { "Functional" }) + public void testGetUniprotEntryDescription() + { + UniprotEntry entry = new Uniprot().getUniprotEntries( + new StringReader(UNIPROT_XML)).get(0); + + /* + * recommended names concatenated with space separator + */ + String expectedDescription = "Mitogen-activated protein kinase 13 Henry"; + assertEquals(expectedDescription, + Uniprot.getUniprotEntryDescription(entry)); } }