Add memory stuff to all gatk4 modules (#1122)

* Add memory stuff to all gatj4 modules

* Add removed input line back in

* revert script section
This commit is contained in:
FriederikeHanssen 2021-12-07 15:22:24 +01:00 committed by GitHub
parent d473a247d2
commit 7389963d5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 129 additions and 26 deletions

View file

@ -22,13 +22,14 @@ process GATK4_APPLYBQSR {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def interval = intervals ? "-L ${intervals}" : "" def interval = intervals ? "-L ${intervals}" : ""
def avail_mem = 3
if (!task.memory) { if (!task.memory) {
log.info '[GATK ApplyBQSR] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' log.info '[GATK ApplyBQSR] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else { } else {
avail_mem = task.memory.giga avail_mem = task.memory.giga
} }
""" """
gatk ApplyBQSR \\ gatk --java-options "-Xmx${avail_mem}g" ApplyBQSR \\
-R $fasta \\ -R $fasta \\
-I $input \\ -I $input \\
--bqsr-recal-file $bqsr_table \\ --bqsr-recal-file $bqsr_table \\

View file

@ -25,14 +25,14 @@ process GATK4_BASERECALIBRATOR {
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def intervalsCommand = intervalsBed ? "-L ${intervalsBed}" : "" def intervalsCommand = intervalsBed ? "-L ${intervalsBed}" : ""
def sitesCommand = knownSites.collect{"--known-sites ${it}"}.join(' ') def sitesCommand = knownSites.collect{"--known-sites ${it}"}.join(' ')
def avail_mem = 3
if (!task.memory) { if (!task.memory) {
log.info '[GATK BaseRecalibrator] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' log.info '[GATK BaseRecalibrator] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else { } else {
avail_mem = task.memory.giga avail_mem = task.memory.giga
} }
""" """
gatk BaseRecalibrator \ gatk --java-options "-Xmx${avail_mem}g" BaseRecalibrator \
-R $fasta \ -R $fasta \
-I $input \ -I $input \
$sitesCommand \ $sitesCommand \

View file

@ -18,8 +18,14 @@ process GATK4_BEDTOINTERVALLIST {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK BedToIntervalList] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk BedToIntervalList \\ gatk --java-options "-Xmx${avail_mem}g" BedToIntervalList \\
-I $bed \\ -I $bed \\
-SD $sequence_dict \\ -SD $sequence_dict \\
-O ${prefix}.interval_list \\ -O ${prefix}.interval_list \\

View file

@ -21,8 +21,14 @@ process GATK4_CALCULATECONTAMINATION {
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def matched_command = matched ? " -matched ${matched} " : '' def matched_command = matched ? " -matched ${matched} " : ''
def segment_command = segmentout ? " -segments ${prefix}.segmentation.table" : '' def segment_command = segmentout ? " -segments ${prefix}.segmentation.table" : ''
def avail_mem = 3
if (!task.memory) {
log.info '[GATK CalculateContamination] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk CalculateContamination \\ gatk --java-options "-Xmx${avail_mem}g" CalculateContamination \\
-I $pileup \\ -I $pileup \\
$matched_command \\ $matched_command \\
-O ${prefix}.contamination.table \\ -O ${prefix}.contamination.table \\

View file

@ -18,7 +18,7 @@ process GATK4_CREATESEQUENCEDICTIONARY {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def avail_mem = 6 def avail_mem = 6
if (!task.memory) { if (!task.memory) {
log.info '[GATK] Available memory not known - defaulting to 6GB. Specify process memory requirements to change this.' log.info '[GATK CreateSequenceDictionary] Available memory not known - defaulting to 6GB. Specify process memory requirements to change this.'
} else { } else {
avail_mem = task.memory.giga avail_mem = task.memory.giga
} }

View file

@ -21,8 +21,14 @@ process GATK4_CREATESOMATICPANELOFNORMALS {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK CreateSomaticPanelOfNormals] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk \\ gatk --java-options "-Xmx${avail_mem}g" \\
CreateSomaticPanelOfNormals \\ CreateSomaticPanelOfNormals \\
-R $fasta \\ -R $fasta \\
-V gendb://$genomicsdb \\ -V gendb://$genomicsdb \\

View file

@ -29,7 +29,7 @@ process GATK4_ESTIMATELIBRARYCOMPLEXITY {
avail_mem = task.memory.giga avail_mem = task.memory.giga
} }
""" """
gatk EstimateLibraryComplexity \ gatk --java-options "-Xmx${avail_mem}g" EstimateLibraryComplexity \
${crams} \ ${crams} \
-O ${prefix}.metrics \ -O ${prefix}.metrics \
--REFERENCE_SEQUENCE ${fasta} \ --REFERENCE_SEQUENCE ${fasta} \

View file

@ -18,8 +18,14 @@ process GATK4_FASTQTOSAM {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def read_files = meta.single_end ? "-F1 $reads" : "-F1 ${reads[0]} -F2 ${reads[1]}" def read_files = meta.single_end ? "-F1 $reads" : "-F1 ${reads[0]} -F2 ${reads[1]}"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK FastqToSam] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk FastqToSam \\ gatk --java-options "-Xmx${avail_mem}g" FastqToSam \\
$read_files \\ $read_files \\
-O ${prefix}.bam \\ -O ${prefix}.bam \\
-SM $prefix \\ -SM $prefix \\

View file

@ -37,8 +37,14 @@ process GATK4_FILTERMUTECTCALLS {
if (contaminationfile) { if (contaminationfile) {
contamination_options = '--contamination-table ' + contaminationfile.join(' --contamination-table ') contamination_options = '--contamination-table ' + contaminationfile.join(' --contamination-table ')
} }
def avail_mem = 3
if (!task.memory) {
log.info '[GATK FilterMutectCalls] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk FilterMutectCalls \\ gatk --java-options "-Xmx${avail_mem}g" FilterMutectCalls \\
-R $fasta \\ -R $fasta \\
-V $vcf \\ -V $vcf \\
$orientationbias_options \\ $orientationbias_options \\

View file

@ -42,8 +42,14 @@ process GATK4_GENOMICSDBIMPORT {
updated_db = wspace.toString() updated_db = wspace.toString()
} }
def avail_mem = 3
if (!task.memory) {
log.info '[GATK GenomicsDBImport] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk GenomicsDBImport \\ gatk --java-options "-Xmx${avail_mem}g" GenomicsDBImport \\
$inputs_command \\ $inputs_command \\
$dir_command \\ $dir_command \\
$intervals_command \\ $intervals_command \\

View file

@ -26,8 +26,14 @@ process GATK4_GENOTYPEGVCFS {
def dbsnp_options = dbsnp ? "-D ${dbsnp}" : "" def dbsnp_options = dbsnp ? "-D ${dbsnp}" : ""
def interval_options = intervals_bed ? "-L ${intervals_bed}" : "" def interval_options = intervals_bed ? "-L ${intervals_bed}" : ""
def gvcf_options = gvcf.name.endsWith(".vcf") || gvcf.name.endsWith(".vcf.gz") ? "$gvcf" : "gendb://$gvcf" def gvcf_options = gvcf.name.endsWith(".vcf") || gvcf.name.endsWith(".vcf.gz") ? "$gvcf" : "gendb://$gvcf"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK GenotypeGVCFs] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk \\ gatk --java-options "-Xmx${avail_mem}g" \\
GenotypeGVCFs \\ GenotypeGVCFs \\
$args \\ $args \\
$interval_options \\ $interval_options \\

View file

@ -24,8 +24,14 @@ process GATK4_GETPILEUPSUMMARIES {
sitesCommand = sites ? " -L ${sites} " : " -L ${variants} " sitesCommand = sites ? " -L ${sites} " : " -L ${variants} "
def avail_mem = 3
if (!task.memory) {
log.info '[GATK GetPileupSummaries] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk GetPileupSummaries \\ gatk --java-options "-Xmx${avail_mem}g" GetPileupSummaries \\
-I $bam \\ -I $bam \\
-V $variants \\ -V $variants \\
$sitesCommand \\ $sitesCommand \\

View file

@ -16,8 +16,14 @@ process GATK4_INDEXFEATUREFILE {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def avail_mem = 3
if (!task.memory) {
log.info '[GATK IndexFeatureFile] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk \\ gatk --java-options "-Xmx${avail_mem}g" \\
IndexFeatureFile \\ IndexFeatureFile \\
$args \\ $args \\
-I $feature_file -I $feature_file

View file

@ -17,11 +17,17 @@ process GATK4_INTERVALLISTTOOLS {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK IntervalListTools] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
mkdir ${prefix}_split mkdir ${prefix}_split
gatk \\ gatk --java-options "-Xmx${avail_mem}g" \\
IntervalListTools \\ IntervalListTools \\
-I ${interval_list} \\ -I ${interval_list} \\
-O ${prefix}_split \\ -O ${prefix}_split \\

View file

@ -19,8 +19,14 @@ process GATK4_LEARNREADORIENTATIONMODEL {
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def inputs_list = [] def inputs_list = []
f1r2.each() { a -> inputs_list.add(" -I " + a) } f1r2.each() { a -> inputs_list.add(" -I " + a) }
def avail_mem = 3
if (!task.memory) {
log.info '[GATK LearnReadOrientationModel] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk \\ gatk --java-options "-Xmx${avail_mem}g" \\
LearnReadOrientationModel \\ LearnReadOrientationModel \\
${inputs_list.join(' ')} \\ ${inputs_list.join(' ')} \\
-O ${prefix}.tar.gz \\ -O ${prefix}.tar.gz \\

View file

@ -20,14 +20,14 @@ process GATK4_MARKDUPLICATES {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def bam_list = bams.collect(){ bam -> "--INPUT ".concat(bam.toString()) }.join(" ") def bam_list = bams.collect(){ bam -> "--INPUT ".concat(bam.toString()) }.join(" ")
def avail_mem = 3 def avail_mem = 3
if (!task.memory) { if (!task.memory) {
log.info '[GATK HaplotypeCaller] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' log.info '[GATK MarkDuplicates] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else { } else {
avail_mem = task.memory.giga avail_mem = task.memory.giga
} }
""" """
gatk MarkDuplicates \\ gatk --java-options "-Xmx${avail_mem}g" MarkDuplicates \\
$bam_list \\ $bam_list \\
--METRICS_FILE ${prefix}.metrics \\ --METRICS_FILE ${prefix}.metrics \\
--TMP_DIR . \\ --TMP_DIR . \\

View file

@ -20,8 +20,14 @@ process GATK4_MERGEBAMALIGNMENT {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK MergeBamAlignment] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk MergeBamAlignment \\ gatk --java-options "-Xmx${avail_mem}g" MergeBamAlignment \\
ALIGNED=$aligned \\ ALIGNED=$aligned \\
UNMAPPED=$unmapped \\ UNMAPPED=$unmapped \\
R=$fasta \\ R=$fasta \\

View file

@ -26,8 +26,14 @@ process GATK4_MERGEVCFS {
input += " I=${vcf}" input += " I=${vcf}"
} }
def ref = use_ref_dict ? "D=${ref_dict}" : "" def ref = use_ref_dict ? "D=${ref_dict}" : ""
def avail_mem = 3
if (!task.memory) {
log.info '[GATK MergeVcfs] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk MergeVcfs \\ gatk --java-options "-Xmx${avail_mem}g" MergeVcfs \\
$input \\ $input \\
O=${prefix}.vcf.gz \\ O=${prefix}.vcf.gz \\
$ref \\ $ref \\

View file

@ -53,8 +53,14 @@ process GATK4_MUTECT2 {
normals_command = '-normal ' + which_norm.join( ' -normal ') normals_command = '-normal ' + which_norm.join( ' -normal ')
} }
def avail_mem = 3
if (!task.memory) {
log.info '[GATK Mutect2] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk Mutect2 \\ gatk --java-options "-Xmx${avail_mem}g" Mutect2 \\
-R ${fasta} \\ -R ${fasta} \\
${inputs_command} \\ ${inputs_command} \\
${normals_command} \\ ${normals_command} \\

View file

@ -17,8 +17,14 @@ process GATK4_REVERTSAM {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK RevertSam] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk RevertSam \\ gatk --java-options "-Xmx${avail_mem}g" RevertSam \\
I=$bam \\ I=$bam \\
O=${prefix}.reverted.bam \\ O=${prefix}.reverted.bam \\
$args $args

View file

@ -18,8 +18,14 @@ process GATK4_SAMTOFASTQ {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def output = meta.single_end ? "FASTQ=${prefix}.fastq.gz" : "FASTQ=${prefix}_1.fastq.gz SECOND_END_FASTQ=${prefix}_2.fastq.gz" def output = meta.single_end ? "FASTQ=${prefix}.fastq.gz" : "FASTQ=${prefix}_1.fastq.gz SECOND_END_FASTQ=${prefix}_2.fastq.gz"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK SamToFastq] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk SamToFastq \\ gatk --java-options "-Xmx${avail_mem}g" SamToFastq \\
I=$bam \\ I=$bam \\
$output \\ $output \\
$args $args

View file

@ -20,8 +20,14 @@ process GATK4_SPLITNCIGARREADS {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[GATK SplitNCigarReads] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
""" """
gatk SplitNCigarReads \\ gatk --java-options "-Xmx${avail_mem}g" SplitNCigarReads \\
-R $fasta \\ -R $fasta \\
-I $bam \\ -I $bam \\
-O ${prefix}.bam \\ -O ${prefix}.bam \\

View file

@ -23,7 +23,7 @@ process GATK4_VARIANTFILTRATION {
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def avail_mem = 3 def avail_mem = 3
if (!task.memory) { if (!task.memory) {
log.info '[GATK HaplotypeCaller] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' log.info '[GATK VariantFiltration] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else { } else {
avail_mem = task.memory.toGiga() avail_mem = task.memory.toGiga()
} }