*/
else
{
- List<String> ids = new EnsemblSymbol(getDomain()).getIds(acc);
+ List<String> ids = new EnsemblSymbol(getDomain(), getDbSource(),
+ getDbVersion()).getIds(acc);
for (String geneId : ids)
{
if (!geneIds.contains(geneId))
*/
protected String getGeneIdentifiersForName(String query)
{
- List<String> ids = new EnsemblSymbol(getDomain()).getIds(query);
+ List<String> ids = new EnsemblSymbol(getDomain(), getDbSource(),
+ getDbVersion()).getIds(query);
if (ids != null)
{
for (String id : ids)
seq = seq.getDatasetSequence();
}
- EnsemblXref xrefFetcher = new EnsemblXref(getDomain());
+ EnsemblXref xrefFetcher = new EnsemblXref(getDomain(), getDbSource(),
+ getEnsemblDataVersion());
List<DBRefEntry> xrefs = xrefFetcher.getCrossReferences(seq.getName());
for (DBRefEntry xref : xrefs)
{
/**
* Constructor given the target domain to fetch data from
*
- * @param d
+ * @param domain
+ * @param dbName
+ * @param dbVersion
*/
- public EnsemblSymbol(String d)
+ public EnsemblSymbol(String domain, String dbName, String dbVersion)
{
- super(d);
+ super(domain, dbName, dbVersion);
}
/**
private static final String GO_GENE_ONTOLOGY = "GO";
+ private String dbName = "ENSEMBL (xref)";
+
/**
* Constructor given the target domain to fetch data from
*
* @param d
*/
- public EnsemblXref(String d)
+ public EnsemblXref(String d, String dbSource, String version)
{
super(d);
+ dbName = dbSource;
+ xrefVersion = dbSource + ":" + version;
+
}
@Override
public String getDbName()
{
- return "ENSEMBL (xref)";
+ return dbName;
}
@Override
if (dbName != null && id != null)
{
dbName = DBRefUtils.getCanonicalName(dbName);
- DBRefEntry dbref = new DBRefEntry(dbName, "0", id);
+ DBRefEntry dbref = new DBRefEntry(dbName, getXRefVersion(), id);
result.add(dbref);
}
}
return result;
}
+ private String xrefVersion = "ENSEMBL:0";
+
+ /**
+ * version string for Xrefs - for 2.10, hardwired for ENSEMBL:0
+ *
+ * @return
+ */
+ public String getXRefVersion()
+ {
+ return xrefVersion;
+ }
+
/**
* Returns the URL for the REST endpoint to fetch all cross-references for an
* identifier. Note this may return protein cross-references for nucleotide.
package jalview.ext.ensembl;
import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
import jalview.datamodel.DBRefEntry;
@Test(groups = "Functional")
public void testGetCrossReferences()
{
+ String dbName = "ENSEMBL";
+ String dbVers = "0.6.2b1";
System.out.println(JSON);
- EnsemblXref testee = new EnsemblXref("http://rest.ensembl.org")
+ EnsemblXref testee = new EnsemblXref("http://rest.ensembl.org", dbName,
+ dbVers)
{
@Override
protected BufferedReader getHttpResponse(URL url, List<String> ids)
assertEquals(2, dbrefs.size());
assertEquals("CCDS", dbrefs.get(0).getSource());
assertEquals("CCDS5863", dbrefs.get(0).getAccessionId());
+ assertFalse(dbrefs.get(0).isPrimary());
+ assertEquals(dbName + ":" + dbVers, dbrefs.get(0).getVersion());
// Uniprot name should get converted to Jalview canonical form
assertEquals("UNIPROT", dbrefs.get(1).getSource());
assertEquals("P15056", dbrefs.get(1).getAccessionId());
+ assertEquals(dbName + ":" + dbVers, dbrefs.get(1).getVersion());
+ assertFalse(dbrefs.get(1).isPrimary());
}
}