Search in sources :

Example 6 with SomaticVariant

use of com.hartwig.hmftools.common.variant.SomaticVariant in project hmftools by hartwigmedical.

the class GeneCopyNumberFactory method geneCopyNumbers.

@NotNull
public static List<GeneCopyNumber> geneCopyNumbers(@NotNull final List<HmfGenomeRegion> genes, @NotNull final List<PurpleCopyNumber> somaticCopyNumbers, @NotNull final List<PurpleCopyNumber> germlineDeletions, @NotNull final List<PurityAdjustedSomaticVariant> enrichedSomatics) {
    final ListMultimap<String, PurityAdjustedSomaticVariant> variantMap = Multimaps.index(enrichedSomatics, SomaticVariant::gene);
    final List<GeneCopyNumber> result = Lists.newArrayList();
    for (HmfGenomeRegion gene : genes) {
        final List<PurityAdjustedSomaticVariant> variants = variantMap.containsKey(gene.gene()) ? variantMap.get(gene.gene()) : Collections.EMPTY_LIST;
        final GeneCopyNumberBuilder builder = new GeneCopyNumberBuilder(gene);
        RegionZipper.zip(somaticCopyNumbers, gene.exome(), builder);
        RegionZipper.zip(germlineDeletions, gene.exome(), builder);
        variants.forEach(builder::somatic);
        GeneCopyNumber geneCopyNumber = builder.build();
        if (geneCopyNumber.totalRegions() > 0) {
            result.add(geneCopyNumber);
        }
    }
    return result;
}
Also used : PurityAdjustedSomaticVariant(com.hartwig.hmftools.common.variant.PurityAdjustedSomaticVariant) SomaticVariant(com.hartwig.hmftools.common.variant.SomaticVariant) HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) PurityAdjustedSomaticVariant(com.hartwig.hmftools.common.variant.PurityAdjustedSomaticVariant) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SomaticVariant (com.hartwig.hmftools.common.variant.SomaticVariant)6 HmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion)4 VariantAnnotation (com.hartwig.hmftools.common.variant.snpeff.VariantAnnotation)3 NotNull (org.jetbrains.annotations.NotNull)3 PurpleCopyNumber (com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber)2 PurityContext (com.hartwig.hmftools.common.purple.purity.PurityContext)2 GenomeRegion (com.hartwig.hmftools.common.region.GenomeRegion)2 PurityAdjustedSomaticVariant (com.hartwig.hmftools.common.variant.PurityAdjustedSomaticVariant)2 Test (org.junit.Test)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 PurityAdjuster (com.hartwig.hmftools.common.purple.PurityAdjuster)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 FittedRegion (com.hartwig.hmftools.common.purple.region.FittedRegion)1