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