Search in sources :

Example 1 with StringOutputStream

use of org.codehaus.plexus.util.StringOutputStream 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 StringOutputStream

use of org.codehaus.plexus.util.StringOutputStream 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 StringOutputStream

use of org.codehaus.plexus.util.StringOutputStream in project nextprot-api by calipho-sib.

the class EntryProteinExistenceReportTSVWriterTest method testExport.

@Test
public void testExport() {
    StringOutputStream sos = new StringOutputStream();
    EntryProteinExistenceReportTSVWriter writer = new EntryProteinExistenceReportTSVWriter(sos);
    writer.write("NX_Q6SJ96", overviewService.findOverviewByEntry("NX_Q6SJ96").getProteinExistences());
    writer.close();
    String[] observedLines = sos.toString().split("\\n");
    Assert.assertEquals(2, observedLines.length);
    Assert.assertEquals("NX_Q6SJ96\tEvidence at protein level\tEvidence at transcript level\tEvidence at protein level\tPromote to PE1 based on expression data", observedLines[1]);
}
Also used : StringOutputStream(org.codehaus.plexus.util.StringOutputStream) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 4 with StringOutputStream

use of org.codehaus.plexus.util.StringOutputStream 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 5 with StringOutputStream

use of org.codehaus.plexus.util.StringOutputStream 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)

Aggregations

StringOutputStream (org.codehaus.plexus.util.StringOutputStream)5 Test (org.junit.Test)5 ChromosomeReport (org.nextprot.api.core.domain.ChromosomeReport)4 EntryReport (org.nextprot.api.core.domain.EntryReport)4 EntryReportTest.newEntryReport (org.nextprot.api.core.domain.EntryReportTest.newEntryReport)4 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)4 HPPChromosomeReportWriter (org.nextprot.api.core.service.export.HPPChromosomeReportWriter)3 ChromosomeReportWriter (org.nextprot.api.core.service.export.ChromosomeReportWriter)1