import jalview.datamodel.SequenceI;
import jalview.util.DBRefUtils;
import jalview.ws.SequenceFetcher;
+import jalview.ws.dbsources.Pdb;
+import jalview.ws.dbsources.Uniprot;
import java.util.ArrayList;
import java.util.List;
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
/**
* Tests that standard protein database sources include Uniprot (as the first)
- * and also PDB. (Additional sources are dependent on available of DAS
+ * and also PDB. (Additional sources are dependent on availability of DAS
* services.)
*/
@Test(groups = { "Functional" })
{
String[] defdb = DBRefSource.PROTEINDBS;
List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
+ SequenceFetcher sfetcher = new SequenceFetcher();
+ boolean pdbFound = false;
+
for (String ddb : defdb)
{
- SequenceFetcher sfetcher = new SequenceFetcher();
List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
if (srcesfordb != null)
{
+ // TODO is this right? get duplicate entries
srces.addAll(srcesfordb);
}
}
int i = 0;
int uniprotPos = -1;
- int pdbPos = -1;
- // append the selected sequence sources to the default dbs
for (DbSourceProxy s : srces)
{
- if (s instanceof jalview.ws.dbsources.Uniprot)
+ if (s instanceof Uniprot && uniprotPos == -1)
{
uniprotPos = i;
}
- if (s instanceof jalview.ws.dbsources.Pdb)
+ if (s instanceof Pdb)
{
- pdbPos = i;
+ pdbFound = true;
}
i++;
}
+ srces.size() + " sources (source was at position "
+ uniprotPos + ")", uniprotPos == 0);
assertTrue("Failed to find PDB source amongst " + srces.size()
- + " sources", pdbPos >= 0);
+ + " sources", pdbFound);
}
/**
sfs[0].getType()));
assertEquals(embl.getDbSource(), sfs[0].getFeatureGroup());
DBRefEntry[] dr = DBRefUtils.selectRefs(seq.getDBRefs(),
- DBRefSource.PROTEINSEQ);
+ new String[] { DBRefSource.UNIPROT, DBRefSource.UNIPROTKB,
+ DBRefSource.EMBLCDSProduct, DBRefSource.ENSEMBL });
assertNotNull(dr);
assertEquals("Expected a single Uniprot cross reference", 1, dr.length);
assertEquals("Expected cross reference map to be one amino acid", dr[0]
.getMap().getMappedWidth(), 1);
assertEquals("Expected local reference map to be 3 nucleotides", dr[0]
.getMap().getWidth(), 3);
- AlignmentI sprods = CrossRef.findXrefSequences(
- alsq.getSequencesArray(), true, dr[0].getSource(),
- alsq.getDataset());
+ AlignmentI sprods = new CrossRef(alsq.getSequencesArray(), alsq)
+ .findXrefSequences(dr[0].getSource());
assertNotNull(
"Couldn't recover cross reference sequence from dataset. Was it ever added ?",
sprods);