Skip to content

Commit

Permalink
Merge pull request #10 from karinlag/master
Browse files Browse the repository at this point in the history
Fixing precmd, savemode and javaopts for pilon
  • Loading branch information
karinlag authored Nov 4, 2018
2 parents bb8aa6f + 7e56284 commit b456be8
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 24 deletions.
31 changes: 18 additions & 13 deletions asm_annot.nf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Channel

// run_fastq and run_multiqc are exactly the same as qc_track
process run_fastqc {
publishDir "${params.out_dir}/fastqc", mode: 'copy'
publishDir "${params.out_dir}/fastqc", mode: "${params.savemode}"
tag { pair_id }
label 'one'

Expand All @@ -50,13 +50,14 @@ process run_fastqc {
file "$pair_id" into fastqc_results

"""
${preCmd}
mkdir ${pair_id}
fastqc -q ${reads} -o ${pair_id} -t $task.cpus
"""
}

process run_multiqc {
publishDir "${params.out_dir}/multiqc", mode: 'copy'
publishDir "${params.out_dir}/multiqc", mode: "${params.savemode}"
tag {"multiqc"}
label 'one'

Expand All @@ -67,6 +68,7 @@ process run_multiqc {
file "multiqc_report.html" into multiqc_report

"""
${preCmd}
multiqc fastqc_output
"""
}
Expand Down Expand Up @@ -98,7 +100,7 @@ process collate_data {
*/
process run_strip {

publishDir "${params.out_dir}/bbduk", mode: "copy"
publishDir "${params.out_dir}/bbduk", mode: "${params.savemode}"
tag { pair_id }

input:
Expand All @@ -125,7 +127,7 @@ process run_strip {
* Remove adapter sequences and low quality base pairs with Trimmomatic
*/
process run_trim {
publishDir "${params.out_dir}/bbduk_trimmed", mode: "copy"
publishDir "${params.out_dir}/bbduk_trimmed", mode: "${params.savemode}"
tag { pair_id }

input:
Expand All @@ -138,13 +140,13 @@ process run_trim {
"""
${preCmd}
trimmomatic PE -threads $task.cpus -trimlog ${pair_id}_concat_stripped_trimmed.log ${pair_id}*_concat_stripped.fq.gz \
-baseout ${pair_id}_trimmed ILLUMINACLIP:${params.adapter_dir}/${params.adapters}:${params.illuminaClipOptions} \
-baseout ${pair_id}_trimmed.fq.gz ILLUMINACLIP:${params.adapter_dir}/${params.adapters}:${params.illuminaClipOptions} \
SLIDINGWINDOW:${params.slidingwindow} \
LEADING:${params.leading} TRAILING:${params.trailing} \
MINLEN:${params.minlen} &> ${pair_id}_run.log
mv ${pair_id}_trimmed_1P ${pair_id}_R1_concat_stripped_trimmed.fq.gz
mv ${pair_id}_trimmed_2P ${pair_id}_R2_concat_stripped_trimmed.fq.gz
cat ${pair_id}_trimmed_1U ${pair_id}_trimmed_2U > ${pair_id}_S_concat_stripped_trimmed.fq.gz
mv ${pair_id}_trimmed_1P.fq.gz ${pair_id}_R1_concat_stripped_trimmed.fq.gz
mv ${pair_id}_trimmed_2P.fq.gz ${pair_id}_R2_concat_stripped_trimmed.fq.gz
cat ${pair_id}_trimmed_1U.fq.gz ${pair_id}_trimmed_2U.fq.gz > ${pair_id}_S_concat_stripped_trimmed.fq.gz
"""
}

Expand All @@ -153,7 +155,7 @@ process run_trim {
* Build assembly with SPAdes
*/
process run_spadesasm {
publishDir "${params.out_dir}/spades", mode: "copy"
publishDir "${params.out_dir}/spades", mode: "${params.savemode}"
tag { pair_id }
label 'longtime'

Expand Down Expand Up @@ -183,7 +185,7 @@ process run_spadesasm {
* Map reads to the spades assembly
*/
process run_bwamem {
publishDir "${params.out_dir}/bwamem", mode: "copy"
publishDir "${params.out_dir}/bwamem", mode: "${params.savemode}"
tag { pair_id }
label 'longtime'

Expand All @@ -196,6 +198,7 @@ process run_bwamem {
file("${pair_id}_mapped_sorted.bam.bai") into bwamem_results

"""
${preCmd}
bwa index ${pair_id}_spades_scaffolds.fasta
bwa mem -t $task.cpus ${pair_id}_spades_scaffolds.fasta \
*.fq.gz | samtools sort -o ${pair_id}_mapped_sorted.bam -
Expand All @@ -208,7 +211,7 @@ process run_bwamem {
*/

process run_pilon {
publishDir "${params.out_dir}/pilon", mode: "copy"
publishDir "${params.out_dir}/pilon", mode: "${params.savemode}"
tag { pair_id }

input:
Expand All @@ -222,6 +225,8 @@ process run_pilon {
file "${pair_id}_pilon_spades.fasta" into asms_for_quast

"""
${preCmd}
export _JAVA_OPTIONS=$task.javaopts
pilon --threads $task.cpus --genome ${pair_id}_spades_scaffolds.fasta \
--bam ${pair_id}_mapped_sorted.bam --output ${pair_id}_pilon_spades \
--changes --vcfqe &> ${pair_id}_pilon_spades.log
Expand All @@ -232,7 +237,7 @@ process run_pilon {
* Annotation using PROKKA
*/
process run_prokka {
publishDir "${params.out_dir}/prokka", mode: "copy"
publishDir "${params.out_dir}/prokka", mode: "${params.savemode}"
tag { pair_id }

input:
Expand All @@ -257,7 +262,7 @@ process run_prokka {
process quast_eval {
// The output here is a directory in and of itself
// thus not creating a new one
publishDir "${params.out_dir}/", mode: "copy"
publishDir "${params.out_dir}/", mode: "${params.savemode}"
tag { pair_id }

input:
Expand Down
1 change: 1 addition & 0 deletions conf/asm_annot_template.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ params.out_dir = "track_three"
// General configuration variables
params.pwd = "$PWD"
params.help = false
params.savemode = "copy"

// BBDuk params, has to be absolute paths
params.stripgenome = "/work/projects/nn9305k/genome_references/genomes/PhiX/PhiX.fasta"
Expand Down
1 change: 1 addition & 0 deletions conf/qc_track_template.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ params.out_dir = "track_one"
// General configuration variables
params.pwd = "$PWD"
params.help = false
params.savemode = "link"

// Raw fastqc results
params.fastqc = "fastqc"
Expand Down
3 changes: 3 additions & 0 deletions conf/slurm.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ process {
cpus = 16
withLabel: one {cpus = 1}

//this is mostly for pilon, but can be used elsewhere too
javaopts = '-Xmx12G'

time = { 1.h * task.attempt }
withLabel: longtime {time = { 4.h * task.attempt }}
}
1 change: 1 addition & 0 deletions conf/specific_genes_template.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ params.out_dir = "track_two"
// General configuration variables
params.pwd = "$PWD"
params.help = false
params.savemode = "copy"

params.threads = 1

Expand Down
3 changes: 3 additions & 0 deletions conf/standard.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ process {
executor = "local"
cpus = 1
maxForks = 2
//this is mostly for pilon, but can be used elsewhere too
javaopts = ''

}
6 changes: 4 additions & 2 deletions qc_track.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Channel
// Second is to send all of through fastqc

process run_fastqc {
publishDir "${params.out_dir}/${params.fastqc}", mode: 'copy'
publishDir "${params.out_dir}/${params.fastqc}", mode: "${params.savemode}"
tag {pair_id}
label 'one'

Expand All @@ -48,13 +48,14 @@ process run_fastqc {
file "$pair_id" into fastqc_results

"""
${preCmd}
mkdir ${pair_id}
fastqc -q ${reads} -o ${pair_id} -t $task.cpus
"""
}

process run_multiqc {
publishDir "${params.out_dir}/multiqc", mode: 'copy'
publishDir "${params.out_dir}/multiqc", mode: "${params.savemode}"
tag {"multiqc"}
label 'one'

Expand All @@ -65,6 +66,7 @@ process run_multiqc {
file "multiqc_report.html" into multiqc_report

"""
${preCmd}
multiqc fastqc_output
"""
}
18 changes: 9 additions & 9 deletions specific_genes.nf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ process collate_data {

// Download database database
process run_ariba_mlst_prep {
publishDir params.out_dir + "/" + params.mlst_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.mlst_results}", mode: "${params.savemode}"
tag {'Dowloading schema'}
label 'one'

Expand All @@ -85,7 +85,7 @@ process run_ariba_mlst_prep {
// Run ariba on each dataset

process run_ariba_mlst_pred {
publishDir params.out_dir + "/" + params.mlst_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.mlst_results}", mode: "${params.savemode}"
tag {pair_id}

input:
Expand All @@ -109,7 +109,7 @@ process run_ariba_mlst_pred {

// Summarize MLST results
process run_ariba_mlst_summarize {
publishDir params.out_dir + "/" + params.mlst_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.mlst_results}", mode: "${params.savemode}"
tag {'Summarizing mlst'}
label 'one'

Expand All @@ -134,7 +134,7 @@ process run_ariba_mlst_summarize {

// These three processes are for AMR prediction
process run_ariba_amr_prep {
publishDir params.out_dir + "/" + params.amr_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.amr_results}", mode: "${params.savemode}"
tag {'Dowloading AMR data'}
label 'one'

Expand All @@ -152,7 +152,7 @@ process run_ariba_amr_prep {
}

process run_ariba_amr_pred {
publishDir params.out_dir + "/" + params.amr_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.amr_results}", mode: "${params.savemode}"
tag{pair_id}

input:
Expand All @@ -177,7 +177,7 @@ process run_ariba_amr_pred {

// Summarize AMR results
process run_ariba_amr_summarize {
publishDir params.out_dir + "/" + params.amr_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.amr_results}", mode: "${params.savemode}"
tag{'Summarizing AMR'}
label 'one'

Expand All @@ -198,7 +198,7 @@ process run_ariba_amr_summarize {

// These three processes are for virulence prediction
process run_ariba_vir_prep {
publishDir params.out_dir + "/" + params.vir_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.vir_results}", mode: "${params.savemode}"
tag{'Downloading virulence data'}
label 'one'

Expand All @@ -216,7 +216,7 @@ process run_ariba_vir_prep {
}

process run_ariba_vir_pred {
publishDir params.out_dir + "/" + params.vir_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.vir_results}", mode: "${params.savemode}"
tag{pair_id}

input:
Expand All @@ -241,7 +241,7 @@ process run_ariba_vir_pred {

// Summarize virulence results
process run_ariba_vir_summarize {
publishDir params.out_dir + "/" + params.vir_results, mode: 'copy'
publishDir "${params.out_dir}" + "/" + "${params.vir_results}", mode: "${params.savemode}"
tag{'Summarizing virulence'}
label 'one'

Expand Down

0 comments on commit b456be8

Please sign in to comment.