Search in sources :

Example 6 with HmfGenomeRegion

use of com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion 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 7 with HmfGenomeRegion

use of com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion in project hmftools by hartwigmedical.

the class ConsequenceDeterminer method toVariantReport.

@NotNull
private List<VariantReport> toVariantReport(@NotNull final List<SomaticVariant> variants) {
    final List<VariantReport> reports = Lists.newArrayList();
    for (final SomaticVariant variant : variants) {
        final ImmutableVariantReport.Builder builder = ImmutableVariantReport.builder();
        final VariantAnnotation variantAnnotation = findPrimaryRelevantAnnotation(variant, relevantTranscriptMap.keySet());
        // KODU: Variants with no relevant annotations should be filtered out by now.
        assert variantAnnotation != null;
        final HmfGenomeRegion hmfGenomeRegion = relevantTranscriptMap.get(variantAnnotation.featureID());
        assert hmfGenomeRegion != null;
        if (!variantAnnotation.gene().equals(hmfGenomeRegion.gene())) {
            LOGGER.warn("Annotated gene does not match gene expected from slicing annotation for " + variant);
        }
        if (!variantAnnotation.allele().equals(variant.alt())) {
            LOGGER.warn("Annotated allele does not match alt from variant for " + variant);
        }
        builder.variant(variant);
        builder.gene(variantAnnotation.gene());
        builder.transcript(hmfGenomeRegion.transcript());
        builder.hgvsCoding(variantAnnotation.hgvsCoding());
        builder.hgvsProtein(variantAnnotation.hgvsProtein());
        builder.consequence(variantAnnotation.consequenceString());
        final String cosmicID = variant.cosmicID();
        if (cosmicID != null) {
            builder.cosmicID(cosmicID);
        }
        builder.totalReadCount(variant.totalReadCount());
        builder.alleleReadCount(variant.alleleReadCount());
        reports.add(builder.build());
    }
    return reports;
}
Also used : SomaticVariant(com.hartwig.hmftools.common.variant.SomaticVariant) HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) VariantAnnotation(com.hartwig.hmftools.common.variant.snpeff.VariantAnnotation) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with HmfGenomeRegion

use of com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion in project hmftools by hartwigmedical.

the class CanonicalTranscriptFactoryTest method testWASH7P.

@Test
public void testWASH7P() {
    final HmfGenomeRegion region = select("WASH7P.tsv");
    final CanonicalTranscript transcript = CanonicalTranscriptFactory.create(region);
    assertTranscript(transcript, 12, 0, 1783, 0);
}
Also used : HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) Test(org.junit.Test)

Example 9 with HmfGenomeRegion

use of com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion in project hmftools by hartwigmedical.

the class CanonicalTranscriptFactoryTest method testKRAS.

@Test
public void testKRAS() {
    final HmfGenomeRegion kras = select("KRAS.tsv");
    final CanonicalTranscript transcript = CanonicalTranscriptFactory.create(kras);
    assertTranscript(transcript, 6, 4, 1119, 189);
    assertEquals(25368375, transcript.codingStart());
    assertEquals(25398318, transcript.codingEnd());
}
Also used : HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) Test(org.junit.Test)

Example 10 with HmfGenomeRegion

use of com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion in project hmftools by hartwigmedical.

the class BachelorEligibility method processVCF.

@NotNull
Collection<EligibilityReport> processVCF(final String patient, final String sample, final EligibilityReport.ReportType type, final VCFFileReader reader) {
    final List<EligibilityReport> results = Lists.newArrayList();
    for (final HmfGenomeRegion region : variantLocationsToQuery) {
        LOGGER.debug("chromosome({} start={} end={})", region.chromosome(), (int) region.geneStart(), (int) region.geneEnd());
        final CloseableIterator<VariantContext> query = reader.query(region.chromosome(), (int) region.geneStart(), (int) region.geneEnd());
        while (query.hasNext()) {
            final VariantContext variant = query.next();
            LOGGER.debug("variant({}) patient({}) sample({})", variant, patient, sample);
            results.addAll(processVariant(variant, patient, sample, type));
        }
        query.close();
    }
    return results;
}
Also used : VariantContext(htsjdk.variant.variantcontext.VariantContext) HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

HmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion)17 NotNull (org.jetbrains.annotations.NotNull)11 Lists (com.google.common.collect.Lists)5 Sets (com.google.common.collect.Sets)5 GeneCopyNumber (com.hartwig.hmftools.common.gene.GeneCopyNumber)5 Collection (java.util.Collection)5 List (java.util.List)5 Set (java.util.Set)5 Predicate (java.util.function.Predicate)5 Collectors (java.util.stream.Collectors)5 Test (org.junit.Test)5 VariantAnnotation (com.hartwig.hmftools.common.variant.snpeff.VariantAnnotation)4 LogManager (org.apache.logging.log4j.LogManager)4 Logger (org.apache.logging.log4j.Logger)4 CivicApiWrapper (com.hartwig.hmftools.apiclients.civic.api.CivicApiWrapper)3 CivicVariantWithEvidence (com.hartwig.hmftools.apiclients.civic.data.CivicVariantWithEvidence)3 DiseaseOntologyApiWrapper (com.hartwig.hmftools.apiclients.diseaseontology.api.DiseaseOntologyApiWrapper)3 GeneModel (com.hartwig.hmftools.common.gene.GeneModel)3 SomaticVariant (com.hartwig.hmftools.common.variant.SomaticVariant)3 Alteration (com.hartwig.hmftools.patientreporter.report.data.Alteration)3