Search in sources :

Example 26 with Entry

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

the class IsoformUtilsTest method testGetIsoformByNameLowerCase.

@Test
public void testGetIsoformByNameLowerCase() throws Exception {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P06213").withTargetIsoforms());
    Assert.assertEquals("NX_P06213-1", IsoformUtils.getIsoformByName(entry, "long").getUniqueName());
}
Also used : Entry(org.nextprot.api.core.domain.Entry) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 27 with Entry

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

the class IsoformUtilsTest method testGetIsoformByName.

@Test
public void testGetIsoformByName() throws Exception {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P06213").withTargetIsoforms());
    Assert.assertEquals("NX_P06213-1", IsoformUtils.getIsoformByName(entry, "Long").getUniqueName());
}
Also used : Entry(org.nextprot.api.core.domain.Entry) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 28 with Entry

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

the class IsoformUtilsTest method testGetCanonicalIsoform.

@Test
public void testGetCanonicalIsoform() throws Exception {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").withTargetIsoforms());
    Assert.assertNotNull(IsoformUtils.getCanonicalIsoform(entry));
    Assert.assertEquals("NX_P01308-1", IsoformUtils.getCanonicalIsoform(entry).getUniqueName());
}
Also used : Entry(org.nextprot.api.core.domain.Entry) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 29 with Entry

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

the class IsoformSequencePositionMapperTest method getProjectedPositionNotInFrame.

/*
NX_P38398-3, pos=1812
NX_P38398-4, pos=1812
NX_P38398-5, pos=1812
NX_P38398-6, pos=1812 -> nucleotides not in frame
NX_P38398-2, pos=1812 -> no map as expected
NX_P38398-7, pos=1812
NX_P38398-8, pos=1812
        */
// TODO: missing specifications for "nucleotides not in frame" case (see User/story "Check not in frame")
@Ignore
@Test
public void getProjectedPositionNotInFrame() throws Exception {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P38398").withTargetIsoforms());
    Integer position = IsoformSequencePositionMapper.getProjectedPosition(IsoformUtils.getIsoformByName(entry, "NX_P38398-1"), 1812, IsoformUtils.getIsoformByName(entry, "NX_P38398-6"));
    Assert.assertNotNull(position);
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Ignore(org.junit.Ignore) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 30 with Entry

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

the class AnnotationUtilsTest method exportMergedAnnotationsForBrca1AndScn9A.

// @Test
public void exportMergedAnnotationsForBrca1AndScn9A() throws FileNotFoundException {
    List<String> accessions = Arrays.asList("NX_Q15858", "NX_P38398");
    List<String> headers = Arrays.asList("accession", "uniqueName", "category", "annotationName", "annotationHash", "masterPosition");
    PrintWriter pw = new PrintWriter("mergedBrca1AndScn9AVariants.tsv");
    // write header line
    pw.append(headers.stream().collect(Collectors.joining("\t"))).append("\n");
    for (String accession : accessions) {
        Entry entry = entryBuilderService.build(EntryConfig.newConfig(accession).withAnnotations());
        List<Annotation> mergedAnnotations = entry.getAnnotations().stream().filter(a -> a.getAnnotationHash() != null).filter(a -> a.getUniqueName().startsWith("AN")).filter(a -> a.getAPICategory() == AnnotationCategory.VARIANT || a.getAPICategory() == AnnotationCategory.MUTAGENESIS).collect(Collectors.toList());
        pw.append(exportAnnotationsAsTsvString(entry, mergedAnnotations));
    }
    pw.close();
}
Also used : CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) java.util(java.util) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Autowired(org.springframework.beans.factory.annotation.Autowired) ActiveProfiles(org.springframework.test.context.ActiveProfiles) EntryBuilderService(org.nextprot.api.core.service.EntryBuilderService) AnnotationEvidence(org.nextprot.api.core.domain.annotation.AnnotationEvidence) AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) AnnotationCategory(org.nextprot.api.commons.constants.AnnotationCategory) EntryConfig(org.nextprot.api.core.service.fluent.EntryConfig) BioObject(org.nextprot.api.core.domain.BioObject) IsoformUtils(org.nextprot.api.core.utils.IsoformUtils) IsoformSequencePositionMapper(org.nextprot.api.core.utils.seqmap.IsoformSequencePositionMapper) AnnotationProperty(org.nextprot.api.core.domain.annotation.AnnotationProperty) PrintWriter(java.io.PrintWriter) Entry(org.nextprot.api.core.domain.Entry) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) PropertyApiModel(org.nextprot.api.commons.constants.PropertyApiModel) AnnotationService(org.nextprot.api.core.service.AnnotationService) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) Isoform(org.nextprot.api.core.domain.Isoform) Mockito.mock(org.mockito.Mockito.mock) Entry(org.nextprot.api.core.domain.Entry) Annotation(org.nextprot.api.core.domain.annotation.Annotation) PrintWriter(java.io.PrintWriter)

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