Skip to content

Commit

Permalink
tools: update clinical variant creators, #189
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarraga committed Sep 2, 2020
1 parent 426ec38 commit 7efc592
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.opencb.biodata.models.clinical.ClinicalProperty;
import org.opencb.biodata.models.clinical.ClinicalProperty.ModeOfInheritance;
import org.opencb.biodata.models.clinical.Disorder;
import org.opencb.biodata.models.clinical.Phenotype;
import org.opencb.biodata.models.clinical.interpretation.*;
import org.opencb.biodata.models.clinical.ClinicalProperty.ModeOfInheritance;
import org.opencb.biodata.models.clinical.interpretation.exceptions.InterpretationAnalysisException;
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.avro.ConsequenceType;
Expand Down Expand Up @@ -126,8 +126,8 @@ public List<ClinicalVariant> createSecondaryFindings(List<Variant> variants) {

// If we have clinical variant evidences, then we have to create the clinical variant
if (CollectionUtils.isNotEmpty(clinicalVariantEvidences)) {
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), 0, new ArrayList<>(),
Collections.emptyList(), ClinicalVariant.Status.NOT_REVIEWED, Collections.emptyMap());
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyList(), "", ClinicalVariant.Status.NOT_REVIEWED, Collections.emptyMap());
clinicalVariant.setEvidences(clinicalVariantEvidences);

// Add variant to the list
Expand Down Expand Up @@ -198,16 +198,15 @@ protected Map<String, Map<String, ClinicalProperty.ModeOfInheritance>> getGeneTo
return idToPanelMoiMap;
}

protected ClinicalVariantEvidence createClinicalVariantEvidence(List<SequenceOntologyTerm> consequenceTypes,
GenomicFeature genomicFeature, String panelId, ModeOfInheritance moi,
protected ClinicalVariantEvidence createClinicalVariantEvidence(GenomicFeature genomicFeature, String panelId, ModeOfInheritance moi,
Penetrance penetrance, String tier, Variant variant) {
ClinicalVariantEvidence clinicalVariantEvidence = new ClinicalVariantEvidence();

// Consequence types
if (CollectionUtils.isNotEmpty(consequenceTypes)) {
// Set consequence type
clinicalVariantEvidence.setConsequenceTypes(consequenceTypes);
}
// // Consequence types
// if (CollectionUtils.isNotEmpty(consequenceTypes)) {
// // Set consequence type
// clinicalVariantEvidence.setConsequenceTypes(consequenceTypes);
// }

// Genomic feature
if (genomicFeature != null) {
Expand Down Expand Up @@ -323,22 +322,23 @@ protected List<ClinicalVariantEvidence> createClinicalVariantEvidences(String ti
if (ct != null) {
soTerms = getSOTerms(ct, includeSoTerms);

genomicFeature = new GenomicFeature(ct.getEnsemblGeneId(), "GENE", ct.getEnsemblTranscriptId(), ct.getGeneName(), null);
genomicFeature = new GenomicFeature(ct.getEnsemblGeneId(), "GENE", ct.getEnsemblTranscriptId(), ct.getGeneName(), soTerms,
null);
}

if (CollectionUtils.isNotEmpty(panelIds)) {
for (String panelId : panelIds) {
ClinicalVariantEvidence clinicalVariantEvidence = createClinicalVariantEvidence(soTerms, genomicFeature, panelId,
modeOfInheritance, penetrance, tier, variant);
ClinicalVariantEvidence clinicalVariantEvidence = createClinicalVariantEvidence(genomicFeature, panelId, modeOfInheritance,
penetrance, tier, variant);
if (clinicalVariantEvidence != null) {
clinicalVariantEvidences.add(clinicalVariantEvidence);
}
}
} else {
// We report events without panels, e.g., actionable variants (tier 3)
if (CollectionUtils.isNotEmpty(soTerms)) {
ClinicalVariantEvidence clinicalVariantEvidence = createClinicalVariantEvidence(soTerms, genomicFeature, null,
modeOfInheritance, penetrance, tier, variant);
ClinicalVariantEvidence clinicalVariantEvidence = createClinicalVariantEvidence(genomicFeature, null, modeOfInheritance,
penetrance, tier, variant);
if (clinicalVariantEvidence != null) {
clinicalVariantEvidences.add(clinicalVariantEvidence);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@
import org.opencb.biodata.models.clinical.ClinicalProperty;
import org.opencb.biodata.models.clinical.ClinicalProperty.ModeOfInheritance;
import org.opencb.biodata.models.clinical.ClinicalProperty.Penetrance;
import org.opencb.biodata.models.clinical.Disorder;
import org.opencb.biodata.models.clinical.interpretation.ClinicalVariant;
import org.opencb.biodata.models.clinical.interpretation.ClinicalVariantEvidence;
import org.opencb.biodata.models.clinical.interpretation.DiseasePanel;
import org.opencb.biodata.models.clinical.interpretation.ClinicalVariant;
import org.opencb.biodata.models.clinical.Disorder;
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.avro.ConsequenceType;

import java.util.*;
import java.util.stream.Collectors;

import static org.opencb.biodata.models.clinical.interpretation.VariantClassification.TIER_1;
import static org.opencb.biodata.models.clinical.interpretation.VariantClassification.TIER_2;
import static org.opencb.biodata.models.clinical.interpretation.VariantClassification.UNTIERED;
import static org.opencb.biodata.models.clinical.interpretation.VariantClassification.*;

public class DefaultClinicalVariantCreator extends ClinicalVariantCreator {

Expand Down Expand Up @@ -126,8 +124,8 @@ public List<ClinicalVariant> create(List<Variant> variants) {

// Create a clinical variant only if we have evidences
if (CollectionUtils.isNotEmpty(clinicalVariantEvidences)) {
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), 0, new ArrayList<>(),
Collections.emptyList(), ClinicalVariant.Status.NOT_REVIEWED, Collections.emptyMap());
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyList(), "", ClinicalVariant.Status.NOT_REVIEWED, Collections.emptyMap());
clinicalVariant.setEvidences(clinicalVariantEvidences);

// Add variant to the list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public List<ClinicalVariant> create(List<Variant> variants) throws Interpretatio

// If we have clinical variant evidences, then we have to create the clinical variant
if (CollectionUtils.isNotEmpty(clinicalVariantEvidences)) {
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), 0, new ArrayList<>(),
Collections.emptyList(), ClinicalVariant.Status.NOT_REVIEWED, Collections.emptyMap());
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyList(), "", ClinicalVariant.Status.NOT_REVIEWED, Collections.emptyMap());
clinicalVariant.setEvidences(clinicalVariantEvidences);

// Add variant to the list
Expand Down
Loading

0 comments on commit 7efc592

Please sign in to comment.