Search in sources :

Example 1 with SequencedPatientReport

use of com.hartwig.hmftools.patientreporter.SequencedPatientReport in project hmftools by hartwigmedical.

the class PDFWriterTest method canGenerateSequenceReport.

@Test
public void canGenerateSequenceReport() throws DRException, IOException {
    final double pathologyTumorPercentage = 0.6;
    final double impliedTumorPurity = 0.58;
    final int mutationalLoad = 361;
    final double microsatelliteIndicator = 2.1;
    final HmfReporterData reporterData = testHmfReporterData();
    final BaseReporterData baseReporterData = testBaseReporterData();
    final FittedPurity fittedPurity = createFittedPurity(impliedTumorPurity);
    final List<VariantReport> variants = createTestVariants(new PurityAdjuster(Gender.MALE, fittedPurity));
    final List<GeneCopyNumber> copyNumbers = createTestCopyNumbers();
    final List<GeneDisruptionData> disruptions = createTestDisruptions();
    final List<GeneFusionData> fusions = createTestFusions();
    final SampleReport sampleReport = testSampleReport(pathologyTumorPercentage);
    final List<Alteration> alterations = RUN_CIVIC_ANALYSIS ? PatientReporterTestUtil.runCivicAnalysis(variants, copyNumbers, disruptions, fusions, reporterData.panelGeneModel(), sampleReport.cancerType()) : mockedAlterations();
    final SequencedPatientReport patientReport = ImmutableSequencedPatientReport.of(sampleReport, variants, mutationalLoad, microsatelliteIndicator, copyNumbers, disruptions, fusions, PatientReportFormat.formatPercent(impliedTumorPurity), alterations, Resources.getResource("circos" + File.separator + "circos_example.png").getPath(), Optional.of("this is a test report and does not relate to any real CPCT patient"), baseReporterData.signaturePath());
    final JasperReportBuilder mainReport = PDFWriter.generatePatientReport(patientReport, reporterData);
    assertNotNull(mainReport);
    final JasperReportBuilder evidenceReport = EvidenceReport.generate(patientReport);
    assertNotNull(evidenceReport);
    if (SHOW_AND_PRINT) {
        mainReport.show().print();
    }
    if (WRITE_TO_PDF) {
        mainReport.toPdf(new FileOutputStream(REPORT_BASE_DIR + File.separator + "test_report.pdf"));
        evidenceReport.toPdf(new FileOutputStream(REPORT_BASE_DIR + File.separator + "test_evidence_report.pdf"));
    }
}
Also used : PurityAdjuster(com.hartwig.hmftools.common.purple.PurityAdjuster) ImmutableSequencedPatientReport(com.hartwig.hmftools.patientreporter.ImmutableSequencedPatientReport) SequencedPatientReport(com.hartwig.hmftools.patientreporter.SequencedPatientReport) NotSequencedPatientReport(com.hartwig.hmftools.patientreporter.NotSequencedPatientReport) ImmutableNotSequencedPatientReport(com.hartwig.hmftools.patientreporter.ImmutableNotSequencedPatientReport) PatientReporterTestUtil.testBaseReporterData(com.hartwig.hmftools.patientreporter.PatientReporterTestUtil.testBaseReporterData) BaseReporterData(com.hartwig.hmftools.patientreporter.BaseReporterData) ImmutableSampleReport(com.hartwig.hmftools.patientreporter.ImmutableSampleReport) SampleReport(com.hartwig.hmftools.patientreporter.SampleReport) GeneDisruptionData(com.hartwig.hmftools.patientreporter.report.data.GeneDisruptionData) ImmutableGeneDisruptionData(com.hartwig.hmftools.patientreporter.report.data.ImmutableGeneDisruptionData) VariantReport(com.hartwig.hmftools.patientreporter.variants.VariantReport) ImmutableVariantReport(com.hartwig.hmftools.patientreporter.variants.ImmutableVariantReport) Alteration(com.hartwig.hmftools.patientreporter.report.data.Alteration) JasperReportBuilder(net.sf.dynamicreports.jasper.builder.JasperReportBuilder) HmfReporterData(com.hartwig.hmftools.patientreporter.HmfReporterData) PatientReporterTestUtil.testHmfReporterData(com.hartwig.hmftools.patientreporter.PatientReporterTestUtil.testHmfReporterData) GeneFusionData(com.hartwig.hmftools.patientreporter.report.data.GeneFusionData) ImmutableGeneFusionData(com.hartwig.hmftools.patientreporter.report.data.ImmutableGeneFusionData) GeneCopyNumber(com.hartwig.hmftools.common.gene.GeneCopyNumber) ImmutableGeneCopyNumber(com.hartwig.hmftools.common.gene.ImmutableGeneCopyNumber) FileOutputStream(java.io.FileOutputStream) ImmutableFittedPurity(com.hartwig.hmftools.common.purple.purity.ImmutableFittedPurity) FittedPurity(com.hartwig.hmftools.common.purple.purity.FittedPurity) Test(org.junit.Test)

Aggregations

GeneCopyNumber (com.hartwig.hmftools.common.gene.GeneCopyNumber)1 ImmutableGeneCopyNumber (com.hartwig.hmftools.common.gene.ImmutableGeneCopyNumber)1 PurityAdjuster (com.hartwig.hmftools.common.purple.PurityAdjuster)1 FittedPurity (com.hartwig.hmftools.common.purple.purity.FittedPurity)1 ImmutableFittedPurity (com.hartwig.hmftools.common.purple.purity.ImmutableFittedPurity)1 BaseReporterData (com.hartwig.hmftools.patientreporter.BaseReporterData)1 HmfReporterData (com.hartwig.hmftools.patientreporter.HmfReporterData)1 ImmutableNotSequencedPatientReport (com.hartwig.hmftools.patientreporter.ImmutableNotSequencedPatientReport)1 ImmutableSampleReport (com.hartwig.hmftools.patientreporter.ImmutableSampleReport)1 ImmutableSequencedPatientReport (com.hartwig.hmftools.patientreporter.ImmutableSequencedPatientReport)1 NotSequencedPatientReport (com.hartwig.hmftools.patientreporter.NotSequencedPatientReport)1 PatientReporterTestUtil.testBaseReporterData (com.hartwig.hmftools.patientreporter.PatientReporterTestUtil.testBaseReporterData)1 PatientReporterTestUtil.testHmfReporterData (com.hartwig.hmftools.patientreporter.PatientReporterTestUtil.testHmfReporterData)1 SampleReport (com.hartwig.hmftools.patientreporter.SampleReport)1 SequencedPatientReport (com.hartwig.hmftools.patientreporter.SequencedPatientReport)1 Alteration (com.hartwig.hmftools.patientreporter.report.data.Alteration)1 GeneDisruptionData (com.hartwig.hmftools.patientreporter.report.data.GeneDisruptionData)1 GeneFusionData (com.hartwig.hmftools.patientreporter.report.data.GeneFusionData)1 ImmutableGeneDisruptionData (com.hartwig.hmftools.patientreporter.report.data.ImmutableGeneDisruptionData)1 ImmutableGeneFusionData (com.hartwig.hmftools.patientreporter.report.data.ImmutableGeneFusionData)1