Navigation Menu

Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
finalize merge_gvcfs.nf
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi18av committed Oct 21, 2020
1 parent 58eabe1 commit 0b6c311
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions modules/gatk/haplotype_caller/haplotype_caller.nf
Expand Up @@ -3,7 +3,7 @@
//===========================

params.contamination
params.make_gvcf
params.make_gvcf = false
params.make_bamout
params.hc_scatter
params.gcs_project_for_requester_pays = false
Expand All @@ -17,7 +17,7 @@ process GATK_HAPLOTYPE_CALLER {
//---------------------------
// directives
//---------------------------

container = "broadinstitute/genomes-in-the-cloud:2.3.1-1500064817"

//---------------------------
input:
Expand Down
29 changes: 14 additions & 15 deletions modules/gatk/merge_gvcfs/merge_gvcfs.nf
Expand Up @@ -2,11 +2,8 @@
// Module parameters
//===========================

params.contamination
params.output_filename
params.gatk_path
params.machine_mem_gb
params.command_mem_gb
params.make_gvcf = false
params.memory = '10'

//===========================
// Process definition
Expand All @@ -16,11 +13,10 @@ process GATK_MERGE_GVCFS {


//---------------------------
// directives
// directives
//---------------------------
container
memory
disk
container = "broadinstitute/genomes-in-the-cloud:2.3.1-1500064817"
memory "${params.memory}GB"
// NOTE: WDL pre-emptible is not applicable. See https://cromwell.readthedocs.io/en/stable/RuntimeAttributes/#preemptible
// NOTE: Instead of WDL preemptive, we can rely on the excutor-independent `errorStrategy` and `maxRetries` directives in NXF
errorStrategy
Expand All @@ -29,25 +25,28 @@ process GATK_MERGE_GVCFS {
//---------------------------
input:
//---------------------------
path(input_vcfs)
path(input_vcfs_indexes)
tuple path(input_vcf), path(input_vcf_index)


//---------------------------
output:
//---------------------------
tuple path("${output_filename}"), path("${output_filename}.tbi")

//---------------------------
script:
//---------------------------
input_str = input_vcf.reduce("") { a, b -> a + " --INPUT ${b}" }.join(' ')
output_suffix = params.make_gvcf ? ".g.vcf.gz" : ".vcf.gz"
output_filename = input_vcf.getBaseName() + output_suffix

"""
set -e
${gatk_path} --java-options "-Xmx${command_mem_gb}G" \
${gatk_path} --java-options "-Xmx${$params.memory}G" \
MergeVcfs \
--INPUT ${sep = ' --INPUT ' input_vcfs} \
--OUTPUT ~{output_filename}
--INPUT ${input_str} \
--OUTPUT ${output_filename}
"""
"""
}
18 changes: 7 additions & 11 deletions modules/samtools/cram_to_bam/cram_to_bam.nf
@@ -1,7 +1,7 @@
//===========================
// Module parameters
//===========================

params.samtools_path

//===========================
// Process definition
Expand All @@ -12,13 +12,7 @@ process SAMTOOLS_CRAM_TO_BAM {
//---------------------------
// directives
//---------------------------
// TODO: We could add the samtools docker image
container = "broadinstitute/genomes-in-the-cloud:2.3.1-1500064817"
// TODO: Allocate these resources dynamically. See Line-135-137 of haplotypecaller_gvcf_gatk4.wdl
// memory
// disk
// NOTE: WDL pre-emptible is not applicable. See https://cromwell.readthedocs.io/en/stable/RuntimeAttributes/#preemptible
// NOTE: Instead of WDL preemptive, we can rely on the excutor-independent `errorStrategy` and `maxRetries` directives in NXF


//---------------------------
Expand All @@ -28,7 +22,7 @@ process SAMTOOLS_CRAM_TO_BAM {
path(ref_fasta_index)
path(ref_dict)
path(input_cram)
path(sample_name)


//---------------------------
output:
Expand All @@ -40,13 +34,15 @@ process SAMTOOLS_CRAM_TO_BAM {
//---------------------------
script:
//---------------------------
sample_name = input_cram.getBaseName()

"""
set -e
set -o pipefall
${samtools_path} view -h -T ${ref_fasta} ${input_cram}
${samtools_path} view -b -o ${sample_name}.bam -
${samtools_path} index -b ${sample_name}.bam
${params.samtools_path} view -h -T ${ref_fasta} ${input_cram}
${params.samtools_path} view -b -o ${sample_name}.bam -
${params.samtools_path} index -b ${sample_name}.bam
mv ${sample_name}.bam.bai ${sample_name}.bai
"""
Expand Down
5 changes: 5 additions & 0 deletions workflows/haplotype_caller.nf
Expand Up @@ -21,5 +21,10 @@ workflow {
take:

main:
SAMTOOLS_CRAM_TO_BAM
GATK_HAPLOTYPE_CALLER
GATK_MERGE_GVCFS

emit:

}

0 comments on commit 0b6c311

Please sign in to comment.