From 0ada1f5217183b620768b0cf4b562063333ad32b Mon Sep 17 00:00:00 2001 From: LilyAnderssonLee Date: Thu, 9 Jan 2025 15:31:05 +0100 Subject: [PATCH] remove old local modules --- modules/local/extract_viral_taxid.nf | 44 ------------------------- modules/local/extractcentrifugereads.nf | 42 ----------------------- modules/local/extractdiamondreads.nf | 43 ------------------------ modules/local/rm_empty_fastq.nf | 27 --------------- modules/local/subset_bam.nf | 34 ------------------- 5 files changed, 190 deletions(-) delete mode 100644 modules/local/extract_viral_taxid.nf delete mode 100644 modules/local/extractcentrifugereads.nf delete mode 100644 modules/local/extractdiamondreads.nf delete mode 100644 modules/local/rm_empty_fastq.nf delete mode 100644 modules/local/subset_bam.nf diff --git a/modules/local/extract_viral_taxid.nf b/modules/local/extract_viral_taxid.nf deleted file mode 100644 index 0c4e9ac..0000000 --- a/modules/local/extract_viral_taxid.nf +++ /dev/null @@ -1,44 +0,0 @@ -process EXTRACT_VIRAL_TAXID { - - tag "$meta.id" - label 'process_low' - - conda "bioconda::seqkit=2.8.2" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/seqkit:2.8.2--h9ee0642_1': - 'biocontainers/seqkit:2.8.2--h9ee0642_1' }" - - input: - val evalue // e-vaule threshold to filter the diamond report - tuple val(meta), path(taxpasta_standardised_profile) - tuple val(meta), path(report) // classification report - - output: - tuple val(meta), path("*viral_taxids.tsv"), optional:true, emit: viral_taxid - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def prefix = task.ext.prefix ?: "${meta.id}_${meta.tool}" - - """ - if grep -qi "virus" $taxpasta_standardised_profile; then - grep -i "virus" $taxpasta_standardised_profile | cut -f 1 > taxpasta_viral_taxid.txt - if [[ "${meta.tool}" == "kraken2" || "${meta.tool}" == "centrifuge" ]]; then - awk -F'\t' '\$3 != 0 {print \$5}' ${report} > detected_taxid.txt - grep -F -w -f taxpasta_viral_taxid.txt detected_taxid.txt > ${prefix}_viral_taxids.tsv - elif [[ "${meta.tool}" == "diamond" ]]; then - awk '\$3 < ${evalue}' ${report} | cut -f 2 | uniq > detected_taxid.txt - grep -F -w -f taxpasta_viral_taxid.txt detected_taxid.txt | uniq > ${prefix}_viral_taxids.tsv - fi - else - echo "No viral taxids found." > "no_viral_taxid.txt" - fi - cat <<-END_VERSIONS > versions.yml - "${task.process}": - seqkit: \$( seqkit version | sed 's/seqkit v//' ) - END_VERSIONS - """ -} diff --git a/modules/local/extractcentrifugereads.nf b/modules/local/extractcentrifugereads.nf deleted file mode 100644 index 43c7e18..0000000 --- a/modules/local/extractcentrifugereads.nf +++ /dev/null @@ -1,42 +0,0 @@ -process EXTRACTCENTRIFUGEREADS { - - tag "$meta.id" - label 'process_low' - - conda "bioconda::seqkit=2.8.2" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/seqkit:2.8.2--h9ee0642_1': - 'biocontainers/seqkit:2.8.2--h9ee0642_1' }" - - input: - val taxid - tuple val (meta), path(results) - tuple val (meta), path(fastq) // bowtie2/align *unmapped_{1,2}.fastq.gz - - output: - tuple val(meta), path("*.fastq"), optional:true, emit: extracted_centrifuge_reads - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - """ - awk -v taxID=$taxid '\$3 == taxID && \$8 == 1 {print \$1}' $results > readID.txt - if [ "${meta.single_end}" == 'true' ]; then - seqkit grep -f readID.txt $fastq > ${prefix}_${taxid}.extracted_centrifuge_read.fastq - elif [ "${meta.single_end}" == 'false' ]; then - seqkit grep -f readID.txt ${fastq[0]} > ${prefix}_${taxid}.extracted_centrifuge_read1.fastq - seqkit grep -f readID.txt ${fastq[1]} > ${prefix}_${taxid}.extracted_centrifuge_read2.fastq - fi - - rm readID.txt - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - seqkit: \$( seqkit version | sed 's/seqkit v//' ) - END_VERSIONS - """ -} diff --git a/modules/local/extractdiamondreads.nf b/modules/local/extractdiamondreads.nf deleted file mode 100644 index 337be8b..0000000 --- a/modules/local/extractdiamondreads.nf +++ /dev/null @@ -1,43 +0,0 @@ -process EXTRACTCDIAMONDREADS { - - tag "$meta.id" - label 'process_medium' - - conda "bioconda::seqkit=2.8.2" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/seqkit:2.8.2--h9ee0642_1': - 'biocontainers/seqkit:2.8.2--h9ee0642_1' }" - - input: - val taxid - tuple val (meta), path(tsv) - tuple val (meta), path(fastq) // bowtie2/align *unmapped_{1,2}.fastq.gz - - output: - tuple val(meta), path("*.fastq"), optional:true, emit: extracted_diamond_reads - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - - """ - awk -v taxID=$taxid '\$2 == taxID {print \$1}' $tsv > readID.txt - if [ ${meta.single_end} == 'true' ]; then - seqkit grep -f readID.txt $fastq > ${prefix}_${taxid}.extracted_diamond_read.fastq - elif [ "${meta.single_end}" == 'false' ]; then - seqkit grep -f readID.txt ${fastq[0]} > ${prefix}_${taxid}.extracted_diamond_read1.fastq - seqkit grep -f readID.txt ${fastq[1]} > ${prefix}_${taxid}.extracted_diamond_read2.fastq - fi - - rm readID.txt - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - seqkit: \$( seqkit version | sed 's/seqkit v//' ) - END_VERSIONS - """ -} diff --git a/modules/local/rm_empty_fastq.nf b/modules/local/rm_empty_fastq.nf deleted file mode 100644 index f00463f..0000000 --- a/modules/local/rm_empty_fastq.nf +++ /dev/null @@ -1,27 +0,0 @@ -process RM_EMPTY_FASTQ { - - label 'process_low' - - input: - path folder - - output: - path folder, optional: true - - when: - task.ext.when == null || task.ext.when - - script: - def args = task.ext.args ?: '' - """ - if [ -d ${folder} ]; then - for f in ${folder}/*.fastq; do - if [ ! -s \$f ]; then - rm \$f - fi - done - else - echo "Folder ${folder} doesn't exist." - fi - """ -} diff --git a/modules/local/subset_bam.nf b/modules/local/subset_bam.nf deleted file mode 100644 index 01a58fd..0000000 --- a/modules/local/subset_bam.nf +++ /dev/null @@ -1,34 +0,0 @@ -process SUBSET_BAM { - - tag "$meta.id" - label 'process_low' - - conda "bioconda::samtools:1.21" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/samtools:1.21--h50ea8bc_0': - 'biocontainers/samtools:1.21--h50ea8bc_0' }" - - input: - tuple val(meta), path(bam), path(bai) - val taxid_accession - - output: - tuple val(meta), path("*.bam"), emit: bam - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def prefix = task.ext.prefix ?: "${meta.id}" - def accessions = taxid_accession.join(" ") - - """ - samtools view $bam $accessions -o ${prefix}.bam - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - samtools: \$(samtools --version |& sed '1!d ; s/samtools //') - END_VERSIONS - """ -}