diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf index c1d72efac168ca372471a35e4baa9ccfd96aae18..58590dd2be42c7802518307884d3371fbdfbcd94 100755 --- a/workflow/rna-seq.nf +++ b/workflow/rna-seq.nf @@ -16,12 +16,7 @@ bdbag = Channel .fromPath(params.bdbag) .ifEmpty { exit 1, "deriva cookie file for bdbag not found: ${params.bdbag}" } -Channel.from(params.repRID) - .into { - repRID_getBag - repRID_getData - repRID_trimData - } +repRID = params.repRID outDir = params.outDir logsDir = "${outDir}/Logs" @@ -34,26 +29,25 @@ derivaConfig = Channel.fromPath("${baseDir}/conf/replicate_export_config.json") */ process getBag { executor 'local' - tag "${repRID_getBag}" - publishDir "${logsDir}/getBag", mode: 'symlink', pattern: "${repRID_getBag}.getBag.err" + tag "${repRID}" + publishDir "${logsDir}/getBag", mode: 'symlink', pattern: "${repRID}.getBag.err" input: - val repRID_getBag path credential, stageAs: 'credential.json' from deriva path derivaConfig output: path ("Replicate_*.zip") into bagit - file ("${repRID_getBag}.getBag.err") + file ("${repRID}.getBag.err") script: """ - hostname >>${repRID_getBag}.getBag.err - ulimit -a >>${repRID_getBag}.getBag.err + hostname >>${repRID}.getBag.err + ulimit -a >>${repRID}.getBag.err export https_proxy=\${http_proxy} - ln -sf `readlink -e credential.json` ~/.deriva/credential.json 2>>${repRID_getBag}.getBag.err - echo "LOG: deriva credentials linked" >>${repRID_getBag}.getBag.err - deriva-download-cli dev.gudmap.org --catalog 2 ${derivaConfig} . rid=${repRID_getBag} 2>>${repRID_getBag}.getBag.err + ln -sf `readlink -e credential.json` ~/.deriva/credential.json 2>>${repRID}.getBag.err + echo "LOG: deriva credentials linked" >>${repRID}.getBag.err + deriva-download-cli dev.gudmap.org --catalog 2 ${derivaConfig} . rid=${repRID} 2>>${repRID}.getBag.err """ } @@ -61,11 +55,10 @@ process getBag { * getData: fetch study files from consortium with downloaded bdbag.zip */ process getData { - tag "${repRID_getData}" - publishDir "${logsDir}/getData", mode: 'symlink', pattern: "${repRID_getData}.getData.err" + tag "${repRID}" + publishDir "${logsDir}/getData", mode: 'symlink', pattern: "${repRID}.getData.err" input: - val repRID_getData executor 'local' path cookies, stageAs: 'deriva-cookies.txt' from bdbag path bagit @@ -75,22 +68,22 @@ process getData { file("**/File.csv") into fileMeta file("**/Experiment Settings.csv") into experimentSettingsMeta file("**/Experiment.csv") into experimentMeta - file ("${repRID_getData}.getData.err") + file ("${repRID}.getData.err") script: """ - hostname >>${repRID_getData}.getData.err - ulimit -a >>${repRID_getData}.getData.err + hostname >>${repRID}.getData.err + ulimit -a >>${repRID}.getData.err export https_proxy=\${http_proxy} - ln -sf `readlink -e deriva-cookies.txt` ~/.bdbag/deriva-cookies.txt >>${repRID_getData}.getData.err - echo "LOG: deriva cookie linked" >>${repRID_getData}.getData.err + ln -sf `readlink -e deriva-cookies.txt` ~/.bdbag/deriva-cookies.txt >>${repRID}.getData.err + echo "LOG: deriva cookie linked" >>${repRID}.getData.err replicate=\$(basename "${bagit}" | cut -d '.' -f1) - echo "LOG: \${replicate}" >>${repRID_getData}.getData.err - unzip ${bagit} 2>>${repRID_getData}.getData.err - echo "LOG: replicate bdbag unzipped" >>${repRID_getData}.getData.err - sh ${baseDir}/scripts/bdbagFetch.sh \${replicate} ${repRID_getData} 2>>${repRID_getData}.getData.err - echo "LOG: replicate bdbag fetched" >>${repRID_getData}.getData.err + echo "LOG: \${replicate}" >>${repRID}.getData.err + unzip ${bagit} 2>>${repRID}.getData.err + echo "LOG: replicate bdbag unzipped" >>${repRID}.getData.err + sh ${baseDir}/scripts/bdbagFetch.sh \${replicate} ${repRID} 2>>${repRID}.getData.err + echo "LOG: replicate bdbag fetched" >>${repRID}.getData.err """ } @@ -98,18 +91,17 @@ process getData { * trimData: trims any adapter or non-host sequences from the data */ process trimData { - tag "${repRID_trimData}" - publishDir "${logsDir}/trimData", mode: 'symlink', pattern: "\${repRID_trimData}.trimData.*" + tag "${repRID}" + publishDir "${logsDir}/trimData", mode: 'symlink', pattern: "\${repRID}.trimData.*" input: - val repRID_trimData file(fastq) from fastqs output: path ("*.fq.gz") into fastqs_trimmed val ends - file ("${repRID_trimData}.trimData.log") - file ("${repRID_trimData}.trimData.err") + file ("${repRID}.trimData.log") + file ("${repRID}.trimData.err") script: """ @@ -122,10 +114,10 @@ process trimData { if [ '${fastq[1]}' == 'null' ] then ends='se' - trim_galore --gzip -q 25 --illumina --length 35 --basename ${repRID_trimData} -j \${ncore} ${fastq[0]} 1>>${repRID_trimData}.trimData.log 2>>${repRID_trimData}.trimData.err; + trim_galore --gzip -q 25 --illumina --length 35 --basename ${repRID} -j \${ncore} ${fastq[0]} 1>>${repRID}.trimData.log 2>>${repRID}.trimData.err; else ends='pe' - trim_galore --gzip -q 25 --illumina --length 35 --paired --basename ${repRID_trimData} -j \${ncore} ${fastq[0]} ${fastq[1]} 1>>${repRID_trimData}.trimData.log 2>>${repRID_trimData}.trimData.err; + trim_galore --gzip -q 25 --illumina --length 35 --paired --basename ${repRID} -j \${ncore} ${fastq[0]} ${fastq[1]} 1>>${repRID}.trimData.log 2>>${repRID}.trimData.err; fi """ } \ No newline at end of file