dna1.addDBRef(new DBRefEntry("UNIPROT", "0", "P00314"));
final SequenceI pep1 = new Sequence("Q9ZTS2", "MYQLIRSSW");
final SequenceI pep2 = new Sequence("P00314", "MRKLLAASG");
-
+
/*
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
*/
final SequenceI pep1 = new Sequence("UNIPROT|P15056", "MAAL");
final SequenceI pep2 = new Sequence("UNIPROT|H7C5K3", "QALF");
-
+
/*
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
{
return true;
}
-
+
@Override
public SequenceI[] getSequences(List<DBRefEntry> refs, boolean dna)
{
}
};
SequenceFetcherFactory.setSequenceFetcher(mockFetcher);
-
+
/*
* find UNIPROT xrefs for gene and transcripts
* verify that
*/
SequenceI[] seqs = new SequenceI[] { gene, braf001, braf002 };
AlignmentI al = new Alignment(seqs);
- Alignment xrefs = new CrossRef(seqs, al)
-.findXrefSequences("UNIPROT",
+ Alignment xrefs = new CrossRef(seqs, al).findXrefSequences("UNIPROT",
true);
assertEquals(2, xrefs.getHeight());
assertSame(pep1, xrefs.getSequenceAt(0));
p0ce20.addDBRef(new DBRefEntry("EMBL", "0", "J03321"));
p0ce20.addDBRef(new DBRefEntry("EMBL", "0", "X06707"));
p0ce20.addDBRef(new DBRefEntry("EMBL", "0", "X07547"));
-
+
/*
* EMBL sequences to be 'fetched', complete with dbrefs and mappings
* to their protein products (CDS location and translations are provided
* in EMBL XML); these should be matched to, and replaced with,
* the corresponding uniprot sequences after fetching
*/
-
+
/*
* J03321 with mappings to P0CE19 and P0CE20
*/
DBRefEntry dbref1 = new DBRefEntry("UNIPROT", "0", "P0CE19");
MapList mapList = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 },
3, 1);
- Mapping map = new Mapping(new Sequence("UNIPROT|P0CE19", "KPFG"), mapList);
+ Mapping map = new Mapping(new Sequence("UNIPROT|P0CE19", "KPFG"),
+ mapList);
// add a dbref to the mapped to sequence - should get copied to p0ce19
map.getTo().addDBRef(new DBRefEntry("PIR", "0", "S01875"));
dbref1.setMap(map);
dbref2.setMap(new Mapping(new Sequence("UNIPROT|P0CE20", "PFGK"),
new MapList(mapList)));
j03321.addDBRef(dbref2);
-
+
/*
* X06707 with mappings to P0CE19 and P0CE20
*/
1);
dbref4.setMap(new Mapping(new Sequence("UNIPROT|P0CE20", "PFGK"), map3));
x06707.addDBRef(dbref4);
-
+
/*
* M19487 with mapping to P0CE19 and Q46432
*/
dbref8.setMap(new Mapping(new Sequence("UNIPROT|B0BCM4", "KPFG"),
new MapList(map2)));
x07547.addDBRef(dbref8);
-
+
/*
* mock sequence fetcher to 'return' the EMBL sequences
* TODO: Mockito would allow .thenReturn().thenReturn() here,
*/
SequenceFetcher mockFetcher = new SequenceFetcher(false)
{
- int call = 0;
+ int call = 0;
+
@Override
public boolean isFetchable(String source)
{
return true;
}
+
@Override
public SequenceI[] getSequences(List<DBRefEntry> refs, boolean dna)
{
call++;
- if (call == 1) {
- assertEquals("Expected 3 embl seqs in first fetch", 3, refs.size());
- return new SequenceI[] { j03321, x06707, m19487 };
- } else {
- assertEquals("Expected 1 embl seq in second fetch", 1, refs.size());
- return new SequenceI[] { x07547 };
+ if (call == 1)
+ {
+ assertEquals("Expected 3 embl seqs in first fetch", 3,
+ refs.size());
+ return new SequenceI[] { j03321, x06707, m19487 };
+ }
+ else
+ {
+ assertEquals("Expected 1 embl seq in second fetch", 1,
+ refs.size());
+ return new SequenceI[] { x07547 };
}
}
};
SequenceFetcherFactory.setSequenceFetcher(mockFetcher);
-
+
/*
* find EMBL xrefs for Uniprot seqs and verify that
* - the EMBL xref'd sequences are retrieved without duplicates