Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added SLURM options to config file and process-level resource config… #20

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions workflows/Nextflow/modules/countFastq/countFastq.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//creates fastqCount.txt as preparation for downstream processes
process countFastq {
label "countFastq"
label "small"

input:
val settings
Expand Down Expand Up @@ -30,6 +31,7 @@ process countFastq {
//gets average read length from fastqCount.txt
process avgLen {
label "countFastq"
label "small"

input:
path countFastq
Expand Down
13 changes: 11 additions & 2 deletions workflows/Nextflow/modules/hostRemoval/hostRemoval.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
//clean input FASTQ files of reads that map to provided host references, one process per given host
process hostRemoval {
label "hostRemoval"
label "medium"

publishDir(
path: "${settings["outDir"]}/HostRemoval",
mode: 'copy'
Expand Down Expand Up @@ -46,13 +48,12 @@ process hostRemoval {
}
minScore = ontFlag != "" ? "-T ${settings["minLen"]} " : minScore
bwaMemOptions = "-bwaMemOptions \"${ontFlag} ${minScore}\" "
def cpu = settings["cpus"] != null ? "-cpu ${settings["cpus"]} " : ""

"""
host_reads_removal_by_mapping.pl\
$refFile\
$prefix\
$cpu\
-cpu ${task.cpus} \
-host \
$bwaMemOptions\
$pairedFiles\
Expand All @@ -68,6 +69,8 @@ process hostRemoval {
//merge cleaned FASTQ files into files cleaned of ALL reads mapping to ANY provided host reference
process collectCleanPairedReads {
label "hostRemoval"
label "small"

publishDir(
path: "${settings["outDir"]}/HostRemoval",
mode: 'copy'
Expand All @@ -94,6 +97,8 @@ process collectCleanPairedReads {

process collectCleanPairedReadsOneHost {
label "hostRemoval"
label "small"

publishDir(
path: "${settings["outDir"]}/HostRemoval",
mode: 'copy'
Expand All @@ -116,6 +121,8 @@ process collectCleanPairedReadsOneHost {
//Concatenate leftover unpaired reads that didn't map to a host reference, and remove any name duplicates (i.e., leftovers appearing in multiple cleanings)
process collectCleanSingleReads {
label "hostRemoval"
label "small"

publishDir(
path: "${settings["outDir"]}/HostRemoval",
mode: 'copy'
Expand All @@ -137,6 +144,8 @@ process collectCleanSingleReads {

process hostRemovalStats {
label "hostRemoval"
label "small"

publishDir "${settings["outDir"]}/HostRemoval", mode: 'copy'

input:
Expand Down
26 changes: 20 additions & 6 deletions workflows/Nextflow/modules/runAssembly/runAssembly.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//main process for assembly with IDBA
process idbaUD {
label "assembly"
label "medium"
publishDir (
path:"${settings["outDir"]}/AssemblyBasedAnalysis",
mode: 'copy',
Expand Down Expand Up @@ -64,7 +65,7 @@ process idbaUD {

memLimit = settings["memLimit"] != null ? "ulimit -v ${settings["memLimit"]} 2>/dev/null;" : ""
"""
${memLimit}idba_ud --pre_correction -o . --num_threads ${settings["cpus"]}\
${memLimit}idba_ud --pre_correction -o . --num_threads ${task.cpus}\
$runFlag\
$longReadsFile\
$maxK_option\
Expand All @@ -80,6 +81,7 @@ process idbaUD {
//prep for idba
process idbaExtractLong {
label "assembly"
label "small"

input:
path paired
Expand All @@ -104,6 +106,8 @@ process idbaExtractLong {
//prep for idba
process idbaPrepReads {
label "assembly"
label "small"

input:
path paired
path unpaired
Expand All @@ -127,6 +131,7 @@ process idbaPrepReads {
//assemble using spades
process spades {
label "assembly"
label "medium"

publishDir (
path: "${settings["outDir"]}/AssemblyBasedAnalysis",
Expand Down Expand Up @@ -191,7 +196,7 @@ process spades {
def memLimit = settings["memLimit"] != null ? "-m ${settings["memLimit"]}" : ""

"""
spades.py -o . -t ${settings["cpus"]}\
spades.py -o . -t ${task.cpus}\
$paired\
$meta_flag\
$sc_flag\
Expand All @@ -211,8 +216,9 @@ process spades {

//assemble using megahit
process megahit {

label "assembly"
label "medium"

publishDir(
path: "${settings["outDir"]}/AssemblyBasedAnalysis",
mode: 'copy',
Expand Down Expand Up @@ -254,7 +260,7 @@ process megahit {
def megahit_preset = settings["megahit"]["preset"] != null ? "--presets ${settings["megahit"]["preset"]} " : ""

"""
megahit -o ./megahit -t ${settings["cpus"]}\
megahit -o ./megahit -t ${task.cpus}\
$megahit_preset\
$paired\
$unpaired\
Expand All @@ -271,6 +277,8 @@ process megahit {
//assembly using unicycler
process unicycler {
label "assembly"
label "medium"

publishDir (
path: "${settings["outDir"]}/AssemblyBasedAnalysis",
mode: 'copy',
Expand Down Expand Up @@ -316,7 +324,7 @@ process unicycler {
"""
export _JAVA_OPTIONS='-Xmx20G'; export TERM='xterm';

unicycler -t ${settings["cpus"]} -o .\
unicycler -t ${task.cpus} -o .\
$paired\
$filt_lr\
$bridge 2>&1 1>/dev/null
Expand All @@ -327,6 +335,7 @@ process unicycler {
//filter long reads for unicycler
process unicyclerPrep {
label "assembly"
label "small"

input:
val settings
Expand All @@ -349,6 +358,7 @@ process unicyclerPrep {
//assembly using lrasm
process lrasm {
label "assembly"
label "medium"

publishDir (
path: "${settings["outDir"]}/AssemblyBasedAnalysis",
Expand Down Expand Up @@ -414,7 +424,7 @@ process lrasm {
def flyeOpt = settings["lrasm"]["algorithm"] == "metaflye" ? "--fo '--meta' ": ""

"""
lrasm -o . -t ${settings["cpus"]} \
lrasm -o . -t ${task.cpus} \
$preset\
$consensus\
$errorCorrection\
Expand All @@ -427,6 +437,8 @@ process lrasm {

process renameFilterFasta {
label "assembly"
label "small"

publishDir(
path: "${settings["outDir"]}/AssemblyBasedAnalysis",
mode: 'copy'
Expand Down Expand Up @@ -458,6 +470,8 @@ process renameFilterFasta {

process bestIncompleteAssembly {
label "assembly"
label "small"

input:

val x
Expand Down
6 changes: 5 additions & 1 deletion workflows/Nextflow/modules/runFaQCs/runFaQCs.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//double-checks that any provided adapter file is in FASTA format
process adapterFileCheck {
label "qc"
label "small"

input:
path adapterFile

Expand All @@ -18,6 +20,8 @@ process adapterFileCheck {
//main QC process. puts parameters together and runs FaQCs.
process qc {
label "qc"
label "medium"

publishDir(
path: "${settings["outDir"]}/QcReads",
mode: 'copy'
Expand Down Expand Up @@ -61,7 +65,7 @@ process qc {
$qcSoftware $inputArg \
-q ${settings["trimQual"]} --min_L $min --avg_q ${settings["avgQual"]} \
-n ${settings["numN"]} --lc ${settings["filtLC"]} --5end ${settings["trim5end"]} --3end ${settings["trim3end"]} \
--split_size 1000000 -d . -t ${settings["cpus"]} \
--split_size 1000000 -d . -t ${task.cpus} \
$polyA \
$adapterArg \
$phiX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

process validationAlignment {
label 'r2c'
label "medium"

publishDir(
path: "${settings["outDir"]}/AssemblyBasedAnalysis/readsMappingToContig",
mode: 'copy'
Expand All @@ -25,7 +27,6 @@ process validationAlignment {
def paired = paired.name != "NO_FILE" ? "-p \'${paired[0]} ${paired[1]}\' " : ""
def unpaired = unpaired.name != "NO_FILE2" ? "-u $unpaired " : ""
def cutoff = settings["useAssembledContigs"] ? "-c 0 " : "-c 0.1 "
def cpu = settings["cpus"] != null ? "-cpu ${settings["cpus"]} " : ""
def max_clip = settings["r2g_max_clip"] != null ? "-max_clip ${settings["r2g_max_clip"]} " : ""


Expand Down Expand Up @@ -67,7 +68,7 @@ process validationAlignment {
"""
runReadsToContig.pl \
$cutoff\
$cpu\
-cpu ${task.cpus}\
$paired\
$unpaired\
-d . -pre $outPrefix\
Expand All @@ -83,6 +84,8 @@ process validationAlignment {

process makeCoverageTable {
label 'r2c'
label "small"

publishDir(
path: "${settings["outDir"]}/AssemblyBasedAnalysis/readsMappingToContig",
mode: 'copy',
Expand Down Expand Up @@ -116,6 +119,8 @@ process makeCoverageTable {

process extractUnmapped {
label 'r2c'
label "small"

publishDir(
path:"${settings["outDir"]}/AssemblyBasedAnalysis/readsMappingToContig/",
mode: 'copy',
Expand Down
2 changes: 2 additions & 0 deletions workflows/Nextflow/modules/sra2fastq/sra2fastq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

process sraDownload {
label "sra2fastq"
label "small"

tag "$accession"
publishDir "${settings["outDir"]}/SRA_Download", mode: 'copy'

Expand Down
51 changes: 41 additions & 10 deletions workflows/Nextflow/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,43 @@ params {

}

//container settings
apptainer {
enabled = true
pullTimeout = "1 hour"
runOptions = "--compat"
}

executor {
//which executor to use.
//for SLURM job scheduling, replace 'local' with 'slurm'
name = "local"

//controls name of jobs submitted to cluster executor
jobName = {"job_name_$task.name"}

//which containers to use for which processes
//submission rate limit: needed for sra2fastq to operate correctly
submitRateLimit = '1/5sec'
}
process {

//options to provide for all processes submitted as cluster jobs (e.g. "--account xx")
//do not use to specify cpu or memory requirements, those are handled below
clusterOptions = ""

//resource requirements for processes
withLabel: 'small' {
cpus = 4
memory = '8 GB'
}
withLabel: 'medium' {
cpus = 8
memory= '16 GB'
}
withLabel: 'large' {
cpus = 16
memory = '32 GB'
}
withLabel: 'largest' {
cpus = 16
memory = '64 GB'
}

//which containers to use for which processes
withLabel: 'sra2fastq' {
container = 'kaijli/sra2fastq:1.6.3'
}
Expand All @@ -134,13 +161,17 @@ process {
withLabel: 'r2c' {
container = 'apwat/run_r2c:1.6'
}

}

//submission rate limit: needed for sra2fastq to operate correctly
executor {
submitRateLimit = '1/5sec'
//container runtime settings
apptainer {
enabled = true
pullTimeout = "1 hour"
runOptions = "--compat"
}


//cleanup
cleanup = false

Loading