Skip to content

Commit 70484ac

Browse files
committed
tweaking so that we are picking up failed samples
1 parent 2b6204e commit 70484ac

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/utils/data_processing.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ where
191191
{
192192
let mut sample_list = Vec::new();
193193

194-
for entry in samples {
194+
// Skip the first element (header) and iterate over the rest
195+
for entry in samples.iter().skip(1) {
195196
sample_list.push(entry.sample_id().clone());
196197
}
197198

@@ -691,8 +692,11 @@ pub fn create_irma_summary(
691692

692693
// First loop: Populate `irma_summary` with initial data from `reads_count_df`
693694
for sample in sample_list {
695+
let mut found_match = false;
694696
for entry in reads_count_df {
697+
println!("{} --- {}", &sample, entry.sample_id);
695698
if *sample == entry.sample_id {
699+
found_match = true;
696700
irma_summary.push(IRMASummary {
697701
sample_id: Some(entry.sample_id.clone()),
698702
reference: Some(entry.reference.clone()),
@@ -713,6 +717,27 @@ pub fn create_irma_summary(
713717
});
714718
}
715719
}
720+
// If no match was found, push the default IRMASummary entry
721+
if !found_match {
722+
irma_summary.push(IRMASummary {
723+
sample_id: Some(sample.to_string()),
724+
reference: Some("Undetermined".to_owned()),
725+
total_reads: Some(0),
726+
pass_qc: Some(0),
727+
reads_mapped: Some(0),
728+
precent_reference_coverage: Some(0.0),
729+
median_coverage: Some(0.0),
730+
count_minor_snv: Some(0),
731+
count_minor_indel: Some(0),
732+
spike_percent_coverage: None,
733+
spike_median_coverage: None,
734+
pass_fail_reason: Some("Fail".to_owned()),
735+
subtype: Some("Undetermined".to_owned()),
736+
mira_module: None,
737+
runid: None,
738+
instrument: None,
739+
});
740+
}
716741
}
717742

718743
// Second loop: Update `irma_summary` with data from other dataframes

0 commit comments

Comments
 (0)