Search in sources :

Example 1 with DRDataSource

use of net.sf.dynamicreports.report.datasource.DRDataSource in project hmftools by hartwigmedical.

the class GenePanelDataSource method fromHmfReporterData.

@NotNull
public static JRDataSource fromHmfReporterData(@NotNull final HmfReporterData reporterData) {
    final DRDataSource genePanelDataSource = new DRDataSource(GENE_FIELD.getName(), TRANSCRIPT_FIELD.getName(), TYPE_FIELD.getName());
    final List<HmfGenomeRegion> regions = Lists.newArrayList(reporterData.panelGeneModel().regions());
    regions.sort(Comparator.comparing(HmfGenomeRegion::gene));
    for (final HmfGenomeRegion region : regions) {
        final String role = reporterData.cosmicGeneModel().getRoleForGene(region.gene());
        genePanelDataSource.add(region.gene(), region.transcript(), role);
    }
    return genePanelDataSource;
}
Also used : DRDataSource(net.sf.dynamicreports.report.datasource.DRDataSource) HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with DRDataSource

use of net.sf.dynamicreports.report.datasource.DRDataSource in project hmftools by hartwigmedical.

the class GeneDisruptionDataSource method fromGeneDisruptions.

@NotNull
public static JRDataSource fromGeneDisruptions(@NotNull List<GeneDisruptionData> disruptions) {
    final DRDataSource dataSource = new DRDataSource(CHROMOSOME_FIELD.getName(), CHROMOSOME_BAND_FIELD.getName(), GENE_FIELD.getName(), GENE_CONTEXT_FIELD.getName(), TYPE_FIELD.getName(), COPIES_FIELD.getName());
    disruptions.forEach(disruption -> dataSource.add(disruption.chromosome(), disruption.chromosomeBand(), disruption.gene(), disruption.geneContext(), disruption.type(), disruption.copies()));
    return dataSource;
}
Also used : DRDataSource(net.sf.dynamicreports.report.datasource.DRDataSource) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with DRDataSource

use of net.sf.dynamicreports.report.datasource.DRDataSource in project hmftools by hartwigmedical.

the class GeneFusionDataSource method fromGeneFusions.

@NotNull
public static JRDataSource fromGeneFusions(@NotNull List<GeneFusionData> fusions) {
    final DRDataSource dataSource = new DRDataSource(FUSION_FIELD.getName(), START_TRANSCRIPT_FIELD.getName(), END_TRANSCRIPT_FIELD.getName(), START_CONTEXT_FIELD.getName(), END_CONTEXT_FIELD.getName(), COPIES_FIELD.getName(), COSMIC_URL_TEXT.getName(), COSMIC_URL.getName());
    fusions.forEach(fusion -> dataSource.add(name(fusion), fusion.geneStartTranscript(), fusion.geneEndTranscript(), fusion.geneContextStart(), fusion.geneContextEnd(), fusion.copies(), fusion.cosmicURL().isEmpty() ? Strings.EMPTY : name(fusion), fusion.cosmicURL()));
    return dataSource;
}
Also used : DRDataSource(net.sf.dynamicreports.report.datasource.DRDataSource) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with DRDataSource

use of net.sf.dynamicreports.report.datasource.DRDataSource in project hmftools by hartwigmedical.

the class PDFWriter method generateNotSequenceableReport.

@VisibleForTesting
@NotNull
static JasperReportBuilder generateNotSequenceableReport(@NotNull final NotSequencedPatientReport report) {
    // MIVO: hack to get page footers working; the footer band and noData bands are exclusive, see additional comment below for details
    final DRDataSource singleItemDataSource = new DRDataSource("item");
    singleItemDataSource.add(new Object());
    return report().pageFooter(cmp.pageXslashY()).lastPageFooter(cmp.verticalList(signatureFooter(report.signaturePath()), cmp.pageXslashY(), cmp.text("End of report.").setStyle(stl.style().setHorizontalTextAlignment(HorizontalTextAlignment.CENTER)))).addDetail(NonSequenceablePage.of(report).reportComponent()).setDataSource(singleItemDataSource);
}
Also used : DRDataSource(net.sf.dynamicreports.report.datasource.DRDataSource) VisibleForTesting(com.google.common.annotations.VisibleForTesting) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with DRDataSource

use of net.sf.dynamicreports.report.datasource.DRDataSource in project hmftools by hartwigmedical.

the class PDFWriter method generatePatientReport.

@VisibleForTesting
@NotNull
static JasperReportBuilder generatePatientReport(@NotNull final SequencedPatientReport report, @NotNull final HmfReporterData reporterData) {
    final ComponentBuilder<?, ?> totalReport = cmp.multiPageList().add(ImmutableFindingsPage.of(report, reporterData).reportComponent()).newPage().add(ImmutableCircosPage.of(report.circosPath()).reportComponent()).newPage().add(ImmutableGenePanelPage.of(reporterData).reportComponent()).newPage().add(ImmutableExplanationPage.builder().build().reportComponent()).newPage().add(SampleDetailsPage.of(report).reportComponent());
    // MIVO: hack to get page footers working; the footer band and noData bands are exclusive:
    // - footerBand, detailBand, etc are shown when data source is not empty
    // - noData band is shown when data source is empty; intended to be used when there is no data to show in the report
    // (e.g. would be appropriate to be used for notSequenceableReport)
    // 
    // more info: http://www.dynamicreports.org/examples/bandreport
    // 
    // todo: fix when implementing new report layout
    final DRDataSource singleItemDataSource = new DRDataSource("item");
    singleItemDataSource.add(new Object());
    return report().pageFooter(cmp.pageXslashY()).lastPageFooter(cmp.verticalList(signatureFooter(report.signaturePath()), cmp.pageXslashY(), cmp.text("End of report.").setStyle(stl.style().setHorizontalTextAlignment(HorizontalTextAlignment.CENTER)))).addDetail(totalReport).setDataSource(singleItemDataSource);
}
Also used : DRDataSource(net.sf.dynamicreports.report.datasource.DRDataSource) VisibleForTesting(com.google.common.annotations.VisibleForTesting) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DRDataSource (net.sf.dynamicreports.report.datasource.DRDataSource)7 NotNull (org.jetbrains.annotations.NotNull)7 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion)1 VariantReport (com.hartwig.hmftools.patientreporter.variants.VariantReport)1 GradientPaint (java.awt.GradientPaint)1