use of org.nextprot.api.core.domain.DbXref in project nextprot-api by calipho-sib.
the class RefSeqDbXrefConverterTest method testConvert.
@Test
public void testConvert() {
DbXrefPropertyToXrefConverter converter = new RefSeqDbXrefConverter();
DbXref xref = createDbXref("NP_000198.1", DbXrefURLResolverSupplier.REF_SEQ.getXrefDatabase().getName(), "http://www.ncbi.nlm.nih.gov/protein/%s", "http://www.ncbi.nlm.nih.gov/refseq/");
xref.setProperties(Collections.singletonList(createDbXrefProperty(5309676, "nucleotide sequence ID", "NM_000207.2")));
List<DbXref> xrefs = converter.convert(xref);
Assert.assertEquals(1, xrefs.size());
DbXref ref = xrefs.get(0);
Assert.assertEquals(IdentifierOffset.XREF_PROPERTY_OFFSET + 5309676L, ref.getDbXrefId().longValue());
Assert.assertEquals("NM_000207.2", ref.getAccession());
Assert.assertEquals("http://www.ncbi.nlm.nih.gov/nuccore/%s", ref.getLinkUrl());
Assert.assertEquals("http://www.ncbi.nlm.nih.gov/refseq/", ref.getUrl());
Assert.assertEquals("http://www.ncbi.nlm.nih.gov/nuccore/NM_000207.2", ref.getResolvedUrl());
Assert.assertEquals(XrefDatabase.REF_SEQ.getName(), ref.getDatabaseName());
Assert.assertEquals("Sequence databases", ref.getDatabaseCategory());
Assert.assertTrue(ref.getProperties().isEmpty());
}
use of org.nextprot.api.core.domain.DbXref in project nextprot-api by calipho-sib.
the class CghDbArpXrefURLResolverTest method testResolveCGH_DBMissingDashInAccessionNumber.
@Test(expected = UnresolvedXrefURLException.class)
public void testResolveCGH_DBMissingDashInAccessionNumber() throws Exception {
DbXref xref = DbXrefURLResolverDelegateTest.createDbXref("90294", "CGH-DB", "http://www.cghtmd.jp/CGHDatabase/mapViewer?hid=%s&aid=%t&lang=en");
resolver.resolve(xref);
}
use of org.nextprot.api.core.domain.DbXref in project nextprot-api by calipho-sib.
the class CghDbArpXrefURLResolverTest method testResolveCGH_DBMissingPlaceHolder.
@Test(expected = UnresolvedXrefURLException.class)
public void testResolveCGH_DBMissingPlaceHolder() throws Exception {
DbXref xref = DbXrefURLResolverDelegateTest.createDbXref("9029-4", "CGH-DB", "http://www.cghtmd.jp/CGHDatabase/mapViewer?hid=%s&aid=t&lang=en");
resolver.resolve(xref);
}
use of org.nextprot.api.core.domain.DbXref in project nextprot-api by calipho-sib.
the class ConstantLinkXrefURLResolverTest method testResolveUCSC.
@Test
public void testResolveUCSC() throws Exception {
DefaultDbXrefURLResolver resolver = new ConstantLinkXrefURLResolver(CvDatabasePreferredLink.UCSC);
DbXref xref = DbXrefURLResolverDelegateTest.createDbXrefWithEntry("NX_ENTRY_AC", "UCSC_AC", "UCSC", "/some/link/to/override/");
Assert.assertEquals("https://genome.ucsc.edu/cgi-bin/hgLinkIn?resource=uniprot&id=ENTRY_AC", resolver.resolve(xref));
}
use of org.nextprot.api.core.domain.DbXref in project nextprot-api by calipho-sib.
the class ConstantLinkXrefURLResolverTest method testResolvePDB.
// entry/NX_P01308/xref.json
@Test
public void testResolvePDB() throws Exception {
DefaultDbXrefURLResolver resolver = new ConstantLinkXrefURLResolver(CvDatabasePreferredLink.PDB);
DbXref xref = DbXrefURLResolverDelegateTest.createDbXref("1A7F", "PDB", "whatever");
Assert.assertEquals("https://www.rcsb.org/pdb/explore/explore.do?pdbId=1A7F", resolver.resolve(xref));
}
Aggregations