Search in sources :

Example 6 with EntryReport

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

the class ChromosomeReportTXTWriter method writeChromosomeReport.

@Override
protected void writeChromosomeReport(ChromosomeReport report) throws IOException {
    String headerFormat = buildHeaderFormat();
    String valuesFormat = buildValuesFormat();
    writer.write("\n--------------------------------------------------------------------------------------------------------------------------------------------------------\n");
    writer.write(String.format(headerFormat, Arrays.asList("Gene", "neXtProt", "Chromosomal", "Start", "Stop", "Coding", "Protein", "Prote-", "Anti-", "3D", "Dise-", "Iso-", "Vari-", "PTMs", "Description").toArray()));
    writer.write(String.format(headerFormat, Arrays.asList("name", "AC", "location", "position", "position", "strand", "existence", "omics", "body", "", "ase", "forms", "ants", "", "").toArray()));
    writer.write("________________________________________________________________________________________________________________________________________________________\n");
    for (EntryReport er : report.getEntryReports()) {
        writer.write(String.format(valuesFormat, extractValues(er).toArray()));
    }
}
Also used : EntryReport(org.nextprot.api.core.domain.EntryReport)

Example 7 with EntryReport

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

the class HPPChromosomeReportTXTWriterTest method writeChromosomeReportUnknownGeneNames.

@Test
public void writeChromosomeReportUnknownGeneNames() throws Exception {
    ChromosomeReport report = new ChromosomeReport();
    report.setDataRelease("2017-01-23");
    ChromosomeReport.Summary summary = new ChromosomeReport.Summary();
    summary.setChromosome("unknown");
    summary.setEntryReportCount(5);
    summary.setEntryCount(5);
    report.setSummary(summary);
    EntryReport entryReport1 = newEntryReport(null, "NX_O00370", null, "-", "-", ProteinExistence.PROTEIN_LEVEL, false, false, true, false, 1, 0, 0, "LINE-1 retrotransposable element ORF2 protein");
    report.setEntryReports(Collections.singletonList(entryReport1));
    StringOutputStream sos = new StringOutputStream();
    HPPChromosomeReportWriter writer = new HPPChromosomeReportTXTWriter(sos, overviewService);
    writer.write(report);
    String[] observedLines = sos.toString().split("\\n");
    Assert.assertEquals(2, observedLines.length);
    Assert.assertEquals("neXtProt AC   Gene name(s) Protein existence            Proteomics Antibody", observedLines[0]);
    Assert.assertEquals("NX_O00370     -            Evidence at protein level    no         no      ", observedLines[1]);
}
Also used : StringOutputStream(org.codehaus.plexus.util.StringOutputStream) EntryReportTest.newEntryReport(org.nextprot.api.core.domain.EntryReportTest.newEntryReport) EntryReport(org.nextprot.api.core.domain.EntryReport) HPPChromosomeReportWriter(org.nextprot.api.core.service.export.HPPChromosomeReportWriter) ChromosomeReport(org.nextprot.api.core.domain.ChromosomeReport) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 8 with EntryReport

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

the class HPPChromosomeReportTXTWriterTest method writeChromosomeReport.

@Test
public void writeChromosomeReport() throws Exception {
    ChromosomeReport report = new ChromosomeReport();
    report.setDataRelease("2017-01-23");
    ChromosomeReport.Summary summary = new ChromosomeReport.Summary();
    summary.setChromosome("Y");
    summary.setEntryReportCount(58);
    summary.setEntryCount(48);
    report.setSummary(summary);
    EntryReport entryReport1 = newEntryReport("SRY", "NX_Q05066", "Yp11.2", "2786855", "2787699", ProteinExistence.UNCERTAIN, false, true, true, true, 1, 47, 1, "Sex-determining region Y protein");
    EntryReport entryReport2 = newEntryReport("RBMY1C", "NX_P0DJD4", "Yq11.23", "-", "-", ProteinExistence.PROTEIN_LEVEL, false, true, false, false, 1, 0, 0, "RNA-binding motif protein, Y chromosome, family 1 member C");
    EntryReport entryReport3 = newEntryReport("MFSD14A", "NX_Q96MC6", "1p21.2", "100038097", "100083377", ProteinExistence.PROTEIN_LEVEL, false, false, false, false, 1, 141, 3, "Hippocampus abundant transcript 1 protein");
    EntryReport entryReport4 = newEntryReport("VCY", "NX_O14598", "Yq11.221", "13985772", "13986513", ProteinExistence.PROTEIN_LEVEL, true, true, false, false, 1, 4, 0, "Testis-specific basic protein Y 1");
    EntryReport entryReport5 = newEntryReport("VCY", "NX_O14598", "Yq11.221", "14056217", "14056958", ProteinExistence.PROTEIN_LEVEL, true, true, false, false, 1, 4, 0, "Testis-specific basic protein Y 1");
    report.setEntryReports(Arrays.asList(entryReport1, entryReport2, entryReport3, entryReport4, entryReport5));
    StringOutputStream sos = new StringOutputStream();
    HPPChromosomeReportWriter writer = new HPPChromosomeReportTXTWriter(sos, overviewService);
    writer.write(report);
    String[] observedLines = sos.toString().split("\\n");
    Assert.assertEquals(5, observedLines.length);
    Assert.assertEquals("neXtProt AC   Gene name(s) Protein existence            Proteomics Antibody", observedLines[0]);
    Assert.assertEquals("NX_O14598     VCY;VCY1B    Evidence at protein level    yes        yes     ", observedLines[1]);
    Assert.assertEquals("NX_P0DJD4     RBMY1C       Evidence at protein level    no         yes     ", observedLines[2]);
    Assert.assertEquals("NX_Q05066     SRY          Uncertain                    no         yes     ", observedLines[3]);
    Assert.assertEquals("NX_Q96MC6     MFSD14A      Evidence at protein level    no         no      ", observedLines[4]);
}
Also used : StringOutputStream(org.codehaus.plexus.util.StringOutputStream) EntryReportTest.newEntryReport(org.nextprot.api.core.domain.EntryReportTest.newEntryReport) EntryReport(org.nextprot.api.core.domain.EntryReport) HPPChromosomeReportWriter(org.nextprot.api.core.service.export.HPPChromosomeReportWriter) ChromosomeReport(org.nextprot.api.core.domain.ChromosomeReport) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 9 with EntryReport

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

the class EntryReportStatsServiceIntegrationTest method NX_Q9Y6F7ShouldHave1GeneWith2ChromosomalLocationsAtDifferentDNAStrands.

@Test
public void NX_Q9Y6F7ShouldHave1GeneWith2ChromosomalLocationsAtDifferentDNAStrands() {
    List<EntryReport> reports = entryGeneReportService.reportEntry("NX_Q9Y6F7");
    Assert.assertEquals(2, reports.size());
    for (EntryReport report : reports) {
        Assert.assertEquals("NX_Q9Y6F7", report.getAccession());
        Assert.assertEquals("CDY2A", report.getGeneName());
        Assert.assertEquals("Yq11.222", report.getChromosomalLocation());
    }
}
Also used : EntryReport(org.nextprot.api.core.domain.EntryReport) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 10 with EntryReport

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

the class EntryReportTest method testPublicationCounts.

@Test
public void testPublicationCounts() throws Exception {
    EntryReport er = newEntryReport("HNRNPCL1", "NX_O60812", "1q32", "12847408", "12848725", ProteinExistence.PROTEIN_LEVEL, true, false, false, false, 1, 322, 5, "Heterogeneous nuclear ribonucleoprotein C-like 1");
    er.setPropertyCount(CURATED_PUBLICATION_COUNT, 44);
    er.setPropertyCount(ADDITIONAL_PUBLICATION_COUNT, 13);
    er.setPropertyCount(PATENT_COUNT, 0);
    er.setPropertyCount(SUBMISSION_COUNT, 3);
    er.setPropertyCount(WEB_RESOURCE_COUNT, 0);
    Assert.assertEquals(44, er.countCuratedPublications());
    Assert.assertEquals(13, er.countAdditionalPublications());
    Assert.assertEquals(0, er.countPatents());
    Assert.assertEquals(3, er.countSubmissions());
    Assert.assertEquals(0, er.countWebResources());
}
Also used : EntryReport(org.nextprot.api.core.domain.EntryReport) Test(org.junit.Test)

Aggregations

EntryReport (org.nextprot.api.core.domain.EntryReport)15 ChromosomeReport (org.nextprot.api.core.domain.ChromosomeReport)8 Test (org.junit.Test)6 HPPChromosomeReportWriter (org.nextprot.api.core.service.export.HPPChromosomeReportWriter)5 StringOutputStream (org.codehaus.plexus.util.StringOutputStream)4 EntryReportTest.newEntryReport (org.nextprot.api.core.domain.EntryReportTest.newEntryReport)4 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ProteinExistence (org.nextprot.api.core.domain.ProteinExistence)3 OutputStream (java.io.OutputStream)2 PrintWriter (java.io.PrintWriter)2 Arrays (java.util.Arrays)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 EntityName (org.nextprot.api.core.domain.EntityName)2 Overview (org.nextprot.api.core.domain.Overview)2 OverviewService (org.nextprot.api.core.service.OverviewService)2 Cacheable (org.springframework.cache.annotation.Cacheable)2