Search in sources :

Example 56 with DbXref

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());
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) DbXrefConverterTest.createDbXref(org.nextprot.api.core.service.dbxref.conv.DbXrefConverterTest.createDbXref) Test(org.junit.Test)

Example 57 with DbXref

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);
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) Test(org.junit.Test)

Example 58 with DbXref

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);
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) Test(org.junit.Test)

Example 59 with DbXref

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));
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) Test(org.junit.Test)

Example 60 with DbXref

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));
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) Test(org.junit.Test)

Aggregations

DbXref (org.nextprot.api.core.domain.DbXref)146 Test (org.junit.Test)118 PublicationDbXref (org.nextprot.api.core.domain.PublicationDbXref)12 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)7 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)7 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)7 DbXrefConverterTest.createDbXref (org.nextprot.api.core.service.dbxref.conv.DbXrefConverterTest.createDbXref)5 Entry (org.nextprot.api.core.domain.Entry)4 Xref2Annotation (org.nextprot.api.commons.constants.Xref2Annotation)3 AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)3 DbXrefURLResolverDelegateTest (org.nextprot.api.core.service.dbxref.resolver.DbXrefURLResolverDelegateTest)3 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)3 WebIntegrationBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)3 ImmutableList (com.google.common.collect.ImmutableList)2 Isoform (org.nextprot.api.core.domain.Isoform)2 Annotation (org.nextprot.api.core.domain.annotation.Annotation)2 PageView (org.nextprot.api.core.domain.ui.page.PageView)2 EnsemblXrefPropertyConverter (org.nextprot.api.core.service.dbxref.conv.EnsemblXrefPropertyConverter)2 Preconditions (com.google.common.base.Preconditions)1 Multimap (com.google.common.collect.Multimap)1