diff --git a/bin/hicpro_merge_validpairs.sh b/bin/hicpro_merge_validpairs.sh index 6d455d008ccd4c197a095ded24f956dcefa1c5bc..5f383c534753bf77b05665501453cb9d501bf2c0 100755 --- a/bin/hicpro_merge_validpairs.sh +++ b/bin/hicpro_merge_validpairs.sh @@ -25,7 +25,7 @@ if [[ ${rmDup} == 1 ]]; then else cat ${vpairs} > ${prefix}.allValidPairs fi - + echo -e -n "valid_interaction\t" > ${prefix}_allValidPairs.mergestat cat ${vpairs} | wc -l >> ${prefix}_allValidPairs.mergestat echo -e -n "valid_interaction_rmdup\t" >> ${prefix}_allValidPairs.mergestat diff --git a/bin/src/cutsite_trimming.cpp b/bin/src/cutsite_trimming.cpp index ef3fa869cd3bfe5f4e473908224cb42c2b99cbfe..d8ab26f1f522723bf34a8e16ee9cba19f7780da1 100644 --- a/bin/src/cutsite_trimming.cpp +++ b/bin/src/cutsite_trimming.cpp @@ -3,11 +3,9 @@ // Author(s): Nicolas Servant // Contact: nicolas.servant@curie.fr // This software is distributed without any guarantee under the terms of the BSD-3 licence - // g++ -std=c++0x -o cutsite_trimming cutsite_trimming.cpp //./cutsite_trimming -fastq fastq -cutsite AGCTT - #include <iostream> // std::cout #include <stdlib.h> #include <string.h> @@ -18,135 +16,131 @@ static const char* prog; static int usage(int ret=1) { - std::cerr << "usage: " << prog << " --fastq FASTQFILE --cutsite CUTSITE --out OUTFILE [--rmuntrim] \n"; - std::cerr << "usage: " << prog << " --help\n"; - return ret; + std::cerr << "usage: " << prog << " --fastq FASTQFILE --cutsite CUTSITE --out OUTFILE [--rmuntrim] \n"; + std::cerr << "usage: " << prog << " --help\n"; + return ret; } static int get_options(int argc, char* argv[], std::string& fastqFile, - std::vector<std::string>& cutSites, std::string& output, bool& rmuntrim) + std::vector<std::string>& cutSites, std::string& output, bool& rmuntrim) { - prog = argv[0]; - if (argc == 1){ - exit(usage()); - } - for (int ac = 1; ac < argc; ++ac) { - const char* opt = argv[ac]; - if (*opt == '-') { - if (!strcmp(opt, "--fastq")) { - fastqFile = std::string(argv[++ac]); - } else if (!strcmp(opt, "--cutsite")) { - - std::string cutSitesSequence; - cutSitesSequence = std::string(argv[++ac]); - size_t pos = cutSitesSequence.find(","); - size_t begin = 0; - while(pos != std::string::npos){ - cutSites.push_back(cutSitesSequence.substr(begin, pos - begin)); - begin = pos + 1; - pos = cutSitesSequence.find(",", begin + 1); - } - cutSites.push_back(cutSitesSequence.substr(begin, pos)); - + prog = argv[0]; + if (argc == 1){ + exit(usage()); + } + for (int ac = 1; ac < argc; ++ac) { + const char* opt = argv[ac]; + if (*opt == '-') { + if (!strcmp(opt, "--fastq")) { + fastqFile = std::string(argv[++ac]); + } + else if (!strcmp(opt, "--cutsite")) { + std::string cutSitesSequence; + cutSitesSequence = std::string(argv[++ac]); + size_t pos = cutSitesSequence.find(","); + size_t begin = 0; + while(pos != std::string::npos){ + cutSites.push_back(cutSitesSequence.substr(begin, pos - begin)); + begin = pos + 1; + pos = cutSitesSequence.find(",", begin + 1); + } + cutSites.push_back(cutSitesSequence.substr(begin, pos)); + } + else if (!strcmp(opt, "--out")) { + output = std::string(argv[++ac]); + } + else if (!strcmp(opt, "--rmuntrim")) { + rmuntrim = true; + } + }else { + std::cerr << prog << ": unknown option " << opt << std::endl; + return usage(); } - else if (!strcmp(opt, "--out")) { - output = std::string(argv[++ac]); - } - else if (!strcmp(opt, "--rmuntrim")) { - rmuntrim = true; - } - }else { - std::cerr << prog << ": unknown option " << opt << std::endl; - return usage(); - } - } - return 0; + } + return 0; } static int trim_fastq(std::string& fastqFile, std::vector<std::string>& cutSites, - std::string& outFile, bool& rmuntrim) -{ - - int trim_count=0; - std::string ID; - std::ifstream ifs (fastqFile); - std::ofstream ofs (outFile); - - if (ifs.is_open()){ - while (getline(ifs, ID)) { - std::string seq; - std::string dummy; - std::string qual; + std::string& outFile, bool& rmuntrim){ + int trim_count=0; + std::string ID; + std::ifstream ifs (fastqFile); + std::ofstream ofs (outFile); + + if (ifs.is_open()){ + while (getline(ifs, ID)) { + std::string seq; + std::string dummy; + std::string qual; - getline(ifs, seq); - getline(ifs, dummy); - getline(ifs, qual); - - bool find_pos = false; - size_t pos = std::string::npos; - for (std::vector<std::string>::iterator it = cutSites.begin(); it != cutSites.end(); ++it){ - size_t tmp_pos = seq.find(*it); - if (tmp_pos != std::string::npos) { - // If find_pos is alread True, there is a problem (there are two cut - // sites in the same read).) - if (find_pos == true){ - if(tmp_pos < pos) { - pos = tmp_pos; - } - } else { - find_pos = true; - pos = tmp_pos; - } - } - } + getline(ifs, seq); + getline(ifs, dummy); + getline(ifs, qual); + + bool find_pos = false; + size_t pos = std::string::npos; + for (std::vector<std::string>::iterator it = cutSites.begin(); it != cutSites.end(); ++it){ + size_t tmp_pos = seq.find(*it); + if (tmp_pos != std::string::npos) { + // If find_pos is alread True, there is a problem (there are two cut + // sites in the same read).) + if (find_pos == true){ + if(tmp_pos < pos) { + pos = tmp_pos; + } + } else { + find_pos = true; + pos = tmp_pos; + } + } + } - if (pos != std::string::npos) { - trim_count++; - ofs << ID << '\n'; - ofs << seq.substr(0, pos) << '\n'; - ofs << "+\n"; - ofs << qual.substr(0, pos) << '\n'; - } else { - if (!rmuntrim){ - ofs << ID << '\n'; - ofs << seq << '\n'; - ofs << "+\n"; - ofs << qual << '\n'; - } - } - find_pos = false; + if (pos != std::string::npos) { + trim_count++; + ofs << ID << '\n'; + ofs << seq.substr(0, pos) << '\n'; + ofs << "+\n"; + ofs << qual.substr(0, pos) << '\n'; + } else { + if (!rmuntrim){ + ofs << ID << '\n'; + ofs << seq << '\n'; + ofs << "+\n"; + ofs << qual << '\n'; + } + } + find_pos = false; + } + }else{ + std::cerr << "Error : Cannot open file : " << fastqFile; } - }else{ - std::cerr << "Error : Cannot open file : " << fastqFile; - } - return trim_count; + return trim_count; } int main(int argc, char* argv[]) { - - std::string fastqFile; - std::vector<std::string> cutSites; - std::string outFile; - bool rmuntrim = false; - - int ret = get_options(argc, argv, fastqFile, cutSites, outFile, rmuntrim); - printf("##Fastq file: %s\n", fastqFile.c_str()); - printf("##Restriction sites:\n"); - for(std::vector<std::string>::iterator it = cutSites.begin(); it != cutSites.end(); ++it){ - std::cout << *it << std::endl; - } - printf("##Output File: %s\n", outFile.c_str()); + std::string fastqFile; + std::vector<std::string> cutSites; + std::string outFile; + bool rmuntrim = false; + + int ret = get_options(argc, argv, fastqFile, cutSites, outFile, rmuntrim); + printf("##Fastq file: %s\n", fastqFile.c_str()); + printf("##Restriction sites:\n"); + for(std::vector<std::string>::iterator it = cutSites.begin(); it != cutSites.end(); ++it){ + std::cout << *it << std::endl; + } + printf("##Output File: %s\n", outFile.c_str()); - if (fastqFile.empty() || cutSites.size() == 0 || outFile.empty()){ - usage(); - exit(ret); - } + if (fastqFile.empty() || cutSites.size() == 0 || outFile.empty()){ + usage(); + exit(ret); + } - int trim_count=trim_fastq(fastqFile, cutSites, outFile, rmuntrim); - printf("\n##Trimmed reads: %d\n", trim_count); - return(0); + int trim_count=trim_fastq(fastqFile, cutSites, outFile, rmuntrim); + printf("\n##Trimmed reads: %d\n", trim_count); + return(0); } diff --git a/modules/local/cooler/makebins.nf b/modules/local/cooler/makebins.nf index 49e18db719d8e9b97738d9156b2c6dc3015df6b1..c956a6ae54b80916257a58e1d93c7a7adac98776 100644 --- a/modules/local/cooler/makebins.nf +++ b/modules/local/cooler/makebins.nf @@ -1,30 +1,30 @@ process COOLER_MAKEBINS { - tag "${cool_bin}" - label 'process_low' + tag "${cool_bin}" + label 'process_low' - conda (params.enable_conda ? "bioconda::cooler=0.8.11" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/cooler:0.8.11--pyh3252c3a_0' : - 'quay.io/biocontainers/cooler:0.8.11--pyh3252c3a_0' }" + conda (params.enable_conda ? "bioconda::cooler=0.8.11" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/cooler:0.8.11--pyh3252c3a_0' : + 'quay.io/biocontainers/cooler:0.8.11--pyh3252c3a_0' }" - input: - tuple path(chromsizes), val(cool_bin) + input: + tuple path(chromsizes), val(cool_bin) - output: - path ("*.bed") , emit: bed - path ("versions.yml"), emit: versions + output: + path ("*.bed") , emit: bed + path ("versions.yml"), emit: versions - script: - def args = task.ext.args ?: '' - """ - cooler makebins \\ - $args \\ - ${chromsizes} \\ - ${cool_bin} > cooler_bins_${cool_bin}.bed + script: + def args = task.ext.args ?: '' + """ + cooler makebins \\ + $args \\ + ${chromsizes} \\ + ${cool_bin} > cooler_bins_${cool_bin}.bed - cat <<-END_VERSIONS > versions.yml - "${task.process}": - cooler: \$(cooler --version 2>&1 | sed 's/cooler, version //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cooler: \$(cooler --version 2>&1 | sed 's/cooler, version //') + END_VERSIONS + """ } diff --git a/modules/local/cooltools/eigs-cis.nf b/modules/local/cooltools/eigs-cis.nf index b65df9a8f9b8e40dcbb3278dc238866c3c25d059..6d77a87ecd1bfc0033a936b4ab92a265f17ed877 100644 --- a/modules/local/cooltools/eigs-cis.nf +++ b/modules/local/cooltools/eigs-cis.nf @@ -3,33 +3,33 @@ */ process CALL_COMPARTMENTS { - label 'process_medium' + label 'process_medium' - conda (params.enable_conda ? "bioconda::cooltools=0.5.1 bioconda::ucsc-bedgraphtobigwig=377" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c81d8d6b6acf4714ffaae1a274527a41958443f6:cc7ea58b8cefc76bed985dcfe261cb276ed9e0cf-0' : - 'quay.io/biocontainers/mulled-v2-c81d8d6b6acf4714ffaae1a274527a41958443f6:cc7ea58b8cefc76bed985dcfe261cb276ed9e0cf-0' }" + conda (params.enable_conda ? "bioconda::cooltools=0.5.1 bioconda::ucsc-bedgraphtobigwig=377" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mulled-v2-c81d8d6b6acf4714ffaae1a274527a41958443f6:cc7ea58b8cefc76bed985dcfe261cb276ed9e0cf-0' : + 'quay.io/biocontainers/mulled-v2-c81d8d6b6acf4714ffaae1a274527a41958443f6:cc7ea58b8cefc76bed985dcfe261cb276ed9e0cf-0' }" - input: - tuple val(meta), path(cool), val(resolution) - path(fasta) - path(chrsize) + input: + tuple val(meta), path(cool), val(resolution) + path(fasta) + path(chrsize) - output: - path("*compartments*"), emit: results - path("versions.yml"), emit: versions + output: + path("*compartments*"), emit: results + path("versions.yml"), emit: versions - script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - """ - cooltools genome binnify --all-names ${chrsize} ${resolution} > genome_bins.txt - cooltools genome gc genome_bins.txt ${fasta} > genome_gc.txt - cooltools eigs-cis ${args} -o ${prefix}_compartments ${cool} + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + cooltools genome binnify --all-names ${chrsize} ${resolution} > genome_bins.txt + cooltools genome gc genome_bins.txt ${fasta} > genome_gc.txt + cooltools eigs-cis ${args} -o ${prefix}_compartments ${cool} - cat <<-END_VERSIONS > versions.yml - "${task.process}": - cooltools: \$(cooltools --version 2>&1 | sed 's/cooletools, version //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cooltools: \$(cooltools --version 2>&1 | sed 's/cooletools, version //') + END_VERSIONS + """ } diff --git a/modules/local/cooltools/insulation.nf b/modules/local/cooltools/insulation.nf index 756579a98695845a099db2d0563c503aaa046867..dc755acbc1b5bce48eb56afb65587f4772a67484 100644 --- a/modules/local/cooltools/insulation.nf +++ b/modules/local/cooltools/insulation.nf @@ -3,29 +3,29 @@ */ process INSULATION { - label 'process_medium' + label 'process_medium' - conda (params.enable_conda ? "bioconda::cooltools=0.5.1" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/cooltools:0.5.1--py37h37892f8_0' : - 'quay.io/biocontainers/cooltools:0.5.1--py37h37892f8_0' }" + conda (params.enable_conda ? "bioconda::cooltools=0.5.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/cooltools:0.5.1--py37h37892f8_0' : + 'quay.io/biocontainers/cooltools:0.5.1--py37h37892f8_0' }" - input: - tuple val(meta), path(cool) + input: + tuple val(meta), path(cool) - output: - path("*tsv"), emit:results - path("versions.yml"), emit:versions + output: + path("*tsv"), emit:results + path("versions.yml"), emit:versions - script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - """ - cooltools insulation ${cool} ${args} > ${prefix}_insulation.tsv + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + cooltools insulation ${cool} ${args} > ${prefix}_insulation.tsv - cat <<-END_VERSIONS > versions.yml - "${task.process}": - cooltools: \$(cooltools --version 2>&1 | sed 's/cooltools, version //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cooltools: \$(cooltools --version 2>&1 | sed 's/cooltools, version //') + END_VERSIONS + """ } diff --git a/modules/local/hicexplorer/hicFindTADs.nf b/modules/local/hicexplorer/hicFindTADs.nf index 2bfca6510f3b74c90de54e4a3d59f83ec8126ebe..093484c24c99f5d3c07071681c5bd3b7808df992 100644 --- a/modules/local/hicexplorer/hicFindTADs.nf +++ b/modules/local/hicexplorer/hicFindTADs.nf @@ -3,32 +3,32 @@ */ process HIC_FIND_TADS { - label 'process_medium' + label 'process_medium' - conda (params.enable_conda ? "bioconda::hicexplorer=3.7.2" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/hicexplorer:3.7.2--pyhdfd78af_1' : - 'quay.io/biocontainers/hicexplorer:3.7.2--pyhdfd78af_1' }" + conda (params.enable_conda ? "bioconda::hicexplorer=3.7.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hicexplorer:3.7.2--pyhdfd78af_1' : + 'quay.io/biocontainers/hicexplorer:3.7.2--pyhdfd78af_1' }" - input: - tuple val(meta), path(cool) + input: + tuple val(meta), path(cool) - output: - path("*hicfindtads*"), emit:results - path("versions.yml"), emit:versions + output: + path("*hicfindtads*"), emit:results + path("versions.yml"), emit:versions - script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - """ - hicFindTADs --matrix ${cool} \ - --outPrefix ${prefix}_hicfindtads \ - ${args} \ - --numberOfProcessors ${task.cpus} + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + hicFindTADs --matrix ${cool} \ + --outPrefix ${prefix}_hicfindtads \ + ${args} \ + --numberOfProcessors ${task.cpus} - cat <<-END_VERSIONS > versions.yml - "${task.process}": - hicexplorer: \$(hicFindTADs --version 2>&1 | sed 's/hicFindTADs //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hicexplorer: \$(hicFindTADs --version 2>&1 | sed 's/hicFindTADs //') + END_VERSIONS + """ } diff --git a/modules/local/hicexplorer/hicPlotDistVsCounts.nf b/modules/local/hicexplorer/hicPlotDistVsCounts.nf index ab7754f243f2a5b04d445e68134bd4d49cebe936..a426d12ea6583bcb91bf930454dc449824199ae1 100644 --- a/modules/local/hicexplorer/hicPlotDistVsCounts.nf +++ b/modules/local/hicexplorer/hicPlotDistVsCounts.nf @@ -3,31 +3,31 @@ */ process HIC_PLOT_DIST_VS_COUNTS { - label 'process_medium' + label 'process_medium' - conda (params.enable_conda ? "bioconda::hicexplorer=3.7.2" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/hicexplorer:3.7.2--pyhdfd78af_1' : - 'quay.io/biocontainers/hicexplorer:3.7.2--pyhdfd78af_1' }" + conda (params.enable_conda ? "bioconda::hicexplorer=3.7.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hicexplorer:3.7.2--pyhdfd78af_1' : + 'quay.io/biocontainers/hicexplorer:3.7.2--pyhdfd78af_1' }" - input: - tuple val(meta), path(cool) + input: + tuple val(meta), path(cool) - output: - path("*distcount*"), emit:results - path("versions.yml"), emit:versions + output: + path("*distcount*"), emit:results + path("versions.yml"), emit:versions - script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - """ - hicPlotDistVsCounts --matrices ${cool} \ - --plotFile ${prefix}_distcount.png \ - --outFileData ${prefix}_distcount.txt + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + hicPlotDistVsCounts --matrices ${cool} \ + --plotFile ${prefix}_distcount.png \ + --outFileData ${prefix}_distcount.txt - cat <<-END_VERSIONS > versions.yml - "${task.process}": - hicexplorer: \$(hicPlotDistVsCounts --version 2>&1 | sed 's/hicPlotDistVsCounts //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hicexplorer: \$(hicPlotDistVsCounts --version 2>&1 | sed 's/hicPlotDistVsCounts //') + END_VERSIONS + """ } diff --git a/modules/local/hicpro/bowtie2_merge.nf b/modules/local/hicpro/bowtie2_merge.nf index f0a35fe0ed7d62bac50546002d6f3f747f037ded..3ae9428c041228ec793f2511709df485cafb90df 100644 --- a/modules/local/hicpro/bowtie2_merge.nf +++ b/modules/local/hicpro/bowtie2_merge.nf @@ -1,48 +1,48 @@ process MERGE_BOWTIE2{ - tag "$prefix" - label 'process_medium' + tag "$prefix" + label 'process_medium' - conda (params.enable_conda ? "bioconda::samtools=1.15.1" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/samtools:1.15.1--h1170115_0' : - 'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }" + conda (params.enable_conda ? "bioconda::samtools=1.15.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/samtools:1.15.1--h1170115_0' : + 'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }" - input: - tuple val(meta), path(bam1), path(bam2) + input: + tuple val(meta), path(bam1), path(bam2) - output: - tuple val(meta), path("${prefix}_bwt2merged.bam"), emit: bam - tuple val(meta), path("${prefix}.mapstat"), emit: stats - path("versions.yml"), emit: versions + output: + tuple val(meta), path("${prefix}_bwt2merged.bam"), emit: bam + tuple val(meta), path("${prefix}.mapstat"), emit: stats + path("versions.yml"), emit: versions - script: - prefix = task.ext.prefix ?: "${meta.id}" - tag = meta.mates - """ - samtools merge -@ ${task.cpus} \\ - -f ${prefix}_bwt2merged.bam \\ - ${bam1} ${bam2} + script: + prefix = task.ext.prefix ?: "${meta.id}" + tag = meta.mates + """ + samtools merge -@ ${task.cpus} \\ + -f ${prefix}_bwt2merged.bam \\ + ${bam1} ${bam2} - samtools sort -@ ${task.cpus} -m 800M \\ - -n \\ - -o ${prefix}_bwt2merged.sorted.bam \\ - ${prefix}_bwt2merged.bam + samtools sort -@ ${task.cpus} -m 800M \\ + -n \\ + -o ${prefix}_bwt2merged.sorted.bam \\ + ${prefix}_bwt2merged.bam - mv ${prefix}_bwt2merged.sorted.bam ${prefix}_bwt2merged.bam + mv ${prefix}_bwt2merged.sorted.bam ${prefix}_bwt2merged.bam - echo "## ${prefix}" > ${prefix}.mapstat - echo -n "total_${tag}\t" >> ${prefix}.mapstat - samtools view -c ${prefix}_bwt2merged.bam >> ${prefix}.mapstat - echo -n "mapped_${tag}\t" >> ${prefix}.mapstat - samtools view -c -F 4 ${prefix}_bwt2merged.bam >> ${prefix}.mapstat - echo -n "global_${tag}\t" >> ${prefix}.mapstat - samtools view -c -F 4 ${bam1} >> ${prefix}.mapstat - echo -n "local_${tag}\t" >> ${prefix}.mapstat - samtools view -c -F 4 ${bam2} >> ${prefix}.mapstat + echo "## ${prefix}" > ${prefix}.mapstat + echo -n "total_${tag}\t" >> ${prefix}.mapstat + samtools view -c ${prefix}_bwt2merged.bam >> ${prefix}.mapstat + echo -n "mapped_${tag}\t" >> ${prefix}.mapstat + samtools view -c -F 4 ${prefix}_bwt2merged.bam >> ${prefix}.mapstat + echo -n "global_${tag}\t" >> ${prefix}.mapstat + samtools view -c -F 4 ${bam1} >> ${prefix}.mapstat + echo -n "local_${tag}\t" >> ${prefix}.mapstat + samtools view -c -F 4 ${bam2} >> ${prefix}.mapstat - cat <<-END_VERSIONS > versions.yml - "${task.process}": - samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') - END_VERSIONS + cat <<-END_VERSIONS > versions.yml + "${task.process}": + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS """ } diff --git a/modules/local/hicpro/combine_mates.nf b/modules/local/hicpro/combine_mates.nf index 322db8165e0e7a7966332059b903f32d862eba2b..e3587c1dde82bb07a52d28899698aea938d916d7 100644 --- a/modules/local/hicpro/combine_mates.nf +++ b/modules/local/hicpro/combine_mates.nf @@ -1,29 +1,29 @@ process COMBINE_MATES { - tag "$prefix" - label 'process_low' + tag "$prefix" + label 'process_low' - conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::pysam=0.19.0" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : - 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" + conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::pysam=0.19.0" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : + 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" - input: - tuple val(meta), path(bam) + input: + tuple val(meta), path(bam) - output: - tuple val(meta), path("*bwt2pairs.bam"), emit:bam - tuple val(meta), path("*.pairstat"), optional:true, emit:stats - path("versions.yml"), emit: versions + output: + tuple val(meta), path("*bwt2pairs.bam"), emit:bam + tuple val(meta), path("*.pairstat"), optional:true, emit:stats + path("versions.yml"), emit: versions - script: - prefix = task.ext.prefix ?: "${meta.id}" - def args = task.ext.args ?: '' - """ - mergeSAM.py -f ${bam[0]} -r ${bam[1]} -o ${prefix}_bwt2pairs.bam ${args} + script: + prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + """ + mergeSAM.py -f ${bam[0]} -r ${bam[1]} -o ${prefix}_bwt2pairs.bam ${args} - cat <<-END_VERSIONS > versions.yml - "${task.process}": - python: \$(echo \$(python --version 2>&1) | sed 's/Python //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(echo \$(python --version 2>&1) | sed 's/Python //') + END_VERSIONS + """ } diff --git a/modules/local/hicpro/dnase_mapping_stats.nf b/modules/local/hicpro/dnase_mapping_stats.nf index 20521034f5aa22c0654d89ca0f7a497258e89900..bf0da6fb51e20c1f0d5be37425f22f97bb956883 100644 --- a/modules/local/hicpro/dnase_mapping_stats.nf +++ b/modules/local/hicpro/dnase_mapping_stats.nf @@ -1,31 +1,31 @@ process MAPPING_STATS_DNASE { - tag "$sample = $bam" - label 'process_medium' + tag "$sample = $bam" + label 'process_medium' - conda (params.enable_conda ? "bioconda::samtools=1.15.1" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/samtools:1.15.1--h1170115_0' : - 'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }" + conda (params.enable_conda ? "bioconda::samtools=1.15.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/samtools:1.15.1--h1170115_0' : + 'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }" - input: - tuple val(meta), path(bam) + input: + tuple val(meta), path(bam) - output: - tuple val(meta), path(bam), emit:bam - tuple val(meta), path("${prefix}.mapstat"), emit:stats + output: + tuple val(meta), path(bam), emit:bam + tuple val(meta), path("${prefix}.mapstat"), emit:stats - script: - prefix = meta.id + "_" + meta.mates - tag = meta.mates - """ - echo "## ${prefix}" > ${prefix}.mapstat - echo -n "total_${tag}\t" >> ${prefix}.mapstat - samtools view -c ${bam} >> ${prefix}.mapstat - echo -n "mapped_${tag}\t" >> ${prefix}.mapstat - samtools view -c -F 4 ${bam} >> ${prefix}.mapstat - echo -n "global_${tag}\t" >> ${prefix}.mapstat - samtools view -c -F 4 ${bam} >> ${prefix}.mapstat - echo -n "local_${tag}\t0" >> ${prefix}.mapstat - """ + script: + prefix = meta.id + "_" + meta.mates + tag = meta.mates + """ + echo "## ${prefix}" > ${prefix}.mapstat + echo -n "total_${tag}\t" >> ${prefix}.mapstat + samtools view -c ${bam} >> ${prefix}.mapstat + echo -n "mapped_${tag}\t" >> ${prefix}.mapstat + samtools view -c -F 4 ${bam} >> ${prefix}.mapstat + echo -n "global_${tag}\t" >> ${prefix}.mapstat + samtools view -c -F 4 ${bam} >> ${prefix}.mapstat + echo -n "local_${tag}\t0" >> ${prefix}.mapstat + """ } diff --git a/modules/local/hicpro/get_restriction_fragments.nf b/modules/local/hicpro/get_restriction_fragments.nf index c35e49cb3ccd9bb1790c43e8dfd5558adba46dce..ef56f9d342d35af4d015edf5b95a86ba313d54b5 100644 --- a/modules/local/hicpro/get_restriction_fragments.nf +++ b/modules/local/hicpro/get_restriction_fragments.nf @@ -1,27 +1,27 @@ process GET_RESTRICTION_FRAGMENTS { - tag "$res_site" - label 'process_low' + tag "$res_site" + label 'process_low' - conda (params.enable_conda ? "conda-forge::python=3.9 conda-forge::numpy=1.22.3" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : - 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" + conda (params.enable_conda ? "conda-forge::python=3.9 conda-forge::numpy=1.22.3" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : + 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" - input: - path fasta - val(res_site) + input: + path fasta + val(res_site) - output: - path "*.bed", emit: results - path("versions.yml"), emit: versions + output: + path "*.bed", emit: results + path("versions.yml"), emit: versions - script: - """ - digest_genome.py -r ${res_site} -o restriction_fragments.bed ${fasta} + script: + """ + digest_genome.py -r ${res_site} -o restriction_fragments.bed ${fasta} - cat <<-END_VERSIONS > versions.yml - "${task.process}": - python: \$(echo \$(python --version 2>&1) | sed 's/Python //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(echo \$(python --version 2>&1) | sed 's/Python //') + END_VERSIONS + """ } diff --git a/modules/local/hicpro/get_valid_interaction.nf b/modules/local/hicpro/get_valid_interaction.nf index 399a9ec7319f72c5e6a953ce1c6d39883d577462..a2bfb84988072d2dd638a624c53d07e636103a49 100644 --- a/modules/local/hicpro/get_valid_interaction.nf +++ b/modules/local/hicpro/get_valid_interaction.nf @@ -1,37 +1,37 @@ process GET_VALID_INTERACTION { - tag "$meta.id" - label 'process_low' + tag "$meta.id" + label 'process_low' - conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::pysam=0.19.0 bioconda::bx-python=0.8.13" : null) + conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::pysam=0.19.0 bioconda::bx-python=0.8.13" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : - 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" + 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : + 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" - input: - tuple val(meta), path(bam) - path(resfrag) + input: + tuple val(meta), path(bam) + path(resfrag) - output: - tuple val(meta), path("*.validPairs"), emit:valid_pairs - tuple val(meta), path("*.DEPairs"), optional:true, emit:de_pairs - tuple val(meta), path("*.SCPairs"), optional: true, emit:sc_pairs - tuple val(meta), path("*.REPairs"), optional: true, emit:re_pairs - tuple val(meta), path("*.FiltPairs"), optional: true, emit:filt_pairs - tuple val(meta), path("*RSstat"), optional: true, emit:stats - path("versions.yml"), emit: versions + output: + tuple val(meta), path("*.validPairs"), emit:valid_pairs + tuple val(meta), path("*.DEPairs"), optional:true, emit:de_pairs + tuple val(meta), path("*.SCPairs"), optional: true, emit:sc_pairs + tuple val(meta), path("*.REPairs"), optional: true, emit:re_pairs + tuple val(meta), path("*.FiltPairs"), optional: true, emit:filt_pairs + tuple val(meta), path("*RSstat"), optional: true, emit:stats + path("versions.yml"), emit: versions - script: - def args = task.ext.args ?: '' - """ - mapped_2hic_fragments.py \\ - -f ${resfrag} \\ - -r ${bam} \\ - --all \\ - ${args} + script: + def args = task.ext.args ?: '' + """ + mapped_2hic_fragments.py \\ + -f ${resfrag} \\ + -r ${bam} \\ + --all \\ + ${args} - cat <<-END_VERSIONS > versions.yml - "${task.process}": - python: \$(echo \$(python --version 2>&1) | sed 's/Python //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(echo \$(python --version 2>&1) | sed 's/Python //') + END_VERSIONS + """ } diff --git a/modules/local/hicpro/get_valid_interaction_dnase.nf b/modules/local/hicpro/get_valid_interaction_dnase.nf index dd5b061370c8201149a336e0195e3a429a6ff789..983b85875c169be3351bd1ac3f984795713038ea 100644 --- a/modules/local/hicpro/get_valid_interaction_dnase.nf +++ b/modules/local/hicpro/get_valid_interaction_dnase.nf @@ -1,30 +1,30 @@ process GET_VALID_INTERACTION_DNASE { - tag "$meta.id" - label 'process_low' + tag "$meta.id" + label 'process_low' - conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::pysam=0.19.0 bioconda::bx-python=0.8.13" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : - 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" + conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::pysam=0.19.0 bioconda::bx-python=0.8.13" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : + 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" - input: - tuple val(meta), path(bam) + input: + tuple val(meta), path(bam) - output: - tuple val(meta), path("*.validPairs"), emit:valid_pairs - tuple val(meta), path("*RSstat"), optional: true, emit:stats - path("versions.yml"), emit: versions + output: + tuple val(meta), path("*.validPairs"), emit:valid_pairs + tuple val(meta), path("*RSstat"), optional: true, emit:stats + path("versions.yml"), emit: versions - script: - def args = task.ext.args ?: '' - """ - mapped_2hic_dnase.py \\ - -r ${bam} \\ - ${args} + script: + def args = task.ext.args ?: '' + """ + mapped_2hic_dnase.py \\ + -r ${bam} \\ + ${args} - cat <<-END_VERSIONS > versions.yml - "${task.process}": - python: \$(echo \$(python --version 2>&1) | sed 's/Python //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(echo \$(python --version 2>&1) | sed 's/Python //') + END_VERSIONS + """ } diff --git a/modules/local/hicpro/hicpro2pairs.nf b/modules/local/hicpro/hicpro2pairs.nf index 305bc8713667048d79b76342b2071068c421994a..ddab40eefca7044436c2abc67898d4e9d354686b 100644 --- a/modules/local/hicpro/hicpro2pairs.nf +++ b/modules/local/hicpro/hicpro2pairs.nf @@ -1,31 +1,31 @@ process HICPRO2PAIRS { - tag "$meta.id" - label 'process_medium' + tag "$meta.id" + label 'process_medium' - conda (params.enable_conda ? "bioconda::pairix=0.3.7" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/pairix:0.3.7--py36h30a8e3e_3' : - 'quay.io/biocontainers/pairix:0.3.7--py36h30a8e3e_3' }" + conda (params.enable_conda ? "bioconda::pairix=0.3.7" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pairix:0.3.7--py36h30a8e3e_3' : + 'quay.io/biocontainers/pairix:0.3.7--py36h30a8e3e_3' }" - input: - tuple val(meta), path(vpairs) - path chrsize + input: + tuple val(meta), path(vpairs) + path chrsize - output: - tuple val(meta), path("*.pairs.gz"), path("*.pairs.gz.px2"), emit: pairs - path("versions.yml"), emit: versions + output: + tuple val(meta), path("*.pairs.gz"), path("*.pairs.gz.px2"), emit: pairs + path("versions.yml"), emit: versions - script: - prefix = "${meta.id}" - """ - ##columns: readID chr1 pos1 chr2 pos2 strand1 strand2 - awk '{OFS="\t";print \$1,\$2,\$3,\$5,\$6,\$4,\$7}' $vpairs > ${prefix}_contacts.pairs - sort -k2,2 -k4,4 -k3,3n -k5,5n ${prefix}_contacts.pairs | bgzip -c > ${prefix}_contacts.pairs.gz - pairix -f ${prefix}_contacts.pairs.gz + script: + prefix = "${meta.id}" + """ + ##columns: readID chr1 pos1 chr2 pos2 strand1 strand2 + awk '{OFS="\t";print \$1,\$2,\$3,\$5,\$6,\$4,\$7}' $vpairs > ${prefix}_contacts.pairs + sort -k2,2 -k4,4 -k3,3n -k5,5n ${prefix}_contacts.pairs | bgzip -c > ${prefix}_contacts.pairs.gz + pairix -f ${prefix}_contacts.pairs.gz - cat <<-END_VERSIONS > versions.yml - "${task.process}": - pairix: \$(echo \$(pairix 2>&1 | grep Version | sed -e 's/Version: //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pairix: \$(echo \$(pairix 2>&1 | grep Version | sed -e 's/Version: //') + END_VERSIONS + """ } diff --git a/modules/local/hicpro/merge_stats.nf b/modules/local/hicpro/merge_stats.nf index 61f3fe2d99594da4c9e0062a34780746bd43ce02..c6cb940759e1bb48416614d2c6f3115865bd782a 100644 --- a/modules/local/hicpro/merge_stats.nf +++ b/modules/local/hicpro/merge_stats.nf @@ -1,31 +1,31 @@ process MERGE_STATS { - label 'process_low' + label 'process_low' - conda (params.enable_conda ? "conda-forge::python=3.9" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : - 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" + conda (params.enable_conda ? "conda-forge::python=3.9" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : + 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" - input: - tuple val(meta), path(fstat) + input: + tuple val(meta), path(fstat) - output: - path("${meta.id}/"), emit: mqc - path("*.{mmapstat,mpairstat,mRSstat}"), emit: stats - path("versions.yml"), emit:versions + output: + path("${meta.id}/"), emit: mqc + path("*.{mmapstat,mpairstat,mRSstat}"), emit: stats + path("versions.yml"), emit:versions - script: - if ( (fstat =~ /.mapstat/) ){ ext = "${meta.mates}.mmapstat" } - if ( (fstat =~ /.pairstat/) ){ ext = "mpairstat" } - if ( (fstat =~ /.RSstat/) ){ ext = "mRSstat" } - """ - mkdir -p ${meta.id} - merge_statfiles.py -f ${fstat} > ${meta.id}.${ext} - cp *${ext} ${meta.id}/ + script: + if ( (fstat =~ /.mapstat/) ){ ext = "${meta.mates}.mmapstat" } + if ( (fstat =~ /.pairstat/) ){ ext = "mpairstat" } + if ( (fstat =~ /.RSstat/) ){ ext = "mRSstat" } + """ + mkdir -p ${meta.id} + merge_statfiles.py -f ${fstat} > ${meta.id}.${ext} + cp *${ext} ${meta.id}/ - cat <<-END_VERSIONS > versions.yml - "${task.process}": - python: \$(echo \$(python --version 2>&1) | sed 's/Python //') - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(echo \$(python --version 2>&1) | sed 's/Python //') + END_VERSIONS + """ } diff --git a/modules/local/hicpro/merge_valid_interaction.nf b/modules/local/hicpro/merge_valid_interaction.nf index 2ea31823cdb906e178ef9cb79f3959b0848ba8a1..371600c8ff4de2591adb92327d82ba9960e63a9b 100644 --- a/modules/local/hicpro/merge_valid_interaction.nf +++ b/modules/local/hicpro/merge_valid_interaction.nf @@ -1,34 +1,34 @@ process MERGE_VALID_INTERACTION { - tag "$prefix" - label 'process_highmem' + tag "$prefix" + label 'process_highmem' - conda (params.enable_conda ? "conda-forge::gawk=5.1.0" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : - 'ubuntu:20.04' }" + conda (params.enable_conda ? "conda-forge::gawk=5.1.0" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : + 'ubuntu:20.04' }" - input: - tuple val(meta), path(vpairs) + input: + tuple val(meta), path(vpairs) - output: - tuple val(meta), path("*.allValidPairs"), emit: valid_pairs - path("${meta.id}/"), emit:mqc - path("*mergestat"), emit:stats - path("versions.yml"), emit: versions + output: + tuple val(meta), path("*.allValidPairs"), emit: valid_pairs + path("${meta.id}/"), emit:mqc + path("*mergestat"), emit:stats + path("versions.yml"), emit: versions - script: - prefix = meta.id - def args = task.ext.args ?: '' - """ - hicpro_merge_validpairs.sh ${args} -p ${prefix} ${vpairs} + script: + prefix = meta.id + def args = task.ext.args ?: '' + """ + hicpro_merge_validpairs.sh ${args} -p ${prefix} ${vpairs} - ## For MultiQC - mkdir -p ${prefix} - cp ${prefix}_allValidPairs.mergestat ${prefix}/ + ## For MultiQC + mkdir -p ${prefix} + cp ${prefix}_allValidPairs.mergestat ${prefix}/ - cat <<-END_VERSIONS > versions.yml - "${task.process}": - sort: \$(echo \$(sort --version 2>&1 | head -1 | awk '{print \$NF}' 2>&1)) - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sort: \$(echo \$(sort --version 2>&1 | head -1 | awk '{print \$NF}' 2>&1)) + END_VERSIONS + """ } diff --git a/modules/local/hicpro/run_ice.nf b/modules/local/hicpro/run_ice.nf index 8fc35ec67debd6312a0f03777e25008a55a7d88c..466cd6b12e6daa9bf632a985586405c4991775e3 100644 --- a/modules/local/hicpro/run_ice.nf +++ b/modules/local/hicpro/run_ice.nf @@ -1,32 +1,32 @@ process ICE_NORMALIZATION{ - tag "$rmaps" - label 'process_highmem' + tag "$rmaps" + label 'process_highmem' - conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::iced=0.5.10 conda-forge::numpy=1.22.3" : null) + conda (params.enable_conda ? "conda-forge::python=3.9 bioconda::iced=0.5.10 conda-forge::numpy=1.22.3" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : - 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" + 'https://depot.galaxyproject.org/singularity/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0' : + 'quay.io/biocontainers/mulled-v2-c6ff206325681cbb9c9ef890bb8de554172c0483:713df51cd897ceb893b9a6e6420f527d83c2ed95-0'}" - input: - tuple val(meta), val(res), path(rmaps), path(bed) + input: + tuple val(meta), val(res), path(rmaps), path(bed) - output: - tuple val(meta), val(res), path("*iced.matrix"), path(bed), emit:maps - path ("*.biases"), emit:bias - path("versions.yml"), emit: versions + output: + tuple val(meta), val(res), path("*iced.matrix"), path(bed), emit:maps + path ("*.biases"), emit:bias + path("versions.yml"), emit: versions - script: - prefix = rmaps.toString() - ~/(\.matrix)?$/ - """ - ice --filter_low_counts_perc ${params.ice_filter_low_count_perc} \ - --results_filename ${prefix}_iced.matrix \ - --filter_high_counts_perc ${params.ice_filter_high_count_perc} \ - --max_iter ${params.ice_max_iter} --eps ${params.ice_eps} --remove-all-zeros-loci --output-bias 1 --verbose 1 ${rmaps} + script: + prefix = rmaps.toString() - ~/(\.matrix)?$/ + """ + ice --filter_low_counts_perc ${params.ice_filter_low_count_perc} \ + --results_filename ${prefix}_iced.matrix \ + --filter_high_counts_perc ${params.ice_filter_high_count_perc} \ + --max_iter ${params.ice_max_iter} --eps ${params.ice_eps} --remove-all-zeros-loci --output-bias 1 --verbose 1 ${rmaps} - cat <<-END_VERSIONS > versions.yml - "${task.process}": - python: \$(echo \$(python --version 2>&1) | sed 's/Python //') - iced: \$(python -c "import iced; print(iced.__version__)") - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(echo \$(python --version 2>&1) | sed 's/Python //') + iced: \$(python -c "import iced; print(iced.__version__)") + END_VERSIONS + """ } diff --git a/modules/local/hicpro/trim_reads.nf b/modules/local/hicpro/trim_reads.nf index 89109afebb9451ca3fde29278fb639442ce610c7..a4ba7d3307cd82a65e5c2e0dc2b4563e74bfef89 100644 --- a/modules/local/hicpro/trim_reads.nf +++ b/modules/local/hicpro/trim_reads.nf @@ -1,32 +1,32 @@ process TRIM_READS { - tag "$meta.id" - label 'process_low' + tag "$meta.id" + label 'process_low' - conda (params.enable_conda ? "conda-forge::sed=4.7" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : - 'ubuntu:20.04' }" + conda (params.enable_conda ? "conda-forge::sed=4.7" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : + 'ubuntu:20.04' }" - input: - tuple val(meta), path(reads) - val(motif) + input: + tuple val(meta), path(reads) + val(motif) - output: - tuple val(meta), path("*trimmed.fastq.gz"), emit: fastq - path("versions.yml") , emit: versions + output: + tuple val(meta), path("*trimmed.fastq.gz"), emit: fastq + path("versions.yml") , emit: versions - script: - """ - zcat ${reads} > tmp.fastq - cutsite_trimming --fastq tmp.fastq \\ - --cutsite ${motif[0]} \\ - --out ${reads.simpleName}_trimmed.fastq - gzip ${reads.simpleName}_trimmed.fastq - /bin/rm -f tmp.fastq + script: + """ + zcat ${reads} > tmp.fastq + cutsite_trimming --fastq tmp.fastq \\ + --cutsite ${motif[0]} \\ + --out ${reads.simpleName}_trimmed.fastq + gzip ${reads.simpleName}_trimmed.fastq + /bin/rm -f tmp.fastq - cat <<-END_VERSIONS > versions.yml - "${task.process}": - gzip: \$(echo \$(gzip --version 2>&1) | head -1 | cut -d" " -f2) - END_VERSIONS - """ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gzip: \$(echo \$(gzip --version 2>&1) | head -1 | cut -d" " -f2) + END_VERSIONS + """ } diff --git a/modules/local/trash/bowtie2_end_to_end.nf b/modules/local/trash/bowtie2_end_to_end.nf deleted file mode 100644 index 8391ac7452a2e152f503aa3f4b18a9c8dd79f92f..0000000000000000000000000000000000000000 --- a/modules/local/trash/bowtie2_end_to_end.nf +++ /dev/null @@ -1,45 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -process bowtie2_end_to_end { - tag "$sample" - label 'process_medium' - publishDir path: { params.save_aligned_intermediates ? "${params.outdir}/mapping/bwt2_end2end" : params.outdir }, - saveAs: { filename -> if (params.save_aligned_intermediates) filename }, mode: params.publish_dir_mode - - input: - tuple val(sample), path(reads) - path index - - output: - tuple val(sample), path("${prefix}_unmap.fastq"), emit: unmapped_end_to_end - tuple val(sample), path("${prefix}.bam"), emit: end_to_end_bam - - script: - prefix = reads.toString() - ~/(\.fq)?(\.fastq)?(\.gz)?$/ - def bwt2_opts = params.bwt2_opts_end2end - if (!params.dnase){ - """ - INDEX=`find -L ./ -name "*.rev.1.bt2" | sed 's/.rev.1.bt2//'` - bowtie2 --rg-id BMG --rg SM:${prefix} \\ - ${bwt2_opts} \\ - -p ${task.cpus} \\ - -x \${INDEX} \\ - --un ${prefix}_unmap.fastq \\ - -U ${reads} | samtools view -F 4 -bS - > ${prefix}.bam - """ - }else{ - """ - INDEX=`find -L ./ -name "*.rev.1.bt2" | sed 's/.rev.1.bt2//'` - bowtie2 --rg-id BMG --rg SM:${prefix} \\ - ${bwt2_opts} \\ - -p ${task.cpus} \\ - -x \${INDEX} \\ - --un ${prefix}_unmap.fastq \\ - -U ${reads} > ${prefix}.bam - """ - } -} diff --git a/modules/local/trash/bowtie2_on_trimmed_reads.nf b/modules/local/trash/bowtie2_on_trimmed_reads.nf deleted file mode 100644 index a7eb45895bb3ff30d181fadce055be39de4aefbd..0000000000000000000000000000000000000000 --- a/modules/local/trash/bowtie2_on_trimmed_reads.nf +++ /dev/null @@ -1,33 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -process bowtie2_on_trimmed_reads { - tag "$sample" - label 'process_medium' - publishDir path: { params.save_aligned_intermediates ? "${params.outdir}/mapping/bwt2_trimmed" : params.outdir }, - saveAs: { filename -> if (params.save_aligned_intermediates) filename }, mode: params.publish_dir_mode - - when: - !params.dnase - - input: - tuple val(sample), path(reads) - path index - - output: - tuple val(sample), path("${prefix}_trimmed.bam"), emit:trimmed_bam - - script: - prefix = reads.toString() - ~/(_trimmed)?(\.fq)?(\.fastq)?(\.gz)?$/ - """ - INDEX=`find -L ./ -name "*.rev.1.bt2" | sed 's/.rev.1.bt2//'` - bowtie2 --rg-id BMG --rg SM:${prefix} \\ - ${params.bwt2_opts_trimmed} \\ - -p ${task.cpus} \\ - -x \${INDEX} \\ - -U ${reads} | samtools view -bS - > ${prefix}_trimmed.bam - """ -} diff --git a/modules/local/trash/cooler_balance.nf b/modules/local/trash/cooler_balance.nf deleted file mode 100644 index 201f06424e74c7ce136dac8cc1a6bae9211d9f80..0000000000000000000000000000000000000000 --- a/modules/local/trash/cooler_balance.nf +++ /dev/null @@ -1,31 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -process cooler_balance { - tag "$sample - ${res}" - label 'process_medium' - - publishDir "${params.outdir}/contact_maps/", mode: 'copy', - saveAs: {filename -> filename.endsWith(".cool") ? "norm/cool/$filename" : "norm/txt/$filename"} - - when: - !params.skip_balancing - - input: - tuple val(sample), val(res), path(cool) - path chrsize - - output: - tuple val(sample), val(res), path("${sample}_${res}_norm.cool"), emit:balanced_cool_maps - path("${sample}_${res}_norm.txt"), emit:norm_txt_maps - - script: - """ - cp ${cool} ${sample}_${res}_norm.cool - cooler balance ${sample}_${res}_norm.cool -p ${task.cpus} --force - cooler dump ${sample}_${res}_norm.cool --balanced --na-rep 0 | awk '{OFS="\t"; print \$1+1,\$2+1,\$4}' > ${sample}_${res}_norm.txt - """ -} diff --git a/modules/local/trash/cooler_raw.nf b/modules/local/trash/cooler_raw.nf deleted file mode 100644 index 9bc45c5dd6aac47ed2ef92a63f42bd092f000d13..0000000000000000000000000000000000000000 --- a/modules/local/trash/cooler_raw.nf +++ /dev/null @@ -1,28 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -process cooler_raw { - tag "$sample - ${res}" - label 'process_medium' - - publishDir "${params.outdir}/contact_maps/", mode: 'copy', - saveAs: {filename -> filename.endsWith(".cool") ? "raw/cool/$filename" : "raw/txt/$filename"} - - input: - tuple val(sample), path(contacts), val(res) - path chrsize - - output: - tuple val(sample), val(res), path("*cool"), emit:raw_cool_maps - tuple path("*.bed"), path("${sample}_${res}.txt"), emit:raw_txt_maps - - script: - """ - cooler makebins ${chrsize} ${res} > ${sample}_${res}.bed - cooler cload pairs -c1 2 -p1 3 -c2 4 -p2 5 ${sample}_${res}.bed ${contacts} ${sample}_${res}.cool - cooler dump ${sample}_${res}.cool | awk '{OFS="\t"; print \$1+1,\$2+1,\$3}' > ${sample}_${res}.txt - """ -} diff --git a/modules/local/trash/cooler_zoomify.nf b/modules/local/trash/cooler_zoomify.nf deleted file mode 100644 index 1ce68d0288c64359c2a67f7ec85c55cf0a749931..0000000000000000000000000000000000000000 --- a/modules/local/trash/cooler_zoomify.nf +++ /dev/null @@ -1,28 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -process cooler_zoomify { - tag "$sample" - label 'process_medium' - publishDir "${params.outdir}/contact_maps/norm/mcool", mode: 'copy' - - when: - !params.skip_mcool - - input: - tuple val(sample), path(contacts) - path chrsize - - output: - path("*mcool"), emit:mcool_maps - - script: - """ - cooler makebins ${chrsize} ${params.res_zoomify} > bins.bed - cooler cload pairs -c1 2 -p1 3 -c2 4 -p2 5 bins.bed ${contacts} ${sample}.cool - cooler zoomify --nproc ${task.cpus} --balance ${sample}.cool - """ -} diff --git a/modules/local/trash/functions.nf b/modules/local/trash/functions.nf deleted file mode 100644 index da9da093d3f6025e328759a12adc2c1c9ede0d03..0000000000000000000000000000000000000000 --- a/modules/local/trash/functions.nf +++ /dev/null @@ -1,68 +0,0 @@ -// -// Utility functions used in nf-core DSL2 module files -// - -// -// Extract name of software tool from process name using $task.process -// -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -// -// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules -// -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.args3 = args.args3 ?: '' - options.publish_by_meta = args.publish_by_meta ?: [] - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -// -// Tidy up and join elements of a list to return a path string -// -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -// -// Function to save/publish module results -// -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_meta) { - def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta - for (key in key_list) { - if (args.meta && key instanceof String) { - def path = key - if (args.meta.containsKey(key)) { - path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] - } - path = path instanceof String ? path : '' - path_list.add(path) - } - } - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} diff --git a/modules/local/trash/get_chromsize.nf b/modules/local/trash/get_chromsize.nf deleted file mode 100644 index f6b8c8a913fdf43fe2b7fa1d4544542d57d43ebd..0000000000000000000000000000000000000000 --- a/modules/local/trash/get_chromsize.nf +++ /dev/null @@ -1,16 +0,0 @@ -process GET_CHROMSIZE { - tag "$fasta" - label 'process_low' - - input: - path fasta - - output: - path "*.size", emit: results - - script: - """ - samtools faidx ${fasta} - cut -f1,2 ${fasta}.fai > chrom.size - """ -} diff --git a/modules/local/trash/get_software_versions.nf b/modules/local/trash/get_software_versions.nf deleted file mode 100644 index 730316d59f951590334fb60a7ee3f0d29b35cd54..0000000000000000000000000000000000000000 --- a/modules/local/trash/get_software_versions.nf +++ /dev/null @@ -1,30 +0,0 @@ - -process GET_SOFTWARE_VERSIONS { - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'pipeline_info', meta:[:], publish_by_meta:[]) } - - conda (params.enable_conda ? "conda-forge::python=3.8.3" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/python:3.8.3" - } else { - container "quay.io/biocontainers/python:3.8.3" - } - - cache false - - input: - path versions - - output: - path "software_versions.tsv" , emit: tsv - path 'software_versions_mqc.yaml', emit: yaml - - script: // This script is bundled with the pipeline, in nf-core/hic/bin/ - """ - echo $workflow.manifest.version > pipeline.version.txt - echo $workflow.nextflow.version > nextflow.version.txt - multiqc --version > v_multiqc.txt - scrape_software_versions.py &> software_versions_mqc.yaml - """ -} diff --git a/modules/local/trash/makeBowtie2Index.nf b/modules/local/trash/makeBowtie2Index.nf deleted file mode 100644 index f38d951949173052c967917e11eeeba6e3f2c9f8..0000000000000000000000000000000000000000 --- a/modules/local/trash/makeBowtie2Index.nf +++ /dev/null @@ -1,41 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -process MAKE_BOWTIE2_INDEX { - tag "$fasta_base" - label 'process_highmem' - - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) } - - conda (params.enable_conda ? "bioconda::bowtie2=2.3.5" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/bowtie2:2.3.5--py37he860b03_0" - } else { - container "quay.io/biocontainers/bowtie2:2.3.5--py37he860b03_0" - } - - input: - path fasta - - output: - path "bowtie2_index", emit: bwt2_index_end2end - path "bowtie2_index", emit: bwt2_index_trim - - script: - fasta_base = fasta.toString() - ~/(\.fa)?(\.fasta)?(\.fas)?(\.fsa)?$/ - """ - mkdir bowtie2_index - bowtie2-build ${fasta} bowtie2_index/${fasta_base} - """ -} diff --git a/modules/local/trash/output_documentation.nf b/modules/local/trash/output_documentation.nf deleted file mode 100644 index 7e49c6a79cbfec9b348734c0c05d14794f5003f1..0000000000000000000000000000000000000000 --- a/modules/local/trash/output_documentation.nf +++ /dev/null @@ -1,21 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -options = initOptions(params.options) - -process output_documentation { - publishDir "${params.outdir}/pipeline_info", mode: params.publish_dir_mode - - input: - path output_docs - path images - - output: - path 'results_description.html' - - script: - """ - markdown_to_html.py $output_docs -o results_description.html - """ -} diff --git a/subworkflows/local/input_check.nf b/subworkflows/local/input_check.nf index 3e230f4378fd4d2c98ba1785cf9bea137862f214..9735a49889301692fde334da4403577bfa4313c6 100644 --- a/subworkflows/local/input_check.nf +++ b/subworkflows/local/input_check.nf @@ -70,5 +70,4 @@ def setMetaChunk(row){ map += [meta, file] } return map -} - +} \ No newline at end of file