Search in sources :

Example 1 with VariantAnalyzer

use of com.hartwig.hmftools.patientreporter.variants.VariantAnalyzer in project hmftools by hartwigmedical.

the class PatientReporterTest method canRunOnRunDirectory.

@Test
public void canRunOnRunDirectory() throws IOException {
    final GeneModel geneModel = new GeneModel(HmfGenePanelSupplier.hmfPanelGeneMap());
    final BaseReporterData baseReporterData = testBaseReporterData();
    final HmfReporterData reporterData = testHmfReporterData();
    final VariantAnalyzer variantAnalyzer = VariantAnalyzer.of(geneModel, reporterData.microsatelliteAnalyzer());
    final StructuralVariantAnalyzer svAnalyzer = new StructuralVariantAnalyzer(new TestAnnotator(), geneModel.regions(), CosmicFusions.readFromCSV(FUSIONS_CSV));
    final PatientReporter algo = ImmutablePatientReporter.of(baseReporterData, reporterData, variantAnalyzer, svAnalyzer, mockedCivicAnalyzer());
    assertNotNull(algo.run(RUN_DIRECTORY, null));
}
Also used : StructuralVariantAnalyzer(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalyzer) VariantAnalyzer(com.hartwig.hmftools.patientreporter.variants.VariantAnalyzer) BaseReporterData(com.hartwig.hmftools.patientreporter.BaseReporterData) PatientReporterTestUtil.testBaseReporterData(com.hartwig.hmftools.patientreporter.PatientReporterTestUtil.testBaseReporterData) StructuralVariantAnalyzer(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalyzer) GeneModel(com.hartwig.hmftools.common.gene.GeneModel) HmfReporterData(com.hartwig.hmftools.patientreporter.HmfReporterData) PatientReporterTestUtil.testHmfReporterData(com.hartwig.hmftools.patientreporter.PatientReporterTestUtil.testHmfReporterData) Test(org.junit.Test)

Example 2 with VariantAnalyzer

use of com.hartwig.hmftools.patientreporter.variants.VariantAnalyzer in project hmftools by hartwigmedical.

the class PatientReporter method analyseGenomeData.

@NotNull
private GenomeAnalysis analyseGenomeData(@NotNull final String sample, @NotNull final String runDirectory) throws IOException {
    LOGGER.info(" Loading somatic snv and indels...");
    final List<SomaticVariant> variants = PatientReporterHelper.loadPassedSomaticVariants(sample, runDirectory);
    LOGGER.info("  " + variants.size() + " somatic passed snps, mnps and indels loaded for sample " + sample);
    LOGGER.info(" Analyzing somatic snp/mnp and indels....");
    final VariantAnalysis variantAnalysis = variantAnalyzer().run(variants);
    LOGGER.info(" Loading purity numbers...");
    final PurityContext context = PatientReporterHelper.loadPurity(runDirectory, sample);
    if (context.status().equals(FittedPurityStatus.NO_TUMOR)) {
        LOGGER.warn("PURPLE DID NOT DETECT A TUMOR. Proceed with utmost caution!");
    }
    final FittedPurity purity = context.bestFit();
    final FittedPurityScore purityScore = context.score();
    final List<PurpleCopyNumber> purpleCopyNumbers = PatientReporterHelper.loadPurpleCopyNumbers(runDirectory, sample);
    final List<GeneCopyNumber> panelGeneCopyNumbers = PatientReporterHelper.loadPurpleGeneCopyNumbers(runDirectory, sample).stream().filter(x -> reporterData().panelGeneModel().panel().contains(x.gene())).collect(Collectors.toList());
    LOGGER.info("  " + purpleCopyNumbers.size() + " purple copy number regions loaded for sample " + sample);
    LOGGER.info(" Analyzing purple somatic copy numbers...");
    final PurpleAnalysis purpleAnalysis = ImmutablePurpleAnalysis.builder().gender(context.gender()).status(context.status()).fittedPurity(purity).fittedScorePurity(purityScore).copyNumbers(purpleCopyNumbers).panelGeneCopyNumbers(panelGeneCopyNumbers).build();
    final Path structuralVariantVCF = PatientReporterHelper.findStructuralVariantVCF(runDirectory);
    LOGGER.info(" Loading structural variants...");
    final List<StructuralVariant> structuralVariants = StructuralVariantFileLoader.fromFile(structuralVariantVCF.toString(), true);
    LOGGER.info(" Enriching structural variants with purple data.");
    final List<EnrichedStructuralVariant> enrichedStructuralVariants = purpleAnalysis.enrichStructuralVariants(structuralVariants);
    LOGGER.info(" Analysing structural variants...");
    final StructuralVariantAnalysis structuralVariantAnalysis = structuralVariantAnalyzer().run(enrichedStructuralVariants, false);
    return ImmutableGenomeAnalysis.of(sample, variantAnalysis, purpleAnalysis, structuralVariantAnalysis);
}
Also used : ProductionRunContextFactory(com.hartwig.hmftools.common.context.ProductionRunContextFactory) StructuralVariantAnalyzer(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalyzer) ImmutableSampleReport(com.hartwig.hmftools.patientreporter.ImmutableSampleReport) ImmutablePurpleAnalysis(com.hartwig.hmftools.patientreporter.copynumber.ImmutablePurpleAnalysis) HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) SampleReport(com.hartwig.hmftools.patientreporter.SampleReport) HmfReporterData(com.hartwig.hmftools.patientreporter.HmfReporterData) AlterationAnalyzer(com.hartwig.hmftools.patientreporter.civic.AlterationAnalyzer) StructuralVariant(com.hartwig.hmftools.common.variant.structural.StructuralVariant) GeneFusionData(com.hartwig.hmftools.patientreporter.report.data.GeneFusionData) VariantAnalyzer(com.hartwig.hmftools.patientreporter.variants.VariantAnalyzer) Lims(com.hartwig.hmftools.common.lims.Lims) Value(org.immutables.value.Value) Map(java.util.Map) Alteration(com.hartwig.hmftools.patientreporter.report.data.Alteration) Path(java.nio.file.Path) PurpleCopyNumber(com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber) EnrichedStructuralVariant(com.hartwig.hmftools.common.variant.structural.EnrichedStructuralVariant) GeneDisruptionData(com.hartwig.hmftools.patientreporter.report.data.GeneDisruptionData) GeneDisruption(com.hartwig.hmftools.svannotation.annotations.GeneDisruption) SomaticVariant(com.hartwig.hmftools.common.variant.SomaticVariant) VariantReport(com.hartwig.hmftools.patientreporter.variants.VariantReport) ImmutableSequencedPatientReport(com.hartwig.hmftools.patientreporter.ImmutableSequencedPatientReport) PurpleAnalysis(com.hartwig.hmftools.patientreporter.copynumber.PurpleAnalysis) SequencedPatientReport(com.hartwig.hmftools.patientreporter.SequencedPatientReport) FittedPurityScore(com.hartwig.hmftools.common.purple.purity.FittedPurityScore) IOException(java.io.IOException) VariantAnalysis(com.hartwig.hmftools.patientreporter.variants.VariantAnalysis) BaseReporterData(com.hartwig.hmftools.patientreporter.BaseReporterData) Collectors(java.util.stream.Collectors) Transcript(com.hartwig.hmftools.svannotation.annotations.Transcript) RunContext(com.hartwig.hmftools.common.context.RunContext) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) TumorLocationDoidMapping(com.hartwig.hmftools.common.ecrf.doid.TumorLocationDoidMapping) Logger(org.apache.logging.log4j.Logger) PurityContext(com.hartwig.hmftools.common.purple.purity.PurityContext) GeneFusion(com.hartwig.hmftools.svannotation.annotations.GeneFusion) Optional(java.util.Optional) FittedPurity(com.hartwig.hmftools.common.purple.purity.FittedPurity) GeneCopyNumber(com.hartwig.hmftools.common.gene.GeneCopyNumber) StructuralVariantAnalysis(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalysis) Comparator(java.util.Comparator) StructuralVariantFileLoader(com.hartwig.hmftools.common.variant.structural.StructuralVariantFileLoader) NotNull(org.jetbrains.annotations.NotNull) LogManager(org.apache.logging.log4j.LogManager) FittedPurityStatus(com.hartwig.hmftools.common.purple.purity.FittedPurityStatus) Path(java.nio.file.Path) SomaticVariant(com.hartwig.hmftools.common.variant.SomaticVariant) EnrichedStructuralVariant(com.hartwig.hmftools.common.variant.structural.EnrichedStructuralVariant) StructuralVariantAnalysis(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalysis) PurpleCopyNumber(com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber) StructuralVariant(com.hartwig.hmftools.common.variant.structural.StructuralVariant) EnrichedStructuralVariant(com.hartwig.hmftools.common.variant.structural.EnrichedStructuralVariant) GeneCopyNumber(com.hartwig.hmftools.common.gene.GeneCopyNumber) PurityContext(com.hartwig.hmftools.common.purple.purity.PurityContext) ImmutablePurpleAnalysis(com.hartwig.hmftools.patientreporter.copynumber.ImmutablePurpleAnalysis) PurpleAnalysis(com.hartwig.hmftools.patientreporter.copynumber.PurpleAnalysis) VariantAnalysis(com.hartwig.hmftools.patientreporter.variants.VariantAnalysis) StructuralVariantAnalysis(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalysis) FittedPurity(com.hartwig.hmftools.common.purple.purity.FittedPurity) FittedPurityScore(com.hartwig.hmftools.common.purple.purity.FittedPurityScore) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with VariantAnalyzer

use of com.hartwig.hmftools.patientreporter.variants.VariantAnalyzer in project hmftools by hartwigmedical.

the class PatientReporterApplication method buildReporter.

@NotNull
private static PatientReporter buildReporter(@NotNull final CommandLine cmd, @NotNull final HmfReporterData reporterData) throws IOException, SQLException {
    final VariantAnalyzer variantAnalyzer = VariantAnalyzer.of(reporterData.panelGeneModel(), reporterData.microsatelliteAnalyzer());
    final VariantAnnotator annotator;
    if (cmd.hasOption(ENSEMBL_DB)) {
        final String url = "jdbc:" + cmd.getOptionValue(ENSEMBL_DB);
        LOGGER.info("connecting to: {}", url);
        annotator = MySQLAnnotator.make(url);
    } else {
        annotator = NullAnnotator.make();
    }
    final StructuralVariantAnalyzer svAnalyzer = new StructuralVariantAnalyzer(annotator, reporterData.panelGeneModel().regions(), reporterData.cosmicFusionModel());
    return ImmutablePatientReporter.of(buildBaseReporterData(cmd), reporterData, variantAnalyzer, svAnalyzer, new CivicAnalyzer());
}
Also used : CivicAnalyzer(com.hartwig.hmftools.patientreporter.civic.CivicAnalyzer) StructuralVariantAnalyzer(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalyzer) VariantAnalyzer(com.hartwig.hmftools.patientreporter.variants.VariantAnalyzer) StructuralVariantAnalyzer(com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalyzer) VariantAnnotator(com.hartwig.hmftools.svannotation.VariantAnnotator) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

VariantAnalyzer (com.hartwig.hmftools.patientreporter.variants.VariantAnalyzer)3 StructuralVariantAnalyzer (com.hartwig.hmftools.svannotation.analysis.StructuralVariantAnalyzer)3 BaseReporterData (com.hartwig.hmftools.patientreporter.BaseReporterData)2 HmfReporterData (com.hartwig.hmftools.patientreporter.HmfReporterData)2 NotNull (org.jetbrains.annotations.NotNull)2 ProductionRunContextFactory (com.hartwig.hmftools.common.context.ProductionRunContextFactory)1 RunContext (com.hartwig.hmftools.common.context.RunContext)1 TumorLocationDoidMapping (com.hartwig.hmftools.common.ecrf.doid.TumorLocationDoidMapping)1 GeneCopyNumber (com.hartwig.hmftools.common.gene.GeneCopyNumber)1 GeneModel (com.hartwig.hmftools.common.gene.GeneModel)1 Lims (com.hartwig.hmftools.common.lims.Lims)1 PurpleCopyNumber (com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber)1 FittedPurity (com.hartwig.hmftools.common.purple.purity.FittedPurity)1 FittedPurityScore (com.hartwig.hmftools.common.purple.purity.FittedPurityScore)1 FittedPurityStatus (com.hartwig.hmftools.common.purple.purity.FittedPurityStatus)1 PurityContext (com.hartwig.hmftools.common.purple.purity.PurityContext)1 HmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion)1 SomaticVariant (com.hartwig.hmftools.common.variant.SomaticVariant)1 EnrichedStructuralVariant (com.hartwig.hmftools.common.variant.structural.EnrichedStructuralVariant)1 StructuralVariant (com.hartwig.hmftools.common.variant.structural.StructuralVariant)1