diff --git a/lib/Utils.groovy b/lib/Utils.groovy index 37c6bed1..5390259c 100644 --- a/lib/Utils.groovy +++ b/lib/Utils.groovy @@ -31,6 +31,11 @@ class Utils { } } + static String getDockerNetwork(){ + return " --net=host "; + } + + static String getCreateDatabaseDirCommand(db){ return "if [ ! -z " + db + " ]; then mkdir " + db + " -p; fi" } diff --git a/modules/annotation/module.nf b/modules/annotation/module.nf index 2120839c..d398aad2 100644 --- a/modules/annotation/module.nf +++ b/modules/annotation/module.nf @@ -59,7 +59,7 @@ process pMMseqs2 { // Another mount flag is used to get a key file (aws format) into the docker-container. // This file is then used by s5cmd. The necessary mount points are generated by “constructParametersObject()”. - containerOptions constructParametersObject("mmseqs2") + " --entrypoint='' " + containerOptions constructParametersObject("mmseqs2") + " --entrypoint='' " + Utils.getDockerNetwork() tag "Sample: $sample, Database: $dbType" @@ -104,7 +104,7 @@ process pMMseqs2_taxonomy { // Therefore this place has to be mounted to the docker container to be accessible during run time. // Another mount flag is used to get a key file (aws format) into the docker-container. // This file is then used by s5cmd. The necessary mount points are generated by “constructParametersObject()”. - containerOptions constructParametersObject("mmseqs2_taxonomy") + " --entrypoint='' " + containerOptions constructParametersObject("mmseqs2_taxonomy") + " --entrypoint='' " + Utils.getDockerNetwork() tag "Sample: $sample, Database_taxonomy: $dbType" @@ -148,7 +148,7 @@ process pResistanceGeneIdentifier { container "${params.rgi_image}" - containerOptions Utils.getDockerMount(params?.steps?.annotation?.rgi?.database, params) + containerOptions Utils.getDockerMount(params?.steps?.annotation?.rgi?.database, params) + Utils.getDockerNetwork() tag "Sample: $sample, BinID: $binID" @@ -296,7 +296,7 @@ process pHmmSearch { // Re-Use the gtdb-tk container for Prodigal to safe space container "${params.gtdbtk_image}" - containerOptions Utils.getDockerMount(params?.steps?.binning?.magscot?.hmmSearch?.database, params) + containerOptions Utils.getDockerMount(params?.steps?.binning?.magscot?.hmmSearch?.database, params) + Utils.getDockerNetwork() tag "Sample: $sample" @@ -370,7 +370,8 @@ process pKEGGFromMMseqs2 { // Another mount flag is used to get a key file (aws format) into the docker-container. // This file is then used by s5cmd. - containerOptions Utils.getDockerMount(params.steps?.annotation?.keggFromMMseqs2?.database, params) + containerOptions Utils.getDockerMount(params.steps?.annotation?.keggFromMMseqs2?.database, params) + Utils.getDockerNetwork() + publishDir params.output, mode: "${params.publishDirMode}", saveAs: { filename -> getOutput("${sample}", params.runid, "keggFromMMseqs2", filename) }, \ pattern: "{**.tsv}" diff --git a/modules/fragmentRecruitment/mashScreen.nf b/modules/fragmentRecruitment/mashScreen.nf index e2f19ceb..990006b7 100644 --- a/modules/fragmentRecruitment/mashScreen.nf +++ b/modules/fragmentRecruitment/mashScreen.nf @@ -38,6 +38,8 @@ process pMashScreen { container "${params.mash_image}" + containerOptions Utils.getDockerNetwork() + when params?.steps?.fragmentRecruitment?.mashScreen != null input: diff --git a/modules/magAttributes/module.nf b/modules/magAttributes/module.nf index 4860eb1f..fd5da698 100644 --- a/modules/magAttributes/module.nf +++ b/modules/magAttributes/module.nf @@ -49,7 +49,7 @@ process pCheckM { when params.steps.containsKey("magAttributes") && params.steps.magAttributes.containsKey("checkm") \ && !params.steps.magAttributes.containsKey("checkm2") - containerOptions Utils.getDockerMount(params.steps?.magAttributes?.checkm?.database, params) + containerOptions Utils.getDockerMount(params.steps?.magAttributes?.checkm?.database, params) + Utils.getDockerNetwork() beforeScript Utils.getCreateDatabaseDirCommand("${params.polished.databases}") @@ -88,7 +88,7 @@ process pCheckM2 { when params.steps.containsKey("magAttributes") && params.steps.magAttributes.containsKey("checkm2") - containerOptions Utils.getDockerMount(params.steps?.magAttributes?.checkm2?.database, params) + containerOptions Utils.getDockerMount(params.steps?.magAttributes?.checkm2?.database, params) + Utils.getDockerNetwork() beforeScript "mkdir -p ${params.polished.databases}" @@ -128,7 +128,7 @@ process pGtdbtk { when params.steps.containsKey("magAttributes") && params.steps.magAttributes.containsKey("gtdb") - containerOptions Utils.getDockerMount(params?.steps?.magAttributes?.gtdb?.database, params) + containerOptions Utils.getDockerMount(params?.steps?.magAttributes?.gtdb?.database, params) + Utils.getDockerNetwork() beforeScript Utils.getCreateDatabaseDirCommand("${params.polished.databases}") diff --git a/modules/plasmids/module.nf b/modules/plasmids/module.nf index 83c3b59c..c89f7cd3 100644 --- a/modules/plasmids/module.nf +++ b/modules/plasmids/module.nf @@ -69,7 +69,7 @@ process pPLSDB { saveAs: { filename -> getOutput("${sample}", params.runid, "PLSDB", filename) }, \ pattern: "{**.tsv}" - containerOptions Utils.getDockerMount(params.steps?.plasmid?.PLSDB?.database, params) + containerOptions Utils.getDockerMount(params.steps?.plasmid?.PLSDB?.database, params) + Utils.getDockerNetwork() when params.steps.containsKey("plasmid") && params.steps.plasmid.containsKey("PLSDB") diff --git a/modules/plasmids/processes.nf b/modules/plasmids/processes.nf index 35ad570f..a65da663 100644 --- a/modules/plasmids/processes.nf +++ b/modules/plasmids/processes.nf @@ -24,7 +24,7 @@ process pViralVerifyPlasmid { shell = ['/bin/bash'] - containerOptions Utils.getDockerMount(params?.steps?.plasmid?.ViralVerifyPlasmid?.database, params) + containerOptions Utils.getDockerMount(params?.steps?.plasmid?.ViralVerifyPlasmid?.database, params) + Utils.getDockerNetwork() container "${params.viralVerify_image}" @@ -121,7 +121,7 @@ process pMobTyper { beforeScript Utils.getCreateDatabaseDirCommand("${params.polished.databases}") - containerOptions Utils.getDockerMount(params.steps?.plasmid?.MobTyper?.database, params) + containerOptions Utils.getDockerMount(params.steps?.plasmid?.MobTyper?.database, params) + Utils.getDockerNetwork() secret { "${S3_MobTyper_ACCESS}"!="" ? ["S3_MobTyper_ACCESS", "S3_MobTyper_SECRET"] : [] } @@ -183,7 +183,7 @@ process pPlaton { tag "Sample: $sample, BinId: $binID" - containerOptions " --user root:root " + Utils.getDockerMount(params.steps?.plasmid?.Platon?.database, params) + containerOptions " --user root:root " + Utils.getDockerMount(params.steps?.plasmid?.Platon?.database, params) + Utils.getDockerNetwork() publishDir params.output, mode: "${params.publishDirMode}", saveAs: { filename -> getOutput("${sample}", params.runid, "Platon", filename) }, \ pattern: "{**.tsv}" diff --git a/modules/qualityControl/ontQC.nf b/modules/qualityControl/ontQC.nf index 444656a4..36558908 100644 --- a/modules/qualityControl/ontQC.nf +++ b/modules/qualityControl/ontQC.nf @@ -59,6 +59,8 @@ process pPorechopDownload { container "${params.porechop_image}" + containerOptions Utils.getDockerNetwork() + input: tuple val(sample), env(readUrl) diff --git a/modules/qualityControl/shortReadQC.nf b/modules/qualityControl/shortReadQC.nf index ab5db308..809f5ea1 100644 --- a/modules/qualityControl/shortReadQC.nf +++ b/modules/qualityControl/shortReadQC.nf @@ -204,6 +204,8 @@ process pFastpSplitDownload { container "${params.fastp_image}" + containerOptions Utils.getDockerNetwork() + input: tuple val(sample), env(read1Url), env(read2Url)