use of com.hartwig.hmftools.common.gene.GeneCopyNumber in project hmftools by hartwigmedical.
the class PDFWriterTest method createTestCopyNumbers.
@NotNull
private static List<GeneCopyNumber> createTestCopyNumbers() {
final GeneCopyNumber copyNumber1 = createCopyNumberBuilder().chromosome("9").chromosomeBand("p21.3").gene("CDKN2A").minCopyNumber(0).build();
final GeneCopyNumber copyNumber2 = createCopyNumberBuilder().chromosome("17").chromosomeBand("q12").gene("ERBB2").minCopyNumber(9).build();
return Lists.newArrayList(copyNumber1, copyNumber2);
}
use of com.hartwig.hmftools.common.gene.GeneCopyNumber 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"));
}
}
use of com.hartwig.hmftools.common.gene.GeneCopyNumber in project hmftools by hartwigmedical.
the class CivicAnalyzer method civicCopyNumberAlterations.
@NotNull
private static List<Alteration> civicCopyNumberAlterations(@NotNull final List<GeneCopyNumber> copyNumbers, @NotNull final Collection<HmfGenomeRegion> geneRegions, @NotNull final Set<String> relevantDoids) {
LOGGER.info(" Fetching civic copy number alterations...");
final List<Alteration> alterations = Lists.newArrayList();
for (final GeneCopyNumber copyNumberReport : copyNumbers) {
for (final HmfGenomeRegion region : geneRegions) {
if (region.gene().equals(copyNumberReport.gene())) {
alterations.addAll(queryCivicAlteration(region.entrezId(), variantList -> Alteration.from(copyNumberReport, variantList, relevantDoids), " Failed to get civic variants for copy number: " + copyNumberReport.gene()));
}
}
}
return alterations;
}
use of com.hartwig.hmftools.common.gene.GeneCopyNumber in project hmftools by hartwigmedical.
the class LoadPurpleData method main.
public static void main(@NotNull final String[] args) throws ParseException, IOException, SQLException {
final Options options = createBasicOptions();
final CommandLine cmd = createCommandLine(args, options);
final DatabaseAccess dbAccess = databaseAccess(cmd);
final String tumorSample = cmd.getOptionValue(SAMPLE);
final String purplePath = cmd.getOptionValue(PURPLE_DIR);
LOGGER.info("Persisting purity data");
final PurpleQC purpleQC = PurpleQCFile.read(PurpleQCFile.generateFilename(purplePath, tumorSample));
final PurityContext purityContext = FittedPurityFile.read(purplePath, tumorSample);
final List<FittedPurity> bestFitPerPurity = FittedPurityRangeFile.read(purplePath, tumorSample);
dbAccess.writePurity(tumorSample, purityContext, purpleQC);
dbAccess.writeBestFitPerPurity(tumorSample, bestFitPerPurity);
LOGGER.info("Persisting copy numbers");
final List<PurpleCopyNumber> copyNumbers = PurpleCopyNumberFile.read(purplePath, tumorSample);
dbAccess.writeCopynumbers(tumorSample, copyNumbers);
LOGGER.info("Persisting gene copy numbers");
final List<GeneCopyNumber> geneCopyNumbers = GeneCopyNumberFile.read(GeneCopyNumberFile.generateFilename(purplePath, tumorSample));
dbAccess.writeGeneCopynumberRegions(tumorSample, geneCopyNumbers);
LOGGER.info("Complete");
}
use of com.hartwig.hmftools.common.gene.GeneCopyNumber in project hmftools by hartwigmedical.
the class BachelorEligibility method processCopyNumbers.
@NotNull
Collection<EligibilityReport> processCopyNumbers(final String patient, final List<GeneCopyNumber> copyNumbers) {
final List<EligibilityReport> results = Lists.newArrayList();
for (final GeneCopyNumber copyNumber : copyNumbers) {
// TODO: verify the germline check
final boolean isGermline = copyNumber.germlineHet2HomRegions() + copyNumber.germlineHomRegions() > 0;
final List<String> matchingPrograms = programs.stream().filter(program -> program.copyNumberProcessor().test(copyNumber)).map(BachelorProgram::name).collect(Collectors.toList());
final List<EligibilityReport> interimResults = matchingPrograms.stream().map(p -> ImmutableEligibilityReport.builder().patient(patient).source(isGermline ? GERMLINE_DELETION : SOMATIC_DELETION).program(p).id("").genes(copyNumber.gene()).chrom(copyNumber.chromosome()).pos(copyNumber.start()).ref("").alts("").effects("").build()).collect(Collectors.toList());
results.addAll(interimResults);
}
return results;
}
Aggregations