Search in sources :

Example 1 with Overview

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

the class OverviewServiceIntegrationTest method testFunctionalRegionsForP26439.

@Test
public void testFunctionalRegionsForP26439() {
    Overview overview = overviewService.findOverviewByEntry("NX_P26439");
    List<EntityName> regionNames = overview.getFunctionalRegionNames();
    Assert.assertEquals(2, regionNames.size());
    Assert.assertTrue(new EntityNameCollectionTester(regionNames).contains(Arrays.asList(mockEntityNameWithSynonymsAndOtherRecNames("Steroid Delta-isomerase", "region name", "full", Collections.singletonList(mockEntityName("Delta-5-3-ketosteroid isomerase", "region name", "full")), Collections.singletonList(mockEntityName("5.3.3.1", "EC", "EC"))), mockEntityNameWithSynonymsAndOtherRecNames("3-beta-hydroxy-Delta(5)-steroid dehydrogenase", "region name", "full", Arrays.asList(mockEntityName("3-beta-hydroxy-5-ene steroid dehydrogenase", "region name", "full"), mockEntityName("Progesterone reductase", "region name", "full")), Collections.singletonList(mockEntityName("1.1.1.145", "EC", "EC"))))));
}
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 2 with Overview

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

the class OverviewServiceIntegrationTest method testChainNamesForP51659.

@Test
public void testChainNamesForP51659() {
    Overview overview = overviewService.findOverviewByEntry("NX_P51659");
    // / chain names
    List<EntityName> chainNames = overview.getCleavedRegionNames();
    Assert.assertEquals(2, chainNames.size());
    Assert.assertTrue(new EntityNameCollectionTester(chainNames).contains(Arrays.asList(mockEntityNameWithOtherRecNames("(3R)-hydroxyacyl-CoA dehydrogenase", "protein", "full", Collections.singletonList(mockEntityName("1.1.1.n12", "chain", "EC"))), mockEntityNameWithSynonymsAndOtherRecNames("Enoyl-CoA hydratase 2", "protein", "full", Collections.singletonList(mockEntityName("3-alpha,7-alpha,12-alpha-trihydroxy-5-beta-cholest-24-enoyl-CoA hydratase", "chain", "full")), Arrays.asList(mockEntityName("4.2.1.107", "chain", "EC"), mockEntityName("4.2.1.119", "chain", "EC"))))));
}
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 3 with Overview

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

the class OverviewServiceIntegrationTest method testNamesForQ86X52.

@Test
public void testNamesForQ86X52() {
    Overview overview = overviewService.findOverviewByEntry("NX_Q86X52");
    // / protein names
    EntityName recName = overview.getRecommendedProteinName();
    assertEntityNameEquals(recName, Overview.EntityNameClass.PROTEIN_NAMES, "PR_645672", "Chondroitin sulfate synthase 1");
    // recommended names
    Assert.assertTrue(new EntityNameCollectionTester(recName.getOtherRecommendedEntityNames()).contains(Arrays.asList(mockEntityName("2.4.1.175", "EC", "EC"), mockEntityName("2.4.1.226", "EC", "EC"))));
    // synonyms
    Assert.assertTrue(new EntityNameCollectionTester(recName.getSynonyms()).contains(Collections.emptyList()));
    // alternative names
    Assert.assertTrue(new EntityNameCollectionTester(overview.getAlternativeProteinNames()).contains(Arrays.asList(mockEntityName("Chondroitin glucuronyltransferase 1", "protein", "full"), mockEntityNameWithSynonyms("Chondroitin synthase 1", "protein", "full", Arrays.asList(mockEntityName("ChSy-1", "protein", "short"))), mockEntityName("Glucuronosyl-N-acetylgalactosaminyl-proteoglycan 4-beta-N-acetylgalactosaminyltransferase 1", "protein", "full"), mockEntityName("N-acetylgalactosaminyl-proteoglycan 3-beta-glucuronosyltransferase 1", "protein", "full"), mockEntityName("N-acetylgalactosaminyltransferase 1", "protein", "full"))));
    // / gene names
    List<EntityName> geneNames = overview.getGeneNames();
    Assert.assertEquals(1, geneNames.size());
    assertEntityNameEquals(geneNames.get(0), Overview.EntityNameClass.GENE_NAMES, "PR_1162684", "CHSY1");
    Assert.assertTrue(new EntityNameCollectionTester(geneNames.get(0).getOtherRecommendedEntityNames()).contains(Collections.<EntityName>emptyList()));
    Assert.assertTrue(new EntityNameCollectionTester(geneNames.get(0).getSynonyms()).contains(Arrays.asList(mockEntityName("CHSY", "gene name"), mockEntityName("CSS1", "gene name"), mockEntityName("KIAA0990", "gene name"), mockEntityName("UNQ756/PRO1487", "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 4 with Overview

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

the class NamesFieldBuilder method init.

@Override
protected void init(Entry entry) {
    Overview ovv = entry.getOverview();
    // TODO Daniel repeated code in CvFieldBuilder
    List<EntityName> altnames = null;
    altnames = ovv.getProteinNames();
    if (altnames != null)
        for (EntityName altname : altnames) {
            List<EntityName> paltnames = altname.getSynonyms();
            if (paltnames != null)
                for (EntityName paltfullname : paltnames) {
                    if (// Enzymes are delt with elsewhere
                    !paltfullname.getType().equals("enzyme name"))
                        addField(Fields.ALTERNATIVE_NAMES, paltfullname.getName());
                    List<EntityName> paltshortnames = paltfullname.getSynonyms();
                    if (paltshortnames != null)
                        for (EntityName paltshortname : paltshortnames) {
                            if (!paltshortname.getType().equals("enzyme name"))
                                addField(Fields.ALTERNATIVE_NAMES, paltshortname.getName());
                        }
                }
        }
    // special names (INN, allergens)
    altnames = ovv.getAdditionalNames();
    if (altnames != null)
        for (EntityName altname : altnames) {
            // System.err.println(altname.getName());
            addField(Fields.ALTERNATIVE_NAMES, altname.getName());
            String nametype = altname.getType();
            if (nametype.equals("CD antigen"))
                addField(Fields.CD_ANTIGEN, altname.getName());
            else if (nametype.equals("International Nonproprietary Names"))
                addField(Fields.INTERNATIONAL_NAME, altname.getName());
        }
    // The enzymatic activities of a multifunctional enzyme (maybe redundent with getEnzymes)
    altnames = ovv.getFunctionalRegionNames();
    if (altnames != null)
        for (EntityName altname : altnames) {
            // region_name should be renamed activity_name
            addField(Fields.REGION_NAME, altname.getName());
            List<EntityName> paltnames = altname.getSynonyms();
            if (paltnames != null)
                for (EntityName ecname : paltnames) {
                    addField(Fields.REGION_NAME, ecname.getName());
                    List<EntityName> shortnames = ecname.getSynonyms();
                    if (shortnames != null) {
                        for (EntityName xname : shortnames) addField(Fields.REGION_NAME, xname.getName());
                    }
                }
        }
    // Gene names, synonyms and orf names
    List<EntityName> genenames = ovv.getGeneNames();
    if (genenames != null) {
        String allgenenames = null;
        for (EntityName currname : genenames) {
            // Concatenate official gene names
            if (allgenenames == null)
                allgenenames = currname.getName();
            else
                allgenenames += "; " + currname.getName();
            List<EntityName> genesynonames = currname.getSynonyms();
            if (genesynonames != null)
                for (EntityName genesynoname : genesynonames) {
                    if (!genesynoname.getType().equals("open reading frame"))
                        addField(Fields.ALTERNATIVE_GENE_NAMES, genesynoname.getName());
                }
        }
        addField(Fields.RECOMMENDED_GENE_NAMES, allgenenames);
        addField(Fields.RECOMMENDED_GENE_NAMES_S, allgenenames);
        List<String> orfnames = getORFNames(ovv);
        if (orfnames != null)
            for (String orfname : orfnames) addField(Fields.ORF_NAMES, orfname);
    }
    // else System.err.println("no gene names for: " + entry.getUniqueName());
    List<Family> families = ovv.getFamilies();
    String allfamilies = null;
    for (Family family : families) {
        // We choose to index the descriptions (like "Belongs to the DNase II family") instead of the names
        if (// allfamilies = family.getName();
        allfamilies == null)
            // allfamilies = family.getName();
            allfamilies = family.getDescription();
        else
            allfamilies += " , " + family.getDescription();
    }
    if (allfamilies != null) {
        addField(Fields.FAMILY_NAMES, allfamilies);
        addField(Fields.FAMILY_NAMES_S, allfamilies);
    }
}
Also used : EntityName(org.nextprot.api.core.domain.EntityName) Family(org.nextprot.api.core.domain.Family) Overview(org.nextprot.api.core.domain.Overview) List(java.util.List) ArrayList(java.util.ArrayList)

Example 5 with Overview

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

the class OverviewFieldBuilder method init.

@Override
protected void init(Entry entry) {
    Overview ovv = entry.getOverview();
    String id = entry.getUniqueName();
    addField(Fields.ID, id);
    addField(Fields.IDSP0, id);
    addField(Fields.RECOMMENDED_AC, id.substring(3));
    addField(Fields.PE_LEVEL, ovv.getProteinExistences().getProteinExistence().getLevel());
    addField(Fields.PROTEIN_EXISTENCE, ovv.getProteinExistences().getProteinExistence().getDescriptionName());
    String precname = ovv.getMainProteinName();
    addField(Fields.RECOMMENDED_NAME, precname);
    addField(Fields.RECOMMENDED_NAME_S, precname);
}
Also used : Overview(org.nextprot.api.core.domain.Overview)

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