Skip to content

Commit fbde8a2

Browse files
committed
Update to enable testing that cohort diseases have specified MOI
1 parent 0f034ef commit fbde8a2

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ga4ghphetools"
3-
version = "0.5.31"
3+
version = "0.5.32"
44
edition = "2021"
55
keywords = ["GA4GH", "Phenopacket Schema", "Human Phenotype Ontology"]
66
description = "Generate GA4GH phenopackets from tabular data"

src/factory/cohort_qc.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ impl CohortDataQc {
126126
}
127127

128128

129+
pub fn check_metadata(&self, cohort: &CohortData) -> Result<(), String> {
130+
let diseases = &cohort.disease_list;
131+
if diseases.is_empty() {
132+
return Err("Disease list empty".to_string());
133+
}
134+
for disease in diseases {
135+
if disease.mode_of_inheritance_list.is_empty() {
136+
return Err(format!("No mode of inheritance provided for {} ({})", disease.disease_label, disease.disease_id));
137+
}
138+
}
139+
Ok(())
140+
}
141+
142+
129143
pub fn sanitize_header(&self, duplets: &Vec<HpoTermDuplet>) -> Result<Vec<HpoTermDuplet>, String> {
130144
let mut sanitized: Vec<HpoTermDuplet> = Vec::new();
131145
for duplet in duplets {

src/factory/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ pub fn qc_assessment(
103103
-> Result<(), String> {
104104
let cohort_qc = CohortDataQc::new(hpo);
105105
cohort_qc.qc_check(cohort_dto)?;
106+
cohort_qc.check_metadata(cohort_dto)?;
106107
cohort_qc.qc_conflicting_pairs(cohort_dto)
107108
}
108109

tests/integration_etl_dto.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::collections::HashMap;
33
use std::sync::Arc;
44

55
use ga4ghphetools::dto::cohort_dto::GeneTranscriptData;
6+
use ga4ghphetools::dto::cohort_dto::ModeOfInheritance;
67
use ga4ghphetools::dto::etl_dto::ColumnDto;
78
use ga4ghphetools::dto::etl_dto::ColumnTableDto;
89
use ga4ghphetools::dto::etl_dto::EtlCellValue;
@@ -272,10 +273,15 @@ fn columns_lacking_hpo(
272273

273274
#[fixture]
274275
fn disease_valid() -> DiseaseData {
276+
let moi = ModeOfInheritance {
277+
hpo_id: "HP:0000006".to_string(),
278+
hpo_label: "Autosomal dominant inheritance".to_string(),
279+
citation: "PMID: 39471804".to_string()
280+
};
275281
DiseaseData {
276282
disease_id: "OMIM:621016".to_string(),
277283
disease_label: "Neurodevelopmental disorder with variable familial hypercholanemia".to_string(),
278-
mode_of_inheritance_list: vec![],
284+
mode_of_inheritance_list: vec![moi],
279285
gene_transcript_list: vec![GeneTranscriptData {
280286
hgnc_id: "HGNC:30203".to_string(),
281287
gene_symbol: "WDR83OS".to_string(),

0 commit comments

Comments
 (0)