-
Notifications
You must be signed in to change notification settings - Fork 717
/
Copy pathdeseq2_qc.nf
62 lines (53 loc) · 3.04 KB
/
deseq2_qc.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
params.multiqc_label = ''
def options = initOptions(params.options)
process DESEQ2_QC {
label "process_medium"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') }
// (Bio)conda packages have intentionally not been pinned to a specific version
// This was to avoid the pipeline failing due to package conflicts whilst creating the environment when using -profile conda
conda (params.enable_conda ? "conda-forge::r-base=4.0 bioconda::bioconductor-deseq2=1.28.0 bioconda::bioconductor-biocparallel bioconda::bioconductor-tximport bioconda::bioconductor-complexheatmap conda-forge::r-optparse conda-forge::r-ggplot2 conda-forge::r-rcolorbrewer conda-forge::r-pheatmap" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/mulled-v2-8849acf39a43cdd6c839a369a74c0adc823e2f91:ab110436faf952a33575c64dd74615a84011450b-0"
} else {
container "quay.io/biocontainers/mulled-v2-8849acf39a43cdd6c839a369a74c0adc823e2f91:ab110436faf952a33575c64dd74615a84011450b-0"
}
input:
path counts
path pca_header_multiqc
path clustering_header_multiqc
output:
path "*.pdf" , optional:true, emit: pdf
path "*.RData" , optional:true, emit: rdata
path "*pca.vals.txt" , optional:true, emit: pca_txt
path "*pca.vals_mqc.tsv" , optional:true, emit: pca_multiqc
path "*sample.dists.txt" , optional:true, emit: dists_txt
path "*sample.dists_mqc.tsv", optional:true, emit: dists_multiqc
path "*.log" , optional:true, emit: log
path "size_factors" , optional:true, emit: size_factors
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def label_lower = params.multiqc_label.toLowerCase()
def label_upper = params.multiqc_label.toUpperCase()
"""
deseq2_qc.r \\
--count_file $counts \\
--outdir ./ \\
--cores $task.cpus \\
$options.args
if [ -f "R_sessionInfo.log" ]; then
sed "s/deseq2_pca/${label_lower}_deseq2_pca/g" <$pca_header_multiqc >tmp.txt
sed -i -e "s/DESeq2 PCA/${label_upper} DESeq2 PCA/g" tmp.txt
cat tmp.txt *.pca.vals.txt > ${label_lower}.pca.vals_mqc.tsv
sed "s/deseq2_clustering/${label_lower}_deseq2_clustering/g" <$clustering_header_multiqc >tmp.txt
sed -i -e "s/DESeq2 sample/${label_upper} DESeq2 sample/g" tmp.txt
cat tmp.txt *.sample.dists.txt > ${label_lower}.sample.dists_mqc.tsv
fi
Rscript -e "library(DESeq2); write(x=as.character(packageVersion('DESeq2')), file='${software}.version.txt')"
"""
}