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"))));
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations