|
@@ -167,15 +167,28 @@
|
|
|
//! - [ClairS GitHub repository](https://github.com/HKU-BAL/ClairS)
|
|
//! - [ClairS GitHub repository](https://github.com/HKU-BAL/ClairS)
|
|
|
//! - [ClairS publication (Nature Communications, 2024)](https://doi.org/10.1038/s41467-024-52832-2)
|
|
//! - [ClairS publication (Nature Communications, 2024)](https://doi.org/10.1038/s41467-024-52832-2)
|
|
|
use crate::{
|
|
use crate::{
|
|
|
- annotation::{Annotation, Annotations, Caller, CallerCat, Sample}, collection::vcf::Vcf, commands::{
|
|
|
|
|
- Command as JobCommand, LocalBatchRunner, LocalRunner, SbatchRunner, SlurmParams, SlurmRunner, bcftools::{BcftoolsConcat, BcftoolsKeepPass}, samtools::SamtoolsMergeMany
|
|
|
|
|
- }, config::Config, helpers::{
|
|
|
|
|
|
|
+ annotation::{Annotation, Annotations, Caller, CallerCat, Sample},
|
|
|
|
|
+ collection::vcf::Vcf,
|
|
|
|
|
+ commands::{
|
|
|
|
|
+ bcftools::{BcftoolsConcat, BcftoolsKeepPass},
|
|
|
|
|
+ samtools::SamtoolsMergeMany,
|
|
|
|
|
+ Command as JobCommand, LocalBatchRunner, LocalRunner, SbatchRunner, SlurmParams,
|
|
|
|
|
+ SlurmRunner,
|
|
|
|
|
+ },
|
|
|
|
|
+ config::Config,
|
|
|
|
|
+ helpers::{
|
|
|
get_genome_sizes, is_file_older, list_files_recursive, remove_dir_if_exists,
|
|
get_genome_sizes, is_file_older, list_files_recursive, remove_dir_if_exists,
|
|
|
singularity_bind_flags, split_genome_into_n_regions_exact,
|
|
singularity_bind_flags, split_genome_into_n_regions_exact,
|
|
|
- }, io::vcf::read_vcf, locker::SampleLock, pipes::{Initialize, ShouldRun, Version}, run, run_many, runners::Run, variant::{
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ io::vcf::read_vcf,
|
|
|
|
|
+ locker::SampleLock,
|
|
|
|
|
+ pipes::{Initialize, ShouldRun, Version},
|
|
|
|
|
+ run, run_many,
|
|
|
|
|
+ runners::Run,
|
|
|
|
|
+ variant::{
|
|
|
variant_collection::VariantCollection,
|
|
variant_collection::VariantCollection,
|
|
|
vcf_variant::{Label, Variants},
|
|
vcf_variant::{Label, Variants},
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
use anyhow::Context;
|
|
use anyhow::Context;
|
|
@@ -365,10 +378,11 @@ impl LocalBatchRunner for ClairS {}
|
|
|
|
|
|
|
|
impl SlurmRunner for ClairS {
|
|
impl SlurmRunner for ClairS {
|
|
|
fn slurm_args(&self) -> Vec<String> {
|
|
fn slurm_args(&self) -> Vec<String> {
|
|
|
|
|
+ let batch_id = self.part_index.map(|i| format!("_{i}")).unwrap_or_default();
|
|
|
SlurmParams {
|
|
SlurmParams {
|
|
|
- job_name: Some(format!("clairs_{}", self.id)),
|
|
|
|
|
|
|
+ job_name: Some(format!("clairs_{}{}", self.id, batch_id)),
|
|
|
cpus_per_task: Some(self.config.clairs_threads as u32),
|
|
cpus_per_task: Some(self.config.clairs_threads as u32),
|
|
|
- mem: Some("60G".into()),
|
|
|
|
|
|
|
+ mem: Some("50G".into()),
|
|
|
partition: Some("shortq".into()),
|
|
partition: Some("shortq".into()),
|
|
|
gres: None,
|
|
gres: None,
|
|
|
}
|
|
}
|
|
@@ -378,10 +392,11 @@ impl SlurmRunner for ClairS {
|
|
|
|
|
|
|
|
impl SbatchRunner for ClairS {
|
|
impl SbatchRunner for ClairS {
|
|
|
fn slurm_params(&self) -> SlurmParams {
|
|
fn slurm_params(&self) -> SlurmParams {
|
|
|
|
|
+ let batch_id = self.part_index.map(|i| format!("_{i}")).unwrap_or_default();
|
|
|
SlurmParams {
|
|
SlurmParams {
|
|
|
- job_name: Some(format!("clairs_{}", self.id)),
|
|
|
|
|
|
|
+ job_name: Some(format!("clairs_{}{}", self.id, batch_id)),
|
|
|
cpus_per_task: Some(self.config.clairs_threads as u32),
|
|
cpus_per_task: Some(self.config.clairs_threads as u32),
|
|
|
- mem: Some("60G".into()),
|
|
|
|
|
|
|
+ mem: Some("50G".into()),
|
|
|
partition: Some("shortq".into()),
|
|
partition: Some("shortq".into()),
|
|
|
gres: None,
|
|
gres: None,
|
|
|
}
|
|
}
|
|
@@ -400,7 +415,6 @@ impl Run for ClairS {
|
|
|
let _lock = SampleLock::acquire(&lock_dir, &self.id, "clairs")
|
|
let _lock = SampleLock::acquire(&lock_dir, &self.id, "clairs")
|
|
|
.with_context(|| format!("Cannot start ClairS for {}", self.id))?;
|
|
.with_context(|| format!("Cannot start ClairS for {}", self.id))?;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
if self.config.slurm_runner {
|
|
if self.config.slurm_runner {
|
|
|
run_clairs_chunked(&self.id, &self.config, 50)?;
|
|
run_clairs_chunked(&self.id, &self.config, 50)?;
|
|
|
// merge_haplotaged_tmp_bam(&self.config, &self.id)?;
|
|
// merge_haplotaged_tmp_bam(&self.config, &self.id)?;
|
|
@@ -863,7 +877,6 @@ pub fn run_clairs_chunked(id: &str, config: &Config, n_parts: usize) -> anyhow::
|
|
|
|
|
|
|
|
let base = ClairS::initialize(id, config)?;
|
|
let base = ClairS::initialize(id, config)?;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
let normal_bam = config.normal_bam(id);
|
|
let normal_bam = config.normal_bam(id);
|
|
|
let reader = bam::Reader::from_path(&normal_bam)
|
|
let reader = bam::Reader::from_path(&normal_bam)
|
|
|
.with_context(|| format!("Failed to open BAM: {normal_bam}"))?;
|
|
.with_context(|| format!("Failed to open BAM: {normal_bam}"))?;
|