Skip to content

Commit

Permalink
refactor!: adjusting max_af to max_carriers for inhouse (#512)
Browse files Browse the repository at this point in the history
holtgrewe authored Oct 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 06ebb8a commit c212b44
Showing 3 changed files with 61 additions and 18 deletions.
28 changes: 21 additions & 7 deletions protos/varfish/v1/seqvars/query.proto
Original file line number Diff line number Diff line change
@@ -88,23 +88,23 @@ message QuerySettingsQuality {
repeated SampleQualitySettings sample_qualities = 1;
}

// gnomAD and In-house nuclear filter options.
// gnomAD filter options.
message NuclearFrequencySettings {
// Whether to enable filtration by 1000 Genomes.
// Whether to enable filtration.
bool enabled = 1;
// Maximal number of in-house heterozygous carriers
// Maximal number of heterozygous carriers
optional int32 max_het = 2;
// Maximal number of in-house homozygous carriers
// Maximal number of homozygous carriers
optional int32 max_hom = 3;
// Maximal number of in-house hemizygous carriers
// Maximal number of hemizygous carriers
optional int32 max_hemi = 4;
// Maximal allele frequency.
optional float max_af = 5;
}

// Mitochondrial filter options.
message MitochondrialFrequencySettings {
// Whether to enable filtration by 1000 Genomes.
// Whether to enable filtration.
bool enabled = 1;
// Maximal number of heteroplasmic carriers.
optional int32 max_het = 2;
@@ -114,6 +114,20 @@ message MitochondrialFrequencySettings {
optional float max_af = 4;
}

// In-house filter options.
message InhouseFrequencySettings {
// Whether to enable filtration.
bool enabled = 1;
// Maximal number of heterozygous carriers
optional int32 max_het = 2;
// Maximal number of homozygous carriers
optional int32 max_hom = 3;
// Maximal number of hemizygous carriers
optional int32 max_hemi = 4;
// Maximal number of total carriers.
optional int32 max_carriers = 5;
}

// Population frequency filter options.
message QuerySettingsFrequency {
// gnomAD-exomes filter
@@ -125,7 +139,7 @@ message QuerySettingsFrequency {
// HelixMtDb filter
MitochondrialFrequencySettings helixmtdb = 4;
// In-house filter
NuclearFrequencySettings inhouse = 5;
InhouseFrequencySettings inhouse = 5;
}

// The variant types.
49 changes: 39 additions & 10 deletions src/seqvars/query/schema/query.rs
Original file line number Diff line number Diff line change
@@ -547,6 +547,35 @@ impl From<pb_query::MitochondrialFrequencySettings> for MitochondrialFrequencySe
}
}

/// gnomAD and In-house nuclear filter options.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct InhouseFrequencySettings {
/// Whether to enable filtration by 1000 Genomes.
pub enabled: bool,
/// Maximal number of in-house heterozygous carriers.
pub max_het: Option<i32>,
/// Maximal number of in-house homozygous carriers.
pub max_hom: Option<i32>,
/// Maximal number of in-house hemizygous carriers.
pub max_hemi: Option<i32>,
/// Maximal number of carriers.
pub max_carriers: Option<i32>,
}

impl Eq for InhouseFrequencySettings {}

impl From<pb_query::InhouseFrequencySettings> for InhouseFrequencySettings {
fn from(value: pb_query::InhouseFrequencySettings) -> Self {
Self {
enabled: value.enabled,
max_het: value.max_het,
max_hom: value.max_hom,
max_hemi: value.max_hemi,
max_carriers: value.max_carriers,
}
}
}

/// Query settings for population frequencies.
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct QuerySettingsFrequency {
@@ -559,7 +588,7 @@ pub struct QuerySettingsFrequency {
/// HelixMtDb filter.
pub helixmtdb: MitochondrialFrequencySettings,
/// In-house filter.
pub inhouse: NuclearFrequencySettings,
pub inhouse: InhouseFrequencySettings,
}

impl From<pb_query::QuerySettingsFrequency> for QuerySettingsFrequency {
@@ -573,7 +602,7 @@ impl From<pb_query::QuerySettingsFrequency> for QuerySettingsFrequency {
value.gnomad_mtdna.unwrap_or_default(),
),
helixmtdb: MitochondrialFrequencySettings::from(value.helixmtdb.unwrap_or_default()),
inhouse: NuclearFrequencySettings::from(value.inhouse.unwrap_or_default()),
inhouse: InhouseFrequencySettings::from(value.inhouse.unwrap_or_default()),
}
}
}
@@ -1742,12 +1771,12 @@ mod tests {
max_hom: Some(20),
max_af: Some(0.1),
}),
inhouse: Some(pb_query::NuclearFrequencySettings {
inhouse: Some(pb_query::InhouseFrequencySettings {
enabled: true,
max_het: Some(10),
max_hom: Some(20),
max_hemi: Some(30),
max_af: Some(0.1),
max_carriers: Some(10),
}),
};
let query_settings_frequency = QuerySettingsFrequency {
@@ -1777,12 +1806,12 @@ mod tests {
max_hom: Some(20),
max_af: Some(0.1),
},
inhouse: NuclearFrequencySettings {
inhouse: InhouseFrequencySettings {
enabled: true,
max_het: Some(10),
max_hom: Some(20),
max_hemi: Some(30),
max_af: Some(0.1),
max_carriers: Some(10),
},
};
assert_eq!(
@@ -2169,12 +2198,12 @@ mod tests {
max_hom: Some(20),
max_af: Some(0.1),
}),
inhouse: Some(pb_query::NuclearFrequencySettings {
inhouse: Some(pb_query::InhouseFrequencySettings {
enabled: true,
max_het: Some(10),
max_hom: Some(20),
max_hemi: Some(30),
max_af: Some(0.1),
max_carriers: Some(10),
}),
}),
consequence: Some(pb_query::QuerySettingsConsequence {
@@ -2279,12 +2308,12 @@ mod tests {
max_hom: Some(20),
max_af: Some(0.1),
},
inhouse: NuclearFrequencySettings {
inhouse: InhouseFrequencySettings {
enabled: true,
max_het: Some(10),
max_hom: Some(20),
max_hemi: Some(30),
max_af: Some(0.1),
max_carriers: Some(10),
},
},
consequence: QuerySettingsConsequence {
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ frequency:
max_het: ~
max_hom: ~
max_hemi: ~
max_af: ~
max_carriers: ~
consequence:
variant_types: []
transcript_types: []

0 comments on commit c212b44

Please sign in to comment.