Search in sources :

Example 1 with EntryReport

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

the class ChromosomeReportTXTWriterTest 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.PROTEIN_LEVEL, 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");
    report.setEntryReports(Arrays.asList(entryReport1, entryReport2, entryReport3));
    StringOutputStream sos = new StringOutputStream();
    ChromosomeReportWriter writer = new ChromosomeReportTXTWriter(sos);
    writer.write(report);
    String[] observedLines = sos.toString().split("\\n");
    Assert.assertEquals(28, observedLines.length);
    Assert.assertEquals("Gene          neXtProt      Chromosomal  Start      Stop       Coding  Protein          Prote- Anti- 3D    Dise- Iso-  Vari-  PTMs Description", observedLines[16]);
    Assert.assertEquals("name          AC            location     position   position   strand  existence        omics  body        ase   forms ants        ", observedLines[17]);
    Assert.assertEquals("SRY           NX_Q05066     Yp11.2          2786855    2787699 reverse protein level    no     yes   yes   yes       1    47     1 Sex-determining region Y protein", observedLines[19]);
    Assert.assertEquals("RBMY1C        NX_P0DJD4     Yq11.23               -          - reverse protein level    no     yes   no    no        1     0     0 RNA-binding motif protein, Y chromosome, family 1 member C", observedLines[20]);
    Assert.assertEquals("MFSD14A       NX_Q96MC6     1p21.2        100038097  100083377 reverse protein level    no     no    no    no        1   141     3 Hippocampus abundant transcript 1 protein", observedLines[21]);
}
Also used : StringOutputStream(org.codehaus.plexus.util.StringOutputStream) ChromosomeReportWriter(org.nextprot.api.core.service.export.ChromosomeReportWriter) EntryReportTest.newEntryReport(org.nextprot.api.core.domain.EntryReportTest.newEntryReport) EntryReport(org.nextprot.api.core.domain.EntryReport) ChromosomeReport(org.nextprot.api.core.domain.ChromosomeReport) Test(org.junit.Test)

Example 2 with EntryReport

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

the class HPPChromosomeReportTSVWriterTest 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 HPPChromosomeReportTSVWriter(sos, overviewService);
    writer.write(report);
    String[] observedLines = sos.toString().split("\\n");
    Assert.assertEquals(5, observedLines.length);
    Assert.assertEquals("neXtProt AC\tGene name(s)\tProtein existence\tProteomics\tAntibody", observedLines[0]);
    Assert.assertEquals("NX_O14598\tVCY;VCY1B\tEvidence at protein level\tyes\tyes", observedLines[1]);
    Assert.assertEquals("NX_P0DJD4\tRBMY1C\tEvidence at protein level\tno\tyes", observedLines[2]);
    Assert.assertEquals("NX_Q05066\tSRY\tUncertain\tno\tyes", observedLines[3]);
    Assert.assertEquals("NX_Q96MC6\tMFSD14A\tEvidence at protein level\tno\tno", 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 3 with EntryReport

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

the class EntryGeneReportServiceImpl method reportEntry.

@Cacheable("entry-reports")
@Override
public List<EntryReport> reportEntry(String entryAccession) {
    EntryReportStats ers = entryReportStatsService.reportEntryStats(entryAccession);
    EntryReport report = new EntryReport();
    report.setAccession(entryAccession);
    report.setDescription(ers.getDescription());
    report.setProteinExistence(ers.getProteinExistence());
    report.setPropertyTest(EntryReport.IS_PROTEOMICS, ers.isProteomics());
    report.setPropertyTest(EntryReport.IS_ANTIBODY, ers.isAntibody());
    report.setPropertyTest(EntryReport.IS_3D, ers.is3D());
    report.setPropertyTest(EntryReport.IS_DISEASE, ers.isDisease());
    report.setPropertyCount(EntryReport.ISOFORM_COUNT, ers.countIsoforms());
    report.setPropertyCount(EntryReport.VARIANT_COUNT, ers.countVariants());
    report.setPropertyCount(EntryReport.PTM_COUNT, ers.countPTMs());
    report.setPropertyCount(EntryReport.CURATED_PUBLICATION_COUNT, ers.countCuratedPublications());
    report.setPropertyCount(EntryReport.ADDITIONAL_PUBLICATION_COUNT, ers.countAdditionalPublications());
    report.setPropertyCount(EntryReport.PATENT_COUNT, ers.countPatents());
    report.setPropertyCount(EntryReport.SUBMISSION_COUNT, ers.countSubmissions());
    report.setPropertyCount(EntryReport.WEB_RESOURCE_COUNT, ers.countWebResources());
    return duplicateReportForEachGene(entryAccession, report);
}
Also used : EntryReport(org.nextprot.api.core.domain.EntryReport) EntryReportStats(org.nextprot.api.core.domain.EntryReportStats) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 4 with EntryReport

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

the class EntryReportTest method newEntryReport.

public static EntryReport newEntryReport(String geneName, String ac, String chromosalPosition, String startPos, String stopPos, ProteinExistence protExistence, boolean isProteomics, boolean isAntibody, boolean is3D, boolean isDisease, int isoformCount, int variantCount, int ptmCount, String description) throws ParseException {
    EntryReport entryReport = new EntryReport();
    ChromosomalLocation cl = ChromosomalLocation.fromString(chromosalPosition);
    cl.setRecommendedName(geneName);
    cl.setFirstPosition((startPos.equals("-")) ? 0 : Integer.parseInt(startPos));
    cl.setLastPosition((stopPos.equals("-")) ? 0 : Integer.parseInt(stopPos));
    entryReport.setAccession(ac);
    entryReport.setChromosomalLocation(cl);
    entryReport.setProteinExistence(protExistence);
    entryReport.setPropertyTest(EntryReport.IS_PROTEOMICS, isProteomics);
    entryReport.setPropertyTest(EntryReport.IS_ANTIBODY, isAntibody);
    entryReport.setPropertyTest(EntryReport.IS_3D, is3D);
    entryReport.setPropertyTest(EntryReport.IS_DISEASE, isDisease);
    entryReport.setPropertyCount(EntryReport.ISOFORM_COUNT, isoformCount);
    entryReport.setPropertyCount(EntryReport.VARIANT_COUNT, variantCount);
    entryReport.setPropertyCount(EntryReport.PTM_COUNT, ptmCount);
    entryReport.setDescription(description);
    return entryReport;
}
Also used : EntryReport(org.nextprot.api.core.domain.EntryReport)

Example 5 with EntryReport

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

the class ChromosomeReportTSVWriter method writeChromosomeReport.

@Override
protected void writeChromosomeReport(ChromosomeReport report) throws IOException {
    writer.write(extractHeaders().stream().collect(Collectors.joining("\t")));
    writer.write("\n");
    for (EntryReport er : report.getEntryReports()) {
        writeEntryReport(extractValues(er));
    }
}
Also used : EntryReport(org.nextprot.api.core.domain.EntryReport)

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