diff --git a/protos/varfish/v1/seqvars/query.proto b/protos/varfish/v1/seqvars/query.proto index 3bf45e8c..81738b73 100644 --- a/protos/varfish/v1/seqvars/query.proto +++ b/protos/varfish/v1/seqvars/query.proto @@ -88,15 +88,15 @@ 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; @@ -104,7 +104,7 @@ message NuclearFrequencySettings { // 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. diff --git a/src/seqvars/query/schema/query.rs b/src/seqvars/query/schema/query.rs index 0f6da7c0..3b052fc3 100644 --- a/src/seqvars/query/schema/query.rs +++ b/src/seqvars/query/schema/query.rs @@ -547,6 +547,35 @@ impl From 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, + /// Maximal number of in-house homozygous carriers. + pub max_hom: Option, + /// Maximal number of in-house hemizygous carriers. + pub max_hemi: Option, + /// Maximal number of carriers. + pub max_carriers: Option, +} + +impl Eq for InhouseFrequencySettings {} + +impl From 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 for QuerySettingsFrequency { @@ -573,7 +602,7 @@ impl From 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 { diff --git a/src/seqvars/query/schema/snapshots/varfish_server_worker__seqvars__query__schema__query__tests__smoke_test_load@empty.json.snap b/src/seqvars/query/schema/snapshots/varfish_server_worker__seqvars__query__schema__query__tests__smoke_test_load@empty.json.snap index 72cb05b7..af5cd446 100644 --- a/src/seqvars/query/schema/snapshots/varfish_server_worker__seqvars__query__schema__query__tests__smoke_test_load@empty.json.snap +++ b/src/seqvars/query/schema/snapshots/varfish_server_worker__seqvars__query__schema__query__tests__smoke_test_load@empty.json.snap @@ -35,7 +35,7 @@ frequency: max_het: ~ max_hom: ~ max_hemi: ~ - max_af: ~ + max_carriers: ~ consequence: variant_types: [] transcript_types: []