Search in sources :

Example 6 with EntityName

use of org.nextprot.api.core.domain.EntityName 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 7 with EntityName

use of org.nextprot.api.core.domain.EntityName 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 8 with EntityName

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

the class EntityNameDaoImpl method findAlternativeChainNames.

@Override
public List<EntityName> findAlternativeChainNames(String uniqueName) {
    SqlParameterSource namedParameters = new MapSqlParameterSource("uniqueName", uniqueName);
    List<EntityName> entityNames = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("alternative-chain-names"), namedParameters, new EntryNameRowMapper());
    return entityNames;
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) SqlParameterSource(org.springframework.jdbc.core.namedparam.SqlParameterSource) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) EntityName(org.nextprot.api.core.domain.EntityName) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)

Example 9 with EntityName

use of org.nextprot.api.core.domain.EntityName 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 10 with EntityName

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

the class StatementETLBaseUnitTest method mockIsoform.

private Isoform mockIsoform(String accession, String name, boolean canonical) {
    Isoform isoform = Mockito.mock(Isoform.class);
    when(isoform.getUniqueName()).thenReturn(accession);
    when(isoform.getIsoformAccession()).thenReturn(accession);
    when(isoform.isCanonicalIsoform()).thenReturn(canonical);
    EntityName entityName = Mockito.mock(EntityName.class);
    when(entityName.getName()).thenReturn(name);
    when(isoform.getMainEntityName()).thenReturn(entityName);
    return isoform;
}
Also used : EntityName(org.nextprot.api.core.domain.EntityName) Isoform(org.nextprot.api.core.domain.Isoform)

Aggregations

EntityName (org.nextprot.api.core.domain.EntityName)19 Overview (org.nextprot.api.core.domain.Overview)8 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)5 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)4 Isoform (org.nextprot.api.core.domain.Isoform)3 Entry (org.nextprot.api.core.domain.Entry)2 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)2 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)2 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)2 List (java.util.List)1 Family (org.nextprot.api.core.domain.Family)1 EntityNameClass (org.nextprot.api.core.domain.Overview.EntityNameClass)1 History (org.nextprot.api.core.domain.Overview.History)1 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)1 Cacheable (org.springframework.cache.annotation.Cacheable)1 NodeList (org.w3c.dom.NodeList)1