+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.datamodel.Alignment;
import jalview.util.DBRefUtils;
import jalview.util.MapList;
import jalview.ws.SequenceFetcher;
import jalview.util.DBRefUtils;
import jalview.util.MapList;
import jalview.ws.SequenceFetcher;
-import jalview.ws.SequenceFetcherFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
DBRefEntry ref8 = new DBRefEntry("PFAM", "1", "A123");
// ENSEMBL is a source of either dna or protein sequence data
DBRefEntry ref9 = new DBRefEntry("ENSEMBL", "1", "A123");
DBRefEntry ref8 = new DBRefEntry("PFAM", "1", "A123");
// ENSEMBL is a source of either dna or protein sequence data
DBRefEntry ref9 = new DBRefEntry("ENSEMBL", "1", "A123");
- DBRefEntry[] refs = new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5,
- ref6, ref7, ref8, ref9 };
+ List<DBRefEntry> refs = Arrays
+ .asList(new DBRefEntry[]
+ { ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9 });
- DBRefEntry[] found = DBRefUtils.selectDbRefs(true, refs);
- assertEquals(4, found.length);
- assertSame(ref5, found[0]);
- assertSame(ref6, found[1]);
- assertSame(ref7, found[2]);
- assertSame(ref9, found[3]);
+ List<DBRefEntry> found = DBRefUtils.selectDbRefs(true, refs);
+ assertEquals(4, found.size());
+ assertSame(ref5, found.get(0));
+ assertSame(ref6, found.get(1));
+ assertSame(ref7, found.get(2));
+ assertSame(ref9, found.get(3));
- assertEquals(4, found.length);
- assertSame(ref1, found[0]);
- assertSame(ref2, found[1]);
- assertSame(ref4, found[2]);
- assertSame(ref9, found[3]);
+ assertEquals(4, found.size());
+ assertSame(ref1, found.get(0));
+ assertSame(ref2, found.get(1));
+ assertSame(ref4, found.get(2));
+ assertSame(ref9, found.get(3));
public void testFindXrefSourcesForSequence_proteinToDna()
{
SequenceI seq = new Sequence("Seq1", "MGKYQARLSS");
public void testFindXrefSourcesForSequence_proteinToDna()
{
SequenceI seq = new Sequence("Seq1", "MGKYQARLSS");
sources = new CrossRef(new SequenceI[] { seq }, al)
.findXrefSourcesForSequences(false);
// method is patched to remove EMBL from the sources to match
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());
* peptide sequence with UNIPROT dbref
*/
SequenceI dna1 = new Sequence("AF039662", "GGGGCAGCACAAGAAC");
* peptide sequence with UNIPROT dbref
*/
SequenceI dna1 = new Sequence("AF039662", "GGGGCAGCACAAGAAC");
- Mapping map = new Mapping(new Sequence("pep2", "MLAVSRG"), new MapList(
- new int[] { 1, 21 }, new int[] { 1, 7 }, 3, 1));
+ Mapping map = new Mapping(new Sequence("pep2", "MLAVSRG"),
+ new MapList(new int[]
+ { 1, 21 }, new int[] { 1, 7 }, 3, 1));
DBRefEntry dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2", map);
dna1.addDBRef(dbref);
dna1.addDBRef(new DBRefEntry("EMBL", "0", "AF039662"));
DBRefEntry dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2", map);
dna1.addDBRef(dbref);
dna1.addDBRef(new DBRefEntry("EMBL", "0", "AF039662"));
pep1.addDBRef(new DBRefEntry("UNIPROT", "0", "Q9ZTS2"));
AlignmentI al = new Alignment(new SequenceI[] { dna1, pep1 });
pep1.addDBRef(new DBRefEntry("UNIPROT", "0", "Q9ZTS2"));
AlignmentI al = new Alignment(new SequenceI[] { dna1, pep1 });
CrossRef testee = new CrossRef(al.getSequencesArray(), al);
AlignedCodonFrame acf = new AlignedCodonFrame();
boolean found = testee.searchDataset(true, dna1, dbref, result, acf,
CrossRef testee = new CrossRef(al.getSequencesArray(), al);
AlignedCodonFrame acf = new AlignedCodonFrame();
boolean found = testee.searchDataset(true, dna1, dbref, result, acf,
acf = new AlignedCodonFrame();
dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2");
found = testee.searchDataset(!dna1.isProtein(), dna1, dbref, result,
acf = new AlignedCodonFrame();
dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2");
found = testee.searchDataset(!dna1.isProtein(), dna1, dbref, result,
- acf, false); // search dataset with a protein xref from a dna
- // sequence to locate the protein product
+ acf, false, DBRefUtils.SEARCH_MODE_FULL); // search dataset with a
+ // protein xref from a dna
+ // sequence to locate the protein product
assertTrue(found);
assertEquals(1, result.size());
assertSame(pep1, result.get(0));
assertTrue(found);
assertEquals(1, result.size());
assertSame(pep1, result.get(0));
acf = new AlignedCodonFrame();
dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2");
found = testee.searchDataset(!pep1.isProtein(), pep1, dbref, result,
acf = new AlignedCodonFrame();
dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2");
found = testee.searchDataset(!pep1.isProtein(), pep1, dbref, result,
- acf, false); // search dataset with a protein's direct dbref to
- // locate dna sequences with matching xref
+ acf, false, DBRefUtils.SEARCH_MODE_FULL); // search dataset with a
+ // protein's direct dbref
+ // to
+ // locate dna sequences with matching xref
assertTrue(found);
assertEquals(1, result.size());
assertSame(dna1, result.get(0));
assertTrue(found);
assertEquals(1, result.size());
assertSame(dna1, result.get(0));
- pep1.getDatasetSequence().addDBRef(
- new DBRefEntry("Pfam", "0", "PF00111"));
- pep1.addSequenceFeature(new SequenceFeature("type", "desc", 12, 14, 1f,
- "group"));
+ pep1.getDatasetSequence()
+ .addDBRef(new DBRefEntry("Pfam", "0", "PF00111"));
+ pep1.addSequenceFeature(
+ new SequenceFeature("type", "desc", 12, 14, 1f, "group"));
- pep2.addSequenceFeature(new SequenceFeature("type2", "desc2", 13, 15,
- 12f, "group2"));
+ pep2.addSequenceFeature(
+ new SequenceFeature("type2", "desc2", 13, 15, 12f, "group2"));
MapList mapList = new MapList(new int[] { 1, 24 }, new int[] { 1, 3 },
3, 1);
MapList mapList = new MapList(new int[] { 1, 24 }, new int[] { 1, 3 },
3, 1);
assertEquals(copy.getName(), original.getName());
assertEquals(copy.getStart(), original.getStart());
assertEquals(copy.getEnd(), original.getEnd());
assertEquals(copy.getName(), original.getName());
assertEquals(copy.getStart(), original.getStart());
assertEquals(copy.getEnd(), original.getEnd());
}
/**
* Test for finding 'product' sequences for the case where the selected
* sequence has a dbref with no mapping, triggering a fetch from database
*/
}
/**
* Test for finding 'product' sequences for the case where the selected
* sequence has a dbref with no mapping, triggering a fetch from database
*/
SequenceI dna1 = new Sequence("AF039662", "GGGGCAGCACAAGAAC");
dna1.addDBRef(new DBRefEntry("UNIPROT", "ENA:0", "Q9ZTS2"));
dna1.addDBRef(new DBRefEntry("UNIPROT", "ENA:0", "P30419"));
dna1.addDBRef(new DBRefEntry("UNIPROT", "ENA:0", "P00314"));
final SequenceI pep1 = new Sequence("Q9ZTS2", "MYQLIRSSW");
SequenceI dna1 = new Sequence("AF039662", "GGGGCAGCACAAGAAC");
dna1.addDBRef(new DBRefEntry("UNIPROT", "ENA:0", "Q9ZTS2"));
dna1.addDBRef(new DBRefEntry("UNIPROT", "ENA:0", "P30419"));
dna1.addDBRef(new DBRefEntry("UNIPROT", "ENA:0", "P00314"));
final SequenceI pep1 = new Sequence("Q9ZTS2", "MYQLIRSSW");
- pep1.addDBRef(new DBRefEntry("UNIPROT", "0", "Q9ZTS2"));
+ pep1.addDBRef(new DBRefEntry("UNIPROT", "0", "Q9ZTS2", null, true));
- pep2.addDBRef(new DBRefEntry("UNIPROT", "0", "P00314"));
+ pep2.addDBRef(new DBRefEntry("UNIPROT", "0", "P00314", null, true));
/*
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
*/
/*
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
*/
}
/**
* Test for finding 'product' sequences for the case where both gene and
* transcript sequences have dbrefs to Uniprot.
*/
}
/**
* Test for finding 'product' sequences for the case where both gene and
* transcript sequences have dbrefs to Uniprot.
*/
- braf001.addSequenceFeature(new SequenceFeature("CDS", "", 5, 16, 0f,
- null));
+ braf001.addSequenceFeature(
+ new SequenceFeature("CDS", "", 5, 16, 0f, null));
- braf002.addSequenceFeature(new SequenceFeature("CDS", "", 2, 6, 0f,
- null));
- braf002.addSequenceFeature(new SequenceFeature("CDS", "", 9, 15, 0f,
- null));
+ braf002.addSequenceFeature(
+ new SequenceFeature("CDS", "", 2, 6, 0f, null));
+ braf002.addSequenceFeature(
+ new SequenceFeature("CDS", "", 9, 15, 0f, null));
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
*/
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
*/
DBRefEntry dbref1 = new DBRefEntry("UNIPROT", "0", "P0CE19");
MapList mapList = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 },
3, 1);
DBRefEntry dbref1 = new DBRefEntry("UNIPROT", "0", "P0CE19");
MapList mapList = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 },
3, 1);
DBRefEntry dbref3 = new DBRefEntry("UNIPROT", "0", "P0CE19");
MapList map2 = new MapList(new int[] { 4, 15 }, new int[] { 1, 4 }, 3,
1);
DBRefEntry dbref3 = new DBRefEntry("UNIPROT", "0", "P0CE19");
MapList map2 = new MapList(new int[] { 4, 15 }, new int[] { 1, 4 }, 3,
1);
x06707.addDBRef(dbref3);
DBRefEntry dbref4 = new DBRefEntry("UNIPROT", "0", "P0CE20");
MapList map3 = new MapList(new int[] { 4, 15 }, new int[] { 1, 4 }, 3,
1);
x06707.addDBRef(dbref3);
DBRefEntry dbref4 = new DBRefEntry("UNIPROT", "0", "P0CE20");
MapList map3 = new MapList(new int[] { 4, 15 }, new int[] { 1, 4 }, 3,
1);
* passed in calls to getSequences() - important to verify that
* duplicate sequence fetches are not requested
*/
* passed in calls to getSequences() - important to verify that
* duplicate sequence fetches are not requested
*/
assertSame(x06707, mapping.getTo());
/*
* verify dbrefs on EMBL are mapped to alignment seqs
*/
assertSame(x06707, mapping.getTo());
/*
* verify dbrefs on EMBL are mapped to alignment seqs
*/
- assertSame(p0ce19, j03321.getDBRefs()[0].getMap().getTo());
- assertSame(p0ce20, j03321.getDBRefs()[1].getMap().getTo());
- assertSame(p0ce19, x06707.getDBRefs()[0].getMap().getTo());
- assertSame(p0ce20, x06707.getDBRefs()[1].getMap().getTo());
+
+ assertSame(p0ce19, j03321.getDBRefs().get(0).getMap().getTo());
+ assertSame(p0ce20, j03321.getDBRefs().get(1).getMap().getTo());
+ assertSame(p0ce19, x06707.getDBRefs().get(0).getMap().getTo());
+ assertSame(p0ce20, x06707.getDBRefs().get(1).getMap().getTo());
- assertEquals(4, p0ce19.getDBRefs().length);
- assertEquals("PIR", p0ce19.getDBRefs()[3].getSource());
- assertEquals("S01875", p0ce19.getDBRefs()[3].getAccessionId());
+ assertEquals(4, p0ce19.getDBRefs().size());
+ assertEquals("PIR", p0ce19.getDBRefs().get(3).getSource());
+ assertEquals("S01875", p0ce19.getDBRefs().get(3).getAccessionId());
assertFalse(CrossRef.sameSequence(null, seq1));
assertTrue(CrossRef.sameSequence(seq1, new Sequence("seq2", "ABCDEF")));
assertTrue(CrossRef.sameSequence(seq1, new Sequence("seq2", "abcdef")));
assertFalse(CrossRef.sameSequence(null, seq1));
assertTrue(CrossRef.sameSequence(seq1, new Sequence("seq2", "ABCDEF")));
assertTrue(CrossRef.sameSequence(seq1, new Sequence("seq2", "abcdef")));