|
@@ -134,15 +134,16 @@ use crate::{
|
|
|
collection::vcf::Vcf,
|
|
collection::vcf::Vcf,
|
|
|
commands::{
|
|
commands::{
|
|
|
bcftools::{BcftoolsConcat, BcftoolsIndex, BcftoolsKeepPass},
|
|
bcftools::{BcftoolsConcat, BcftoolsIndex, BcftoolsKeepPass},
|
|
|
- Command as JobCommand, LocalBatchRunner, LocalRunner, SbatchRunner, SlurmParams,
|
|
|
|
|
|
|
+ exec_jobs, AnyJob, Command as JobCommand, LocalRunner, SbatchRunner, SlurmParams,
|
|
|
SlurmRunner,
|
|
SlurmRunner,
|
|
|
},
|
|
},
|
|
|
config::Config,
|
|
config::Config,
|
|
|
helpers::{is_file_older, remove_dir_if_exists, singularity_bind_flags},
|
|
helpers::{is_file_older, remove_dir_if_exists, singularity_bind_flags},
|
|
|
io::{bam::read_sm_tag_or_inject, bed::BedRow, vcf::read_vcf},
|
|
io::{bam::read_sm_tag_or_inject, bed::BedRow, vcf::read_vcf},
|
|
|
|
|
+ jobs_seq,
|
|
|
locker::SampleLock,
|
|
locker::SampleLock,
|
|
|
pipes::{Initialize, ShouldRun, Version},
|
|
pipes::{Initialize, ShouldRun, Version},
|
|
|
- run, run_many,
|
|
|
|
|
|
|
+ run,
|
|
|
runners::Run,
|
|
runners::Run,
|
|
|
variant::{
|
|
variant::{
|
|
|
variant_collection::VariantCollection,
|
|
variant_collection::VariantCollection,
|
|
@@ -362,7 +363,7 @@ impl JobCommand for Mutect2 {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
impl LocalRunner for Mutect2 {}
|
|
impl LocalRunner for Mutect2 {}
|
|
|
-impl LocalBatchRunner for Mutect2 {}
|
|
|
|
|
|
|
+// impl LocalBatchRunner for Mutect2 {}
|
|
|
|
|
|
|
|
impl SlurmRunner for Mutect2 {
|
|
impl SlurmRunner for Mutect2 {
|
|
|
fn slurm_args(&self) -> Vec<String> {
|
|
fn slurm_args(&self) -> Vec<String> {
|
|
@@ -815,27 +816,36 @@ pub fn run_mutect2_chunked(id: &str, config: &Config, n_parts: usize) -> anyhow:
|
|
|
|
|
|
|
|
job.bed_path = sub_bed;
|
|
job.bed_path = sub_bed;
|
|
|
info!("Planned Mutect2 job:\n{job}");
|
|
info!("Planned Mutect2 job:\n{job}");
|
|
|
- jobs.push(job);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let keep_pass = BcftoolsKeepPass::from_config(
|
|
|
|
|
+ &job.config,
|
|
|
|
|
+ job.output_vcf_path(),
|
|
|
|
|
+ job.passed_vcf_path(),
|
|
|
|
|
+ );
|
|
|
|
|
+ jobs.push(jobs_seq![job, keep_pass]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let outputs = exec_jobs(jobs, false, 1).context("Failed to run Mutect2 chunked")?;
|
|
|
|
|
+
|
|
|
// Run all Mutect2 jobs (local or Slurm, depending on config)
|
|
// Run all Mutect2 jobs (local or Slurm, depending on config)
|
|
|
- let outputs = run_many!(config, jobs.clone())?;
|
|
|
|
|
|
|
+ // let outputs = run_many!(config, jobs.clone())?;
|
|
|
for output in outputs.iter() {
|
|
for output in outputs.iter() {
|
|
|
output.save_to_file(format!("{}/mutect2_", base.log_dir))?;
|
|
output.save_to_file(format!("{}/mutect2_", base.log_dir))?;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Filter PASS variants for each part
|
|
|
|
|
- info!(
|
|
|
|
|
- "Filtering PASS variants for all {} Mutect2 parts",
|
|
|
|
|
- actual_n_parts
|
|
|
|
|
- );
|
|
|
|
|
- let filter_jobs: Vec<_> = jobs
|
|
|
|
|
- .iter()
|
|
|
|
|
- .map(|job| {
|
|
|
|
|
- BcftoolsKeepPass::from_config(&job.config, job.output_vcf_path(), job.passed_vcf_path())
|
|
|
|
|
- })
|
|
|
|
|
- .collect();
|
|
|
|
|
- run_many!(config, filter_jobs)?;
|
|
|
|
|
|
|
+ // // Filter PASS variants for each part
|
|
|
|
|
+ // info!(
|
|
|
|
|
+ // "Filtering PASS variants for all {} Mutect2 parts",
|
|
|
|
|
+ // actual_n_parts
|
|
|
|
|
+ // );
|
|
|
|
|
+ // let filter_jobs: Vec<_> = jobs
|
|
|
|
|
+ // .iter()
|
|
|
|
|
+ // .flatten()
|
|
|
|
|
+ // .map(|job| {
|
|
|
|
|
+ // BcftoolsKeepPass::from_config(&job.config, job.output_vcf_path(), job.passed_vcf_path())
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .collect();
|
|
|
|
|
+ // run_many!(config, filter_jobs)?;
|
|
|
|
|
|
|
|
// Merge all PASS VCFs
|
|
// Merge all PASS VCFs
|
|
|
merge_mutect2_parts(&base, actual_n_parts)?;
|
|
merge_mutect2_parts(&base, actual_n_parts)?;
|
|
@@ -873,7 +883,8 @@ mod tests {
|
|
|
fn mutect2_run() -> anyhow::Result<()> {
|
|
fn mutect2_run() -> anyhow::Result<()> {
|
|
|
test_init();
|
|
test_init();
|
|
|
let config = Config::default();
|
|
let config = Config::default();
|
|
|
- Run::run(&mut Mutect2::initialize("CHALO", &config)?)?;
|
|
|
|
|
|
|
+ Mutect2::initialize("DUMCO", &config)?.run()?;
|
|
|
|
|
+ // Run::run(&mut Mutect2::initialize("DUMCO", &config)?)?;
|
|
|
// Mutect2::initialize("CHALO", &config)?.run()?;
|
|
// Mutect2::initialize("CHALO", &config)?.run()?;
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|