Search in sources :

Example 6 with Alteration

use of com.hartwig.hmftools.patientreporter.report.data.Alteration in project hmftools by hartwigmedical.

the class CivicAnalyzer method civicFusionAlterations.

@NotNull
private static List<Alteration> civicFusionAlterations(@NotNull final List<GeneFusionData> fusions, @NotNull final Set<String> relevantDoids) {
    LOGGER.info("  Fetching civic fusion alterations...");
    final List<Alteration> alterations = Lists.newArrayList();
    for (final GeneFusionData fusion : fusions) {
        alterations.addAll(queryCivicAlteration(fusion.geneStartEntrezIds(), variantList -> Alteration.from(fusion, variantList, relevantDoids), "  Failed to get civic variants for fusion: " + fusion.geneStart() + " - " + fusion.geneEnd()));
        alterations.addAll(queryCivicAlteration(fusion.geneEndEntrezIds(), variantList -> Alteration.from(fusion, variantList, relevantDoids), "  Failed to get civic variants for fusion: " + fusion.geneStart() + " - " + fusion.geneEnd()));
    }
    return alterations;
}
Also used : GeneDisruptionData(com.hartwig.hmftools.patientreporter.report.data.GeneDisruptionData) VariantReport(com.hartwig.hmftools.patientreporter.variants.VariantReport) GeneModel(com.hartwig.hmftools.common.gene.GeneModel) Predicate(java.util.function.Predicate) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) HmfGenomeRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) GeneFusionData(com.hartwig.hmftools.patientreporter.report.data.GeneFusionData) CivicApiWrapper(com.hartwig.hmftools.apiclients.civic.api.CivicApiWrapper) List(java.util.List) Lists(com.google.common.collect.Lists) Logger(org.apache.logging.log4j.Logger) CivicVariantWithEvidence(com.hartwig.hmftools.apiclients.civic.data.CivicVariantWithEvidence) Alteration(com.hartwig.hmftools.patientreporter.report.data.Alteration) Observable(io.reactivex.Observable) GeneCopyNumber(com.hartwig.hmftools.common.gene.GeneCopyNumber) NotNull(org.jetbrains.annotations.NotNull) LogManager(org.apache.logging.log4j.LogManager) DiseaseOntologyApiWrapper(com.hartwig.hmftools.apiclients.diseaseontology.api.DiseaseOntologyApiWrapper) Alteration(com.hartwig.hmftools.patientreporter.report.data.Alteration) GeneFusionData(com.hartwig.hmftools.patientreporter.report.data.GeneFusionData) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with Alteration

use of com.hartwig.hmftools.patientreporter.report.data.Alteration in project hmftools by hartwigmedical.

the class CivicAnalyzer method queryCivicAlteration.

@NotNull
private static List<Alteration> queryCivicAlteration(@NotNull final List<Integer> entrezIds, io.reactivex.functions.Function<List<CivicVariantWithEvidence>, Alteration> alterationBuilder, @NotNull final String error) {
    final CivicApiWrapper civicApi = new CivicApiWrapper();
    final List<Alteration> result = Lists.newArrayList();
    try {
        result.addAll(Observable.fromIterable(entrezIds).flatMap(civicApi::getVariantsForGene).toList().map(alterationBuilder).filter(alteration -> !alteration.getMatches().isEmpty()).toObservable().toList().blockingGet());
    } catch (final Throwable throwable) {
        LOGGER.error("{}. Error message: {}", error, throwable.getMessage());
    }
    civicApi.releaseResources();
    return result;
}
Also used : CivicApiWrapper(com.hartwig.hmftools.apiclients.civic.api.CivicApiWrapper) Alteration(com.hartwig.hmftools.patientreporter.report.data.Alteration) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Alteration (com.hartwig.hmftools.patientreporter.report.data.Alteration)7 GeneDisruptionData (com.hartwig.hmftools.patientreporter.report.data.GeneDisruptionData)6 GeneFusionData (com.hartwig.hmftools.patientreporter.report.data.GeneFusionData)6 VariantReport (com.hartwig.hmftools.patientreporter.variants.VariantReport)6 NotNull (org.jetbrains.annotations.NotNull)6 CivicApiWrapper (com.hartwig.hmftools.apiclients.civic.api.CivicApiWrapper)5 GeneCopyNumber (com.hartwig.hmftools.common.gene.GeneCopyNumber)5 Lists (com.google.common.collect.Lists)4 Sets (com.google.common.collect.Sets)4 CivicVariantWithEvidence (com.hartwig.hmftools.apiclients.civic.data.CivicVariantWithEvidence)4 DiseaseOntologyApiWrapper (com.hartwig.hmftools.apiclients.diseaseontology.api.DiseaseOntologyApiWrapper)4 GeneModel (com.hartwig.hmftools.common.gene.GeneModel)4 HmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion)4 Observable (io.reactivex.Observable)4 Collection (java.util.Collection)4 List (java.util.List)4 Set (java.util.Set)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 Predicate (java.util.function.Predicate)4 Collectors (java.util.stream.Collectors)4