Search in sources :

Example 1 with ChromosomeReport

use of org.nextprot.api.core.domain.ChromosomeReport 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 ChromosomeReport

use of org.nextprot.api.core.domain.ChromosomeReport 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 ChromosomeReport

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

the class ChromosomeReportTXTReaderTest method shouldReadValidFormat.

@Test
public void shouldReadValidFormat() throws Exception {
    ChromosomeReportTXTReader reader = new ChromosomeReportTXTReader();
    String content = "----------------------------------------------------------------------------\n" + "        neXtProt - a comprehensive human-centric discovery platform\n" + "        SIB Swiss Institute of Bioinformatics; Geneva, Switzerland\n" + "----------------------------------------------------------------------------\n" + "\n" + "Description: Chromosome 1 report\n" + "Name:        nextprot_chromosome_1\n" + "Release:     2017-04-12\n" + "\n" + "----------------------------------------------------------------------------\n" + "\n" + "This file lists all neXtProt entries on chromosome 1\n" + "Total number of entries: 2056\n" + "Total number of genes: 2104\n" + "\n" + "--------------------------------------------------------------------------------------------------------------------------------------------------------\n" + "Gene       neXtProt     \tChromosomal  Start    Stop    \tProtein\t\t\tProte-\tAnti-\t3D    \tDise-\tIso-\tVari-\tPTMs\tDescription\n" + "name       AC           \tposition     position position\texistence\t\tomics\tbody\t    \tase\tforms\tants\n" + "________________________________________________________________________________________________________________________________________________________\n" + "OR4F5      NX_Q8NH21    \t1p36.33         69091     70008\thomology        \tno    \tno    \tno    \tno    \t    1     73      1\tOlfactory receptor 4F5\n" + "OR4F29     NX_Q6IEY1    \t1p36.33        450740    451678\ttranscript level\tno    \tyes   \tno    \tno    \t    1      9      2\tOlfactory receptor 4F3/4F16/4F29\n" + "-          NX_P0DMU3    \t1p36.13             -         -\thomology        \tno    \tyes   \tno    \tno    \t    1      0      0\tFAM231A/C-like protein LOC102723383\n" + "HNRNPCL1   NX_O60812    \t-            12847408  12848725\tprotein level   \tyes   \tno    \tno    \tno    \t    1    322      5\tHeterogeneous nuclear ribonucleoprotein C-like 1\n";
    ChromosomeReport chromosomeReport = reader.read(new StringReader(content));
    Assert.assertEquals("2017-04-12", chromosomeReport.getDataRelease());
    Assert.assertEquals("1", chromosomeReport.getSummary().getChromosome());
    Assert.assertEquals(2056, chromosomeReport.getSummary().getEntryCount());
    Assert.assertEquals(2104, chromosomeReport.getSummary().getEntryReportCount());
    Assert.assertEquals(4, chromosomeReport.getEntryReports().size());
    assertEquals(chromosomeReport.getEntryReports().get(0), "OR4F5", "NX_Q8NH21", "1p36.33", "69091", "70008", "homology", false, false, false, false, 1, 73, 1, "Olfactory receptor 4F5");
    assertEquals(chromosomeReport.getEntryReports().get(1), "OR4F29", "NX_Q6IEY1", "1p36.33", "450740", "451678", "transcript level", false, true, false, false, 1, 9, 2, "Olfactory receptor 4F3/4F16/4F29");
    assertEquals(chromosomeReport.getEntryReports().get(2), "-", "NX_P0DMU3", "1p36.13", "-", "-", "homology", false, true, false, false, 1, 0, 0, "FAM231A/C-like protein LOC102723383");
    assertEquals(chromosomeReport.getEntryReports().get(3), "HNRNPCL1", "NX_O60812", "1", "12847408", "12848725", "protein level", true, false, false, false, 1, 322, 5, "Heterogeneous nuclear ribonucleoprotein C-like 1");
}
Also used : StringReader(java.io.StringReader) ChromosomeReport(org.nextprot.api.core.domain.ChromosomeReport) Test(org.junit.Test)

Example 4 with ChromosomeReport

use of org.nextprot.api.core.domain.ChromosomeReport 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 ChromosomeReport

use of org.nextprot.api.core.domain.ChromosomeReport 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

ChromosomeReport (org.nextprot.api.core.domain.ChromosomeReport)9 EntryReport (org.nextprot.api.core.domain.EntryReport)8 Test (org.junit.Test)5 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 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ProteinExistence (org.nextprot.api.core.domain.ProteinExistence)3 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)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 LineNumberReader (java.io.LineNumberReader)1