Search in sources :

Example 46 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class BuildEntryTest method testWithEnsemblGeneShouldBePresent.

@Test
public void testWithEnsemblGeneShouldBePresent() throws Exception {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").withGenomicMappings().withChromosomalLocations());
    Assert.assertEquals(1, entry.getChromosomalLocations().size());
    Assert.assertEquals("ENSG00000254647", entry.getChromosomalLocations().get(0).getAccession());
    Assert.assertTrue(!entry.getGenomicMappings().isEmpty());
    Assert.assertEquals("ENSG00000254647", entry.getGenomicMappings().get(0).getAccession());
    Assert.assertEquals("Ensembl", entry.getGenomicMappings().get(0).getDatabase());
}
Also used : Entry(org.nextprot.api.core.domain.Entry) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest) Test(org.junit.Test)

Example 47 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class BuildEntryTest method testNonEnsgShouldHaveUndefinedAccession.

@Test
public void testNonEnsgShouldHaveUndefinedAccession() throws Exception {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_Q96PT3").withGenomicMappings().withChromosomalLocations().withXrefs());
    Assert.assertEquals(1, entry.getChromosomalLocations().size());
    Assert.assertTrue(!entry.getChromosomalLocations().get(0).getAccession().isEmpty());
    Assert.assertTrue(entry.getGenomicMappings().isEmpty());
}
Also used : Entry(org.nextprot.api.core.domain.Entry) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest) Test(org.junit.Test)

Example 48 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class BuildEntryTest method testVirtualGene2ShouldBeAbsent.

@Test
public void testVirtualGene2ShouldBeAbsent() throws Exception {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_O00370").withGenomicMappings().withChromosomalLocations().withXrefs());
    Assert.assertEquals(1, entry.getChromosomalLocations().size());
    Assert.assertTrue(!entry.getChromosomalLocations().get(0).getAccession().isEmpty());
    Assert.assertTrue(entry.getGenomicMappings().isEmpty());
    for (DbXref xref : entry.getXrefs()) {
        Assert.assertTrue(!xref.getAccession().matches("VG.+"));
    }
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) Entry(org.nextprot.api.core.domain.Entry) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest) Test(org.junit.Test)

Example 49 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class PepXIntegrationAndValidationTest method testPepXService.

@Test
public void testPepXService() throws Exception {
    List<String> peptides = getPeptides();
    for (String peptide : peptides) {
        List<Entry> entries = pepXService.findEntriesWithPeptides(peptide, true);
        for (Entry entry : entries) {
            System.out.println("testing peptide:" + peptide + " for " + entry.getUniprotName());
            // we should have at least one annotation for each entry / peptide match (can be a null variant)
            assertFalse(entry.getAnnotations().isEmpty());
        }
    }
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Test(org.junit.Test) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)

Example 50 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class PepXIntegrationAndValidationTest method testSinglePeptideWithUnicityUnique.

@Test
public void testSinglePeptideWithUnicityUnique() throws Exception {
    // NX_PEPT01668698	DJCQAQGVAJQTMK
    // replaced any J in original with L otherwise pepx don't match the peptide !!!!
    String peptide = "DICQAQGVAIQTMK";
    List<Entry> result = pepXService.findEntriesWithPeptides(peptide, true);
    Assert.assertEquals(1, result.size());
    List<Annotation> annots = result.get(0).getAnnotationsByCategory(AnnotationCategory.PEPX_VIRTUAL_ANNOTATION);
    Assert.assertEquals(1, annots.size());
    Annotation a = annots.get(0);
    Assert.assertEquals("DICQAQGVAIQTMK", a.getCvTermName());
    assertTrue(a.getPropertiesByKey(PropertyApiModel.NAME_PEPTIDE_PROTEOTYPICITY).stream().allMatch(p -> p.getValue().equals("Y")));
    assertTrue(a.getPropertiesByKey(PropertyApiModel.NAME_PEPTIDE_UNICITY).stream().allMatch(p -> p.getValue().equals(PeptideUnicity.Value.UNIQUE.name())));
    assertTrue(a.getPropertiesByKey(PropertyApiModel.NAME_PEPTIDE_UNICITY_WITH_VARIANTS).stream().allMatch(p -> p.getValue().equals(PeptideUnicity.Value.UNIQUE.name())));
}
Also used : Arrays(java.util.Arrays) Entry(org.nextprot.api.core.domain.Entry) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Autowired(org.springframework.beans.factory.annotation.Autowired) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) PropertyApiModel(org.nextprot.api.commons.constants.PropertyApiModel) TreeSet(java.util.TreeSet) PeptideUnicity(org.nextprot.api.core.domain.PeptideUnicity) List(java.util.List) AnnotationCategory(org.nextprot.api.commons.constants.AnnotationCategory) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest) Assert.assertFalse(org.junit.Assert.assertFalse) DataSourceServiceLocator(org.nextprot.api.commons.spring.jdbc.DataSourceServiceLocator) PepXService(org.nextprot.api.web.service.PepXService) Assert(org.junit.Assert) Entry(org.nextprot.api.core.domain.Entry) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)

Aggregations

Entry (org.nextprot.api.core.domain.Entry)60 Test (org.junit.Test)38 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)16 Annotation (org.nextprot.api.core.domain.annotation.Annotation)9 Isoform (org.nextprot.api.core.domain.Isoform)8 EntryConfig (org.nextprot.api.core.service.fluent.EntryConfig)8 WebIntegrationBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)8 EntryBuilderService (org.nextprot.api.core.service.EntryBuilderService)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 Assert (org.junit.Assert)4 Ignore (org.junit.Ignore)4 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)4 DbXref (org.nextprot.api.core.domain.DbXref)4 ArrayList (java.util.ArrayList)3 PropertyApiModel (org.nextprot.api.commons.constants.PropertyApiModel)3 SolrDiffTest (org.nextprot.api.tasks.solr.indexer.entry.SolrDiffTest)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 PrintWriter (java.io.PrintWriter)2 java.util (java.util)2