Search in sources :

Example 6 with Overview

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

the class SequenceVariantTest method mockEntryWithGenes.

private Entry mockEntryWithGenes(String... geneNames) {
    Entry entry = Mockito.mock(Entry.class);
    Overview overview = Mockito.mock(Overview.class);
    when(entry.getOverview()).thenReturn(overview);
    List<EntityName> names = new ArrayList<>();
    for (String geneName : geneNames) {
        EntityName entityName = new EntityName();
        entityName.setName(geneName);
        names.add(entityName);
    }
    when(overview.getGeneNames()).thenReturn(names);
    return entry;
}
Also used : Entry(org.nextprot.api.core.domain.Entry) EntityName(org.nextprot.api.core.domain.EntityName) ArrayList(java.util.ArrayList) Overview(org.nextprot.api.core.domain.Overview)

Example 7 with Overview

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

the class IsoformPEFFHeaderBuilderTest method newIsoformPEFFHeaderBuilder.

private IsoformPEFFHeaderBuilder newIsoformPEFFHeaderBuilder(String isoName) {
    String entryAccession = isoformService.findEntryAccessionFromIsoformAccession(isoName);
    Isoform isoform = isoformService.findIsoform(isoName);
    List<Annotation> isoformAnnotations = annotationService.findAnnotations(entryAccession).stream().filter(annotation -> annotation.isSpecificForIsoform(isoName)).collect(Collectors.toList());
    Overview overview = overviewService.findOverviewByEntry(entryAccession);
    return new IsoformPEFFHeaderBuilder(isoform, isoformAnnotations, overview, terminologyService::findPsiModAccession, terminologyService::findPsiModName);
}
Also used : CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Autowired(org.springframework.beans.factory.annotation.Autowired) Test(org.junit.Test) OverviewService(org.nextprot.api.core.service.OverviewService) ActiveProfiles(org.springframework.test.context.ActiveProfiles) AnnotationService(org.nextprot.api.core.service.AnnotationService) Collectors(java.util.stream.Collectors) TerminologyService(org.nextprot.api.core.service.TerminologyService) Overview(org.nextprot.api.core.domain.Overview) List(java.util.List) IsoformPEFFHeader(org.nextprot.api.core.domain.IsoformPEFFHeader) IsoformService(org.nextprot.api.core.service.IsoformService) Assert(org.junit.Assert) Isoform(org.nextprot.api.core.domain.Isoform) Isoform(org.nextprot.api.core.domain.Isoform) Overview(org.nextprot.api.core.domain.Overview) Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Example 8 with Overview

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

the class OverviewServiceIntegrationTest method testNamesForQ3L8U1.

@Test
public void testNamesForQ3L8U1() {
    Overview overview = overviewService.findOverviewByEntry("NX_Q3L8U1");
    // / protein names
    EntityName recName = overview.getRecommendedProteinName();
    assertEntityNameEquals(recName, Overview.EntityNameClass.PROTEIN_NAMES, "PR_699748", "Chromodomain-helicase-DNA-binding protein 9");
    // recommended names
    Assert.assertTrue(new EntityNameCollectionTester(recName.getOtherRecommendedEntityNames()).contains(Arrays.asList(mockEntityName("3.6.4.12", "EC", "EC"))));
    // synonyms
    Assert.assertTrue(new EntityNameCollectionTester(recName.getSynonyms()).contains(Arrays.asList(mockEntityName("CHD-9", "protein", "short"))));
    // alternative names
    Assert.assertTrue(new EntityNameCollectionTester(overview.getAlternativeProteinNames()).contains(Arrays.asList(mockEntityName("ATP-dependent helicase CHD9", "protein", "full"), mockEntityNameWithSynonyms("Chromatin-related mesenchymal modulator", "protein", "full", Arrays.asList(mockEntityName("CReMM", "protein", "short"))), mockEntityName("Chromatin-remodeling factor CHROM1", "protein", "full"), mockEntityName("Kismet homolog 2", "protein", "full"), mockEntityName("Peroxisomal proliferator-activated receptor A-interacting complex 320 kDa protein", "protein", "full"), mockEntityName("PPAR-alpha-interacting complex protein 320 kDa", "protein", "full"))));
    // / gene names
    List<EntityName> geneNames = overview.getGeneNames();
    Assert.assertEquals(1, geneNames.size());
    assertEntityNameEquals(geneNames.get(0), Overview.EntityNameClass.GENE_NAMES, "PR_1181044", "CHD9");
    Assert.assertTrue(new EntityNameCollectionTester(geneNames.get(0).getOtherRecommendedEntityNames()).contains(Collections.<EntityName>emptyList()));
    Assert.assertTrue(new EntityNameCollectionTester(geneNames.get(0).getSynonyms()).contains(Arrays.asList(mockEntityName("KIAA0308", "gene name"), mockEntityName("KISH2", "gene name"), mockEntityName("PRIC320", "gene name"), mockEntityName("AD-013", "ORF"), mockEntityName("x0008", "ORF"))));
}
Also used : EntityName(org.nextprot.api.core.domain.EntityName) Overview(org.nextprot.api.core.domain.Overview) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 9 with Overview

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

the class OverviewServiceImpl method findOverviewByEntry.

@Override
@Cacheable("overview")
public Overview findOverviewByEntry(String uniqueName) {
    Overview overview = new Overview();
    List<History> history = this.historyDao.findHistoryByEntry(uniqueName);
    if (history != null && history.size() != 0)
        overview.setHistory(history.get(0));
    List<EntityName> entityNames = this.entryNameDao.findNames(uniqueName);
    entityNames.addAll(entryNameDao.findAlternativeChainNames(uniqueName));
    setNamesInOverview(entityNames, overview);
    overview.setFamilies(this.familyService.findFamilies(uniqueName));
    overview.setIsoformNames(convertIsoNamestoOverviewName(isoformService.findIsoformsByEntryName(uniqueName)));
    overview.setProteinExistences(proteinExistenceService.getProteinExistences(uniqueName));
    return overview;
}
Also used : EntityName(org.nextprot.api.core.domain.EntityName) Overview(org.nextprot.api.core.domain.Overview) History(org.nextprot.api.core.domain.Overview.History) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 10 with Overview

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

the class EntryOverviewXMLUnitTest method shouldContainOverviewWithGeneNameList.

// Tests issue CALIPHOMISC-330
// https://issues.isb-sib.ch/browse/CALIPHOMISC-330
@Test
public void shouldContainOverviewWithGeneNameList() throws Exception {
    // Create an entry for test purposes
    Entry entry = new Entry("my-test-entry");
    Overview overview = new Overview();
    entry.setOverview(overview);
    List<EntityName> names = new ArrayList<EntityName>();
    overview.setGeneNames(names);
    EntityName mainName = new EntityName();
    mainName.setMain(true);
    mainName.setName("ABCD");
    EntityName synonym = new EntityName();
    synonym.setMain(false);
    synonym.setName("EFGH");
    EntityName orf = new EntityName();
    orf.setMain(false);
    orf.setName("IJKL");
    orf.setCategory("ORF");
    mainName.addAllSynonyms(Arrays.asList(synonym, orf));
    names.add(mainName);
    // Gets the velocity output
    String output = this.getVelocityOutput(entry);
    NodeList nodes = XMLUnitUtils.getMatchingNodes(output, "entry/overview");
    assertEquals(1, nodes.getLength());
    // Test the content using xmlunit
    NodeList recommendedNodes = XMLUnitUtils.getMatchingNodes(output, "entry/overview/gene-list/gene/gene-name[@type='primary']");
    assertEquals("ABCD", recommendedNodes.item(0).getTextContent());
    NodeList alternativeNodeList = XMLUnitUtils.getMatchingNodes(output, "entry/overview/gene-list/gene/gene-name[@type='synonym']");
    assertEquals("EFGH", alternativeNodeList.item(0).getTextContent());
    NodeList orfNodeList = XMLUnitUtils.getMatchingNodes(output, "entry/overview/gene-list/gene/gene-name[@type='ORF']");
    assertEquals("IJKL", orfNodeList.item(0).getTextContent());
}
Also used : Entry(org.nextprot.api.core.domain.Entry) EntityName(org.nextprot.api.core.domain.EntityName) NodeList(org.w3c.dom.NodeList) ArrayList(java.util.ArrayList) Overview(org.nextprot.api.core.domain.Overview) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Aggregations

Overview (org.nextprot.api.core.domain.Overview)10 EntityName (org.nextprot.api.core.domain.EntityName)8 Test (org.junit.Test)6 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)5 ArrayList (java.util.ArrayList)3 List (java.util.List)2 Entry (org.nextprot.api.core.domain.Entry)2 Collectors (java.util.stream.Collectors)1 Assert (org.junit.Assert)1 Family (org.nextprot.api.core.domain.Family)1 Isoform (org.nextprot.api.core.domain.Isoform)1 IsoformPEFFHeader (org.nextprot.api.core.domain.IsoformPEFFHeader)1 History (org.nextprot.api.core.domain.Overview.History)1 Annotation (org.nextprot.api.core.domain.annotation.Annotation)1 AnnotationService (org.nextprot.api.core.service.AnnotationService)1 IsoformService (org.nextprot.api.core.service.IsoformService)1 OverviewService (org.nextprot.api.core.service.OverviewService)1 TerminologyService (org.nextprot.api.core.service.TerminologyService)1 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1