|
|
@@ -339,6 +339,20 @@ impl Collections {
|
|
|
Ok(tasks)
|
|
|
}
|
|
|
|
|
|
+ /// Generates pairs of diagnostic and MRD BAM files.
|
|
|
+ ///
|
|
|
+ /// This function performs the following steps:
|
|
|
+ /// 1. Extracts and deduplicates IDs from all BAM files.
|
|
|
+ /// 2. For each unique ID, attempts to find a pair of BAM files:
|
|
|
+ /// - One labeled as "diag" (diagnostic)
|
|
|
+ /// - One labeled as "mrd" (minimal residual disease)
|
|
|
+ /// 3. Returns pairs where both "diag" and "mrd" BAMs are found.
|
|
|
+ ///
|
|
|
+ /// # Returns
|
|
|
+ ///
|
|
|
+ /// * `Vec<(bam::Bam, bam::Bam)>` - A vector of tuples, each containing a pair of BAM files
|
|
|
+ /// (diagnostic and MRD) for a unique ID.
|
|
|
+ ///
|
|
|
pub fn bam_pairs(&self) -> Vec<(bam::Bam, bam::Bam)> {
|
|
|
let mut ids: Vec<String> = self.bam.bams.iter().map(|b| b.id.clone()).collect();
|
|
|
ids.sort();
|
|
|
@@ -357,7 +371,23 @@ impl Collections {
|
|
|
.collect()
|
|
|
}
|
|
|
|
|
|
- // UNTESTED
|
|
|
+ /// Aggregates variant tasks based on BAM pairs and VCF files.
|
|
|
+ ///
|
|
|
+ /// This function performs the following operations:
|
|
|
+ /// 1. Iterates through BAM pairs (DIAG/MRD).
|
|
|
+ /// 2. Checks for the existence of a _constit.bytes.gz file for each pair.
|
|
|
+ /// 3. If the file exists, compares its modification time with VCF files.
|
|
|
+ /// 4. Creates variant tasks if the file is older than one of VCF or if it doesn't exist.
|
|
|
+ ///
|
|
|
+ /// # Arguments
|
|
|
+ ///
|
|
|
+ /// * `self` - The struct instance containing BAM pairs and VCF information.
|
|
|
+ ///
|
|
|
+ /// # Returns
|
|
|
+ ///
|
|
|
+ /// * `anyhow::Result<Vec<CollectionsTasks>>` - A Result containing a vector of `CollectionsTasks::Variants`
|
|
|
+ /// if successful, or an error if file metadata cannot be accessed.
|
|
|
+ ///
|
|
|
pub fn todo_variants_agg(&self) -> anyhow::Result<Vec<CollectionsTasks>> {
|
|
|
let mut tasks = Vec::new();
|
|
|
let config = VariantsConfig::default();
|