Skip to content

Commit

Permalink
analysis: implement the variant sample stats tranformer, #20
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarraga committed Sep 23, 2019
1 parent 45f59b2 commit b831876
Show file tree
Hide file tree
Showing 5 changed files with 1,013 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.catalyst.expressions.ArrayContains;
import org.opencb.biodata.models.clinical.interpretation.ClinicalProperty;
import org.opencb.biodata.models.clinical.pedigree.Pedigree;
import org.opencb.biodata.models.commons.Disorder;
import org.opencb.biodata.tools.pedigree.ModeOfInheritance;
Expand Down Expand Up @@ -123,6 +124,9 @@ public Dataset<Row> transform(Dataset<?> dataset) {
String phenotype = getPhenotype();
String studyId = getStudyId();
Boolean incompletePenetrance = getOrDefault(incompletePenetranceParam);
ClinicalProperty.Penetrance penetrance = getOrDefault(incompletePenetranceParam)
? ClinicalProperty.Penetrance.INCOMPLETE
: ClinicalProperty.Penetrance.COMPLETE;
Boolean missingAsReference = getOrDefault(missingAsReferenceParam);

Map<String, List<String>> samplesMap = vmm.samples(df);
Expand All @@ -142,22 +146,22 @@ public Dataset<Row> transform(Dataset<?> dataset) {
switch (moiLowerCase) {
case MONOALLELIC:
case "dominant":
gtsMap = ModeOfInheritance.dominant(pedigree, disorder, incompletePenetrance);
gtsMap = ModeOfInheritance.dominant(pedigree, disorder, penetrance);
break;
case BIALLELIC:
case "recessive":
gtsMap = ModeOfInheritance.recessive(pedigree, disorder, incompletePenetrance);
gtsMap = ModeOfInheritance.recessive(pedigree, disorder, penetrance);
break;
case X_LINKED_MONOALLELIC_INTERNAL: // Internal values already in lower case
gtsMap = ModeOfInheritance.xLinked(pedigree, disorder, true);
gtsMap = ModeOfInheritance.xLinked(pedigree, disorder, true, penetrance);
df = df.filter(df.col("chromosome").equalTo("X"));
break;
case X_LINKED_BIALLELIC_INTERNAL: // Internal values already in lower case
gtsMap = ModeOfInheritance.xLinked(pedigree, disorder, false);
gtsMap = ModeOfInheritance.xLinked(pedigree, disorder, false, penetrance);
df = df.filter(df.col("chromosome").equalTo("X"));
break;
case Y_LINKED_INTERNAL: // Internal values already in lower case
gtsMap = ModeOfInheritance.yLinked(pedigree, disorder);
gtsMap = ModeOfInheritance.yLinked(pedigree, disorder, penetrance);
df = df.filter(df.col("chromosome").equalTo("Y"));
break;
default:
Expand Down
Loading

0 comments on commit b831876

Please sign in to comment.