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"));
}
}
Aggregations