diff --git a/bio/trimmomatic/environment.linux-64.pin.txt b/bio/trimmomatic/environment.linux-64.pin.txt new file mode 100644 index 00000000000..d77ad3817f3 --- /dev/null +++ b/bio/trimmomatic/environment.linux-64.pin.txt @@ -0,0 +1,79 @@ +# This file may be used to create an environment using: +# $ conda create --name --file +# platform: linux-64 +# created-by: conda 25.5.0 +@EXPLICIT +https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81 +https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.4.26-hbd8a1cb_0.conda#95db94f75ba080a22eb623590993167b +https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2#0c96522c6bdaed4b1566d11387caaf45 +https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2#34893075a5c9e55cdafac56607368fc6 +https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2#4d59c254e01d9cde7957100457e2d5fb +https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda#49023d73832ef61042f6a237cb2687e7 +https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.43-h712a8e2_4.conda#01f8d123c96816249efd255a31ad7712 +https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.1.0-h767d61c_2.conda#fbe7d535ff9d3a168c148e07358cd5b1 +https://conda.anaconda.org/conda-forge/noarch/python_abi-3.13-7_cp313.conda#e84b44e6300f1703cb25d29120c5b1d8 +https://conda.anaconda.org/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda#4222072737ccff51314b5ece9c7d6f5a +https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2#73aaf86a425cc6e73fcf236a5a46396d +https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-0.tar.bz2#f766549260d6815b0c52253f1fb1bb29 +https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2#fee5683a3f04bd15cbd8318b096a27ab +https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.1.0-h767d61c_2.conda#ea8ac52380885ed41c1baa8f1d6d2b93 +https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.14-hb9d3cd8_0.conda#76df83c2a9035c54df5d04ff81bcc02d +https://conda.anaconda.org/conda-forge/linux-64/libdeflate-1.24-h86f0d12_0.conda#64f0c503da58ec25ebd359e4d990afa8 +https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.0-h5888daf_0.conda#db0bfbe7dd197b68ad5f30333bae6ce0 +https://conda.anaconda.org/conda-forge/linux-64/libffi-3.4.6-h2dba641_1.conda#ede4673863426c0883c0063d853bbd85 +https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.1.0-h69a702a_2.conda#ddca86c7040dd0e73b2b69bd7833d225 +https://conda.anaconda.org/conda-forge/linux-64/libiconv-1.18-h4ce23a2_1.conda#e796ff8ddc598affdf7c173d6145f087 +https://conda.anaconda.org/conda-forge/linux-64/libjpeg-turbo-3.1.0-hb9d3cd8_0.conda#9fa334557db9f63da6c9285fd2a48638 +https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.1-hb9d3cd8_1.conda#a76fd702c93cd2dfd89eff30a5fd45a8 +https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb9d3cd8_0.conda#c7e925f37e3b40d893459e625f6a53f1 +https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.1.0-h8f9b012_2.conda#1cb1c67961f6dd257eae9e9691b341aa +https://conda.anaconda.org/conda-forge/linux-64/libwebp-base-1.5.0-h851e524_0.conda#63f790534398730f59e1b899c3644d4a +https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda#edb0dca6bc32e4f4789199455a1dbeb8 +https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda#47e340acb35de30501a76c7c799c41d7 +https://conda.anaconda.org/conda-forge/linux-64/openssl-3.5.0-h7b32b05_1.conda#de356753cfdbffcde5bb1e86e3aa6cd0 +https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-hb9d3cd8_1002.conda#b3c17d95b5a10c6e64a21fa17573e70e +https://conda.anaconda.org/conda-forge/linux-64/xorg-libice-1.1.2-hb9d3cd8_0.conda#fb901ff28063514abb6046c9ec2c4a45 +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxau-1.0.12-hb9d3cd8_0.conda#f6ebe2cb3f82ba6c057dde5d9debe4f7 +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxdmcp-1.1.5-hb9d3cd8_0.conda#8035c64cb77ed555e3f150b7b3972480 +https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-h4bc722e_7.conda#62ee74e96c5ebb0af99386de58cf9553 +https://conda.anaconda.org/conda-forge/linux-64/giflib-5.2.2-hd590300_0.conda#3bf7b9fd5a7136126e0234db4b87c8b6 +https://conda.anaconda.org/conda-forge/linux-64/keyutils-1.6.1-h166bdaf_0.tar.bz2#30186d27e2c9fa62b45fb1476b7200e3 +https://conda.anaconda.org/conda-forge/linux-64/lerc-4.0.0-h0aef613_1.conda#9344155d33912347b37f0ae6c410a835 +https://conda.anaconda.org/conda-forge/linux-64/libedit-3.1.20250104-pl5321h7949ede_0.conda#c277e0a4d549b03ac1e9d6cbbe3d017b +https://conda.anaconda.org/conda-forge/linux-64/libpng-1.6.47-h943b412_0.conda#55199e2ae2c3651f6f9b2a447b47bdc9 +https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.50.0-hee588c1_0.conda#71888e92098d0f8c41b09a671ad289bc +https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-15.1.0-h4852527_2.conda#9d2072af184b5caa29492bf2344597bb +https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.38.1-h0b41bf4_0.conda#40b61aab5c7ba9ff276c41cfffe6b80b +https://conda.anaconda.org/conda-forge/linux-64/libxcb-1.17.0-h8a09558_0.conda#92ed62436b625154323d40d5f2f11dd7 +https://conda.anaconda.org/conda-forge/linux-64/pixman-0.46.0-h29eaf8c_0.conda#d2f1c87d4416d1e7344cf92b1aaee1c4 +https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8c095d6_2.conda#283b96675859b20a825f8fa30f311446 +https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_hd72426e_102.conda#a0116df4f4ed05c303811a837d5b39d8 +https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb8e6e7a_2.conda#6432cb5d4ac0046c3ac0a8a0f95842f9 +https://conda.anaconda.org/conda-forge/linux-64/graphite2-1.3.13-h59595ed_1003.conda#f87c7b7c2cb45f323ffbce941c78ab7c +https://conda.anaconda.org/conda-forge/linux-64/icu-75.1-he02047a_0.conda#8b189310083baabfb622af68fd9d3ae3 +https://conda.anaconda.org/conda-forge/linux-64/krb5-1.21.3-h659f571_0.conda#3f43953b7d3fb3aaa1d0d0723d91e368 +https://conda.anaconda.org/conda-forge/linux-64/libfreetype6-2.13.3-h48d6fc4_1.conda#3c255be50a506c50765a93a6644f32fe +https://conda.anaconda.org/conda-forge/linux-64/libtiff-4.7.0-hf01ce69_5.conda#e79a094918988bb1807462cd42c83962 +https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.45-hc749103_0.conda#b90bece58b4c2bf25969b70f3be42d25 +https://conda.anaconda.org/conda-forge/linux-64/python-3.13.3-hf636f53_101_cp313.conda#10622e12d649154af0bd76bcf33a7c5c +https://conda.anaconda.org/conda-forge/linux-64/xorg-libsm-1.2.6-he73a12e_0.conda#1c74ff8c35dcadf952a16f752ca5aa49 +https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.12-h4f16b4b_0.conda#db038ce880f100acc74dba10302b5630 +https://conda.anaconda.org/conda-forge/linux-64/lcms2-2.17-h717163a_0.conda#000e85703f0fd9594c81710dd5066471 +https://conda.anaconda.org/conda-forge/linux-64/libcups-2.3.3-h4637d8d_4.conda#d4529f4dff3057982a7617c7ac58fde3 +https://conda.anaconda.org/conda-forge/linux-64/libfreetype-2.13.3-ha770c72_1.conda#51f5be229d83ecd401fb369ab96ae669 +https://conda.anaconda.org/conda-forge/linux-64/libglib-2.84.2-h3618099_0.conda#072ab14a02164b7c0c089055368ff776 +https://conda.anaconda.org/conda-forge/noarch/pip-25.1.1-pyh145f28c_0.conda#01384ff1639c6330a0924791413b8714 +https://conda.anaconda.org/bioconda/noarch/snakemake-wrapper-utils-0.7.2-pyhdfd78af_0.tar.bz2#3226d9f73c63e14968e89a5422a1f4d7 +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxext-1.3.6-hb9d3cd8_0.conda#febbab7d15033c913d53c7a2c102309d +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxfixes-6.0.1-hb9d3cd8_0.conda#4bdb303603e9821baf5fe5fdff1dc8f8 +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrender-0.9.12-hb9d3cd8_0.conda#96d57aba173e878a2089d5638016dc5e +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxt-1.3.1-hb9d3cd8_0.conda#279b0de5f6ba95457190a1c459a64e31 +https://conda.anaconda.org/conda-forge/linux-64/freetype-2.13.3-ha770c72_1.conda#9ccd736d31e0c6e41f54e704e5312811 +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxi-1.8.2-hb9d3cd8_0.conda#17dcc85db3c7886650b8908b183d6876 +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrandr-1.5.4-hb9d3cd8_0.conda#2de7f99d6581a4a7adbff607b5c278ca +https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.15.0-h7e30c49_1.conda#8f5b0b297b59e1ac160ad4beec99dbee +https://conda.anaconda.org/conda-forge/linux-64/xorg-libxtst-1.2.5-hb9d3cd8_3.conda#7bbe9a0cc0df0ac5f5a8ad6d6a11af2f +https://conda.anaconda.org/conda-forge/linux-64/cairo-1.18.4-h3394656_0.conda#09262e66b19567aff4f592fb53b28760 +https://conda.anaconda.org/conda-forge/linux-64/harfbuzz-11.2.1-h3beb420_0.conda#0e6e192d4b3d95708ad192d957cf3163 +https://conda.anaconda.org/conda-forge/linux-64/openjdk-23.0.2-h53dfc1b_2.conda#47eea31e0c3f960459237823e5e21a32 +https://conda.anaconda.org/bioconda/noarch/trimmomatic-0.39-hdfd78af_2.tar.bz2#42a827a3e09b4207a89f0d22f77163d3 diff --git a/bio/trimmomatic/environment.yaml b/bio/trimmomatic/environment.yaml new file mode 100644 index 00000000000..a3d8df19d56 --- /dev/null +++ b/bio/trimmomatic/environment.yaml @@ -0,0 +1,7 @@ +channels: + - conda-forge + - bioconda + - nodefaults +dependencies: + - trimmomatic =0.39 + - snakemake-wrapper-utils =0.7.2 diff --git a/bio/trimmomatic/meta.yaml b/bio/trimmomatic/meta.yaml new file mode 100644 index 00000000000..912820d5f16 --- /dev/null +++ b/bio/trimmomatic/meta.yaml @@ -0,0 +1,20 @@ +name: "trimmomatic pe" +description: Trim reads with Trimmomatic. +url: http://www.usadellab.org/cms/?page=trimmomatic +authors: + - Johannes Köster + - Jorge Langa + - Filipe G. Vieira +input: + - r1: fastq(gz) file + - r2: fastq(gz) file (if PE) +output: + - r1: trimmed R1 fastq(gz) file + - r2: trimmed R2 fastq(gz) file (if PE) + - r1_unpaired: unpaired R1 fastq(gz) file (if PE) + - r2_unpaired: unpaired R2 fastq(gz) file (if PE) +params: + - trimmer: trimming steps + - extra: additional program arguments +notes: | + For PE (paired-end) trimming, all output files need to be specified. diff --git a/bio/trimmomatic/pe/environment.yaml b/bio/trimmomatic/pe/environment.yaml deleted file mode 100644 index b590aaab5d9..00000000000 --- a/bio/trimmomatic/pe/environment.yaml +++ /dev/null @@ -1,8 +0,0 @@ -channels: - - conda-forge - - bioconda - - nodefaults -dependencies: - - trimmomatic ==0.36 - - pigz ==2.3.4 - - snakemake-wrapper-utils ==0.1.3 diff --git a/bio/trimmomatic/pe/meta.yaml b/bio/trimmomatic/pe/meta.yaml deleted file mode 100644 index d9b1a49527f..00000000000 --- a/bio/trimmomatic/pe/meta.yaml +++ /dev/null @@ -1,5 +0,0 @@ -name: "trimmomatic pe" -description: Trim paired-end reads with `trimmomatic `_ . (De)compress with pigz. -authors: - - Johannes Köster - - Jorge Langa diff --git a/bio/trimmomatic/pe/test/Snakefile b/bio/trimmomatic/pe/test/Snakefile deleted file mode 120000 index d256e239a04..00000000000 --- a/bio/trimmomatic/pe/test/Snakefile +++ /dev/null @@ -1 +0,0 @@ -Snakefile_gz_gz \ No newline at end of file diff --git a/bio/trimmomatic/pe/test/Snakefile_fq_fq b/bio/trimmomatic/pe/test/Snakefile_fq_fq deleted file mode 100644 index e27f80f2ce4..00000000000 --- a/bio/trimmomatic/pe/test/Snakefile_fq_fq +++ /dev/null @@ -1,27 +0,0 @@ -rule trimmomatic_pe: - input: - r1="reads/{sample}.1.fastq", - r2="reads/{sample}.2.fastq" - output: - r1="trimmed/{sample}.1.fastq", - r2="trimmed/{sample}.2.fastq", - # reads where trimming entirely removed the mate - r1_unpaired="trimmed/{sample}.1.unpaired.fastq", - r2_unpaired="trimmed/{sample}.2.unpaired.fastq" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # optional parameters - extra="" - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/pe" diff --git a/bio/trimmomatic/pe/test/Snakefile_fq_gz b/bio/trimmomatic/pe/test/Snakefile_fq_gz deleted file mode 100644 index be06e639bf9..00000000000 --- a/bio/trimmomatic/pe/test/Snakefile_fq_gz +++ /dev/null @@ -1,28 +0,0 @@ -rule trimmomatic_pe_fq_gz: - input: - r1="reads/{sample}.1.fastq", - r2="reads/{sample}.2.fastq" - output: - r1="trimmed/{sample}.1.fastq.gz", - r2="trimmed/{sample}.2.fastq.gz", - # reads where trimming entirely removed the mate - r1_unpaired="trimmed/{sample}.1.unpaired.fastq.gz", - r2_unpaired="trimmed/{sample}.2.unpaired.fastq.gz" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # optional parameters - extra="", - compression_level="-9" - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/pe" diff --git a/bio/trimmomatic/pe/test/Snakefile_gz_fq b/bio/trimmomatic/pe/test/Snakefile_gz_fq deleted file mode 100644 index 3981dfd5fb7..00000000000 --- a/bio/trimmomatic/pe/test/Snakefile_gz_fq +++ /dev/null @@ -1,27 +0,0 @@ -rule trimmomatic_pe_gz_fq: - input: - r1="reads/{sample}.1.fastq.gz", - r2="reads/{sample}.2.fastq.gz" - output: - r1="trimmed/{sample}.1.fastq", - r2="trimmed/{sample}.2.fastq", - # reads where trimming entirely removed the mate - r1_unpaired="trimmed/{sample}.1.unpaired.fastq", - r2_unpaired="trimmed/{sample}.2.unpaired.fastq" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # optional parameters - extra="" - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/pe" diff --git a/bio/trimmomatic/pe/test/Snakefile_gz_gz b/bio/trimmomatic/pe/test/Snakefile_gz_gz deleted file mode 100644 index 53c897499c4..00000000000 --- a/bio/trimmomatic/pe/test/Snakefile_gz_gz +++ /dev/null @@ -1,28 +0,0 @@ -rule trimmomatic_pe: - input: - r1="reads/{sample}.1.fastq.gz", - r2="reads/{sample}.2.fastq.gz" - output: - r1="trimmed/{sample}.1.fastq.gz", - r2="trimmed/{sample}.2.fastq.gz", - # reads where trimming entirely removed the mate - r1_unpaired="trimmed/{sample}.1.unpaired.fastq.gz", - r2_unpaired="trimmed/{sample}.2.unpaired.fastq.gz" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # optional parameters - extra="", - compression_level="-9" - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/pe" diff --git a/bio/trimmomatic/pe/wrapper.py b/bio/trimmomatic/pe/wrapper.py deleted file mode 100644 index b704d09cec4..00000000000 --- a/bio/trimmomatic/pe/wrapper.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -bio/trimmomatic/pe - -Snakemake wrapper to trim reads with trimmomatic in PE mode with help of pigz. -pigz is the parallel implementation of gz. Trimmomatic spends most of the time -compressing and decompressing instead of trimming sequences. By using process -substitution (<(command), >(command)), we can accelerate trimmomatic a lot. -Consider providing this wrapper with at least 1 extra thread per each gzipped -input or output file. -""" - -__author__ = "Johannes Köster, Jorge Langa" -__copyright__ = "Copyright 2016, Johannes Köster" -__email__ = "koester@jimmy.harvard.edu" -__license__ = "MIT" - - -from snakemake.shell import shell -from snakemake_wrapper_utils.java import get_java_opts - - -# Distribute available threads between trimmomatic itself and any potential pigz instances -def distribute_threads(input_files, output_files, available_threads): - gzipped_input_files = sum(1 for file in input_files if file.endswith(".gz")) - gzipped_output_files = sum(1 for file in output_files if file.endswith(".gz")) - potential_threads_per_process = available_threads // ( - 1 + gzipped_input_files + gzipped_output_files - ) - if potential_threads_per_process > 0: - # decompressing pigz creates at most 4 threads - pigz_input_threads = ( - min(4, potential_threads_per_process) if gzipped_input_files != 0 else 0 - ) - pigz_output_threads = ( - (available_threads - pigz_input_threads * gzipped_input_files) - // (1 + gzipped_output_files) - if gzipped_output_files != 0 - else 0 - ) - trimmomatic_threads = ( - available_threads - - pigz_input_threads * gzipped_input_files - - pigz_output_threads * gzipped_output_files - ) - else: - # not enough threads for pigz - pigz_input_threads = 0 - pigz_output_threads = 0 - trimmomatic_threads = available_threads - return trimmomatic_threads, pigz_input_threads, pigz_output_threads - - -def compose_input_gz(filename, threads): - if filename.endswith(".gz") and threads > 0: - return "<(pigz -p {threads} --decompress --stdout {filename})".format( - threads=threads, filename=filename - ) - return filename - - -def compose_output_gz(filename, threads, compression_level): - if filename.endswith(".gz") and threads > 0: - return ">(pigz -p {threads} {compression_level} > {filename})".format( - threads=threads, compression_level=compression_level, filename=filename - ) - return filename - - -extra = snakemake.params.get("extra", "") -java_opts = get_java_opts(snakemake) -log = snakemake.log_fmt_shell(stdout=True, stderr=True) -compression_level = snakemake.params.get("compression_level", "-5") -trimmer = " ".join(snakemake.params.trimmer) - -# Distribute threads -input_files = [snakemake.input.r1, snakemake.input.r2] -output_files = [ - snakemake.output.r1, - snakemake.output.r1_unpaired, - snakemake.output.r2, - snakemake.output.r2_unpaired, -] - -trimmomatic_threads, input_threads, output_threads = distribute_threads( - input_files, output_files, snakemake.threads -) - -input_r1, input_r2 = [ - compose_input_gz(filename, input_threads) for filename in input_files -] - -output_r1, output_r1_unp, output_r2, output_r2_unp = [ - compose_output_gz(filename, output_threads, compression_level) - for filename in output_files -] - -shell( - "trimmomatic PE -threads {trimmomatic_threads} {java_opts} {extra} " - "{input_r1} {input_r2} " - "{output_r1} {output_r1_unp} " - "{output_r2} {output_r2_unp} " - "{trimmer} " - "{log}" -) diff --git a/bio/trimmomatic/se/environment.yaml b/bio/trimmomatic/se/environment.yaml deleted file mode 100644 index b590aaab5d9..00000000000 --- a/bio/trimmomatic/se/environment.yaml +++ /dev/null @@ -1,8 +0,0 @@ -channels: - - conda-forge - - bioconda - - nodefaults -dependencies: - - trimmomatic ==0.36 - - pigz ==2.3.4 - - snakemake-wrapper-utils ==0.1.3 diff --git a/bio/trimmomatic/se/meta.yaml b/bio/trimmomatic/se/meta.yaml deleted file mode 100644 index dca915fc54c..00000000000 --- a/bio/trimmomatic/se/meta.yaml +++ /dev/null @@ -1,5 +0,0 @@ -name: "trimmomatic se" -description: Trim single-end reads with `trimmomatic `_. (De)compress with pigz. -authors: - - Johannes Köster - - Jorge Langa diff --git a/bio/trimmomatic/se/test/Snakefile b/bio/trimmomatic/se/test/Snakefile deleted file mode 120000 index d256e239a04..00000000000 --- a/bio/trimmomatic/se/test/Snakefile +++ /dev/null @@ -1 +0,0 @@ -Snakefile_gz_gz \ No newline at end of file diff --git a/bio/trimmomatic/se/test/Snakefile_fq_fq b/bio/trimmomatic/se/test/Snakefile_fq_fq deleted file mode 100644 index 1a9f5fe67cd..00000000000 --- a/bio/trimmomatic/se/test/Snakefile_fq_fq +++ /dev/null @@ -1,22 +0,0 @@ -rule trimmomatic: - input: - "reads/{sample}.fastq" - output: - "trimmed/{sample}.fastq" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # optional parameters - extra="", - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/se" diff --git a/bio/trimmomatic/se/test/Snakefile_fq_gz b/bio/trimmomatic/se/test/Snakefile_fq_gz deleted file mode 100644 index 1cd54c29d76..00000000000 --- a/bio/trimmomatic/se/test/Snakefile_fq_gz +++ /dev/null @@ -1,24 +0,0 @@ -rule trimmomatic: - input: - "reads/{sample}.fastq" - output: - "trimmed/{sample}.fastq.gz" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # compression levels from -0 to -9 and -11 - compression_level="-5", - # optional parameters - extra="" - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/se" diff --git a/bio/trimmomatic/se/test/Snakefile_gz_fq b/bio/trimmomatic/se/test/Snakefile_gz_fq deleted file mode 100644 index b5762c0264f..00000000000 --- a/bio/trimmomatic/se/test/Snakefile_gz_fq +++ /dev/null @@ -1,22 +0,0 @@ -rule trimmomatic: - input: - "reads/{sample}.fastq.gz" - output: - "trimmed/{sample}.fastq" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # optional parameters - extra="" - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/se" diff --git a/bio/trimmomatic/se/test/Snakefile_gz_gz b/bio/trimmomatic/se/test/Snakefile_gz_gz deleted file mode 100644 index bea06e3f50e..00000000000 --- a/bio/trimmomatic/se/test/Snakefile_gz_gz +++ /dev/null @@ -1,24 +0,0 @@ -rule trimmomatic: - input: - "reads/{sample}.fastq.gz" # input and output can be uncompressed or compressed - output: - "trimmed/{sample}.fastq.gz" - log: - "logs/trimmomatic/{sample}.log" - params: - # list of trimmers (see manual) - trimmer=["TRAILING:3"], - # optional parameters - extra="", - # optional compression levels from -0 to -9 and -11 - compression_level="-9" - threads: - 32 - # optional specification of memory usage of the JVM that snakemake will respect with global - # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources) - # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`: - # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties - resources: - mem_mb=1024 - wrapper: - "master/bio/trimmomatic/se" diff --git a/bio/trimmomatic/se/wrapper.py b/bio/trimmomatic/se/wrapper.py deleted file mode 100644 index af721ef55c8..00000000000 --- a/bio/trimmomatic/se/wrapper.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -bio/trimmomatic/se - -Snakemake wrapper to trim reads with trimmomatic in SE mode with help of pigz. -pigz is the parallel implementation of gz. Trimmomatic spends most of the time -compressing and decompressing instead of trimming sequences. By using process -substitution (<(command), >(command)), we can accelerate trimmomatic a lot. -Consider providing this wrapper with at least 1 extra thread per each gzipped -input or output file. -""" - -__author__ = "Johannes Köster, Jorge Langa" -__copyright__ = "Copyright 2016, Johannes Köster" -__email__ = "koester@jimmy.harvard.edu" -__license__ = "MIT" - - -from snakemake.shell import shell -from snakemake_wrapper_utils.java import get_java_opts - - -# Distribute available threads between trimmomatic itself and any potential pigz instances -def distribute_threads(input_file, output_file, available_threads): - gzipped_input_files = 1 if input_file.endswith(".gz") else 0 - gzipped_output_files = 1 if output_file.endswith(".gz") else 0 - potential_threads_per_process = available_threads // ( - 1 + gzipped_input_files + gzipped_output_files - ) - if potential_threads_per_process > 0: - # decompressing pigz creates at most 4 threads - pigz_input_threads = ( - min(4, potential_threads_per_process) if gzipped_input_files != 0 else 0 - ) - pigz_output_threads = ( - (available_threads - pigz_input_threads * gzipped_input_files) - // (1 + gzipped_output_files) - if gzipped_output_files != 0 - else 0 - ) - trimmomatic_threads = ( - available_threads - - pigz_input_threads * gzipped_input_files - - pigz_output_threads * gzipped_output_files - ) - else: - # not enough threads for pigz - pigz_input_threads = 0 - pigz_output_threads = 0 - trimmomatic_threads = available_threads - return trimmomatic_threads, pigz_input_threads, pigz_output_threads - - -def compose_input_gz(filename, threads): - if filename.endswith(".gz") and threads > 0: - return "<(pigz -p {threads} --decompress --stdout {filename})".format( - threads=threads, filename=filename - ) - return filename - - -def compose_output_gz(filename, threads, compression_level): - if filename.endswith(".gz") and threads > 0: - return ">(pigz -p {threads} {compression_level} > {filename})".format( - threads=threads, compression_level=compression_level, filename=filename - ) - return filename - - -extra = snakemake.params.get("extra", "") -java_opts = get_java_opts(snakemake) -log = snakemake.log_fmt_shell(stdout=True, stderr=True) -compression_level = snakemake.params.get("compression_level", "-5") -trimmer = " ".join(snakemake.params.trimmer) - -# Distribute threads -trimmomatic_threads, input_threads, output_threads = distribute_threads( - snakemake.input[0], snakemake.output[0], snakemake.threads -) - -# Collect files -input = compose_input_gz(snakemake.input[0], input_threads) -output = compose_output_gz(snakemake.output[0], output_threads, compression_level) - -shell( - "trimmomatic SE -threads {trimmomatic_threads} " - "{java_opts} {extra} {input} {output} {trimmer} {log}" -) diff --git a/bio/trimmomatic/test/Snakefile b/bio/trimmomatic/test/Snakefile new file mode 100644 index 00000000000..73efa65a6ed --- /dev/null +++ b/bio/trimmomatic/test/Snakefile @@ -0,0 +1,176 @@ +rule trimmomatic_pe_fq_fq: + input: + r1="reads/{sample}.1.fastq", + r2="reads/{sample}.2.fastq", + output: + r1="trimmed/pe/fq_fq/{sample}.1.fastq", + r2="trimmed/pe/fq_fq/{sample}.2.fastq", + # reads where trimming entirely removed the mate + r1_unpaired="trimmed/pe/fq_fq/{sample}.1.unpaired.fastq", + r2_unpaired="trimmed/pe/fq_fq/{sample}.2.unpaired.fastq", + log: + "logs/trimmomatic/pe/fq_fq/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # optional parameters + extra="", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" + + +rule trimmomatic_pe_fq_gz: + input: + r1="reads/{sample}.1.fastq", + r2="reads/{sample}.2.fastq", + output: + r1="trimmed/pe/fq_gz/{sample}.1.fastq.gz", + r2="trimmed/pe/fq_gz/{sample}.2.fastq.gz", + # reads where trimming entirely removed the mate + r1_unpaired="trimmed/pe/fq_gz/{sample}.1.unpaired.fastq.gz", + r2_unpaired="trimmed/pe/fq_gz/{sample}.2.unpaired.fastq.gz", + log: + "logs/trimmomatic/pe/fq_gz/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # optional parameters + extra="", + compression_level="-9", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" + + +rule trimmomatic_pe_gz_fq: + input: + r1="reads/{sample}.1.fastq.gz", + r2="reads/{sample}.2.fastq.gz", + output: + r1="trimmed/pe/gz_fq/{sample}.1.fastq", + r2="trimmed/pe/gz_fq/{sample}.2.fastq", + # reads where trimming entirely removed the mate + r1_unpaired="trimmed/pe/gz_fq/{sample}.1.unpaired.fastq", + r2_unpaired="trimmed/pe/gz_fq/{sample}.2.unpaired.fastq", + log: + "logs/trimmomatic/pe/gz_fq/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # optional parameters + extra="", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" + + +rule trimmomatic_pe_gz_gz: + input: + r1="reads/{sample}.1.fastq.gz", + r2="reads/{sample}.2.fastq.gz", + output: + r1="trimmed/pe/gz_gz/{sample}.1.fastq.gz", + r2="trimmed/pe/gz_gz/{sample}.2.fastq.gz", + # reads where trimming entirely removed the mate + r1_unpaired="trimmed/pe/gz_gz/{sample}.1.unpaired.fastq.gz", + r2_unpaired="trimmed/pe/gz_gz/{sample}.2.unpaired.fastq.gz", + log: + "logs/trimmomatic/pe/gz_gz/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # optional parameters + extra="", + compression_level="-9", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" + + +rule trimmomatic_se_fq_fq: + input: + "reads/{sample}.fastq", + output: + "trimmed/se/fq_fq/{sample}.fastq", + log: + "logs/trimmomatic/se/fq_fq/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # optional parameters + extra="", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" + + +rule trimmomatic_se_fq_gz: + input: + "reads/{sample}.fastq", + output: + "trimmed/se/fq_gz/{sample}.fastq.gz", + log: + "logs/trimmomatic/se/fq_gz/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # compression levels from -0 to -9 and -11 + compression_level="-5", + # optional parameters + extra="", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" + + +rule trimmomatic_se_gz_fq: + input: + "reads/{sample}.fastq.gz", + output: + "trimmed/se/gz_fq/{sample}.fastq", + log: + "logs/trimmomatic/se/gz_fq/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # optional parameters + extra="", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" + + +rule trimmomatic_se_gz_gz: + input: + "reads/{sample}.fastq.gz", + output: + "trimmed/se/gz_gz/{sample}.fastq.gz", + log: + "logs/trimmomatic/se/gz_gz/{sample}.log", + params: + # list of trimmers (see manual) + trimmer=["TRAILING:3"], + # optional parameters + extra="", + # optional compression levels from -0 to -9 and -11 + compression_level="-9", + threads: 32 + resources: + mem_mb=1024, + wrapper: + "master/bio/trimmomatic" diff --git a/bio/trimmomatic/pe/test/reads/a.1.fastq b/bio/trimmomatic/test/reads/a.1.fastq similarity index 100% rename from bio/trimmomatic/pe/test/reads/a.1.fastq rename to bio/trimmomatic/test/reads/a.1.fastq diff --git a/bio/trimmomatic/pe/test/reads/a.1.fastq.gz b/bio/trimmomatic/test/reads/a.1.fastq.gz similarity index 100% rename from bio/trimmomatic/pe/test/reads/a.1.fastq.gz rename to bio/trimmomatic/test/reads/a.1.fastq.gz diff --git a/bio/trimmomatic/pe/test/reads/a.2.fastq b/bio/trimmomatic/test/reads/a.2.fastq similarity index 100% rename from bio/trimmomatic/pe/test/reads/a.2.fastq rename to bio/trimmomatic/test/reads/a.2.fastq diff --git a/bio/trimmomatic/pe/test/reads/a.2.fastq.gz b/bio/trimmomatic/test/reads/a.2.fastq.gz similarity index 100% rename from bio/trimmomatic/pe/test/reads/a.2.fastq.gz rename to bio/trimmomatic/test/reads/a.2.fastq.gz diff --git a/bio/trimmomatic/se/test/reads/a.fastq b/bio/trimmomatic/test/reads/a.fastq similarity index 100% rename from bio/trimmomatic/se/test/reads/a.fastq rename to bio/trimmomatic/test/reads/a.fastq diff --git a/bio/trimmomatic/se/test/reads/a.fastq.gz b/bio/trimmomatic/test/reads/a.fastq.gz similarity index 100% rename from bio/trimmomatic/se/test/reads/a.fastq.gz rename to bio/trimmomatic/test/reads/a.fastq.gz diff --git a/bio/trimmomatic/wrapper.py b/bio/trimmomatic/wrapper.py new file mode 100644 index 00000000000..e3dcf604dc7 --- /dev/null +++ b/bio/trimmomatic/wrapper.py @@ -0,0 +1,42 @@ +__author__ = "Johannes Köster, Jorge Langa" +__copyright__ = "Copyright 2016, Johannes Köster" +__email__ = "koester@jimmy.harvard.edu" +__license__ = "MIT" + + +from snakemake.shell import shell +from snakemake_wrapper_utils.java import get_java_opts + + +extra = snakemake.params.get("extra", "") +java_opts = get_java_opts(snakemake) +log = snakemake.log_fmt_shell(stdout=True, stderr=True) +compression_level = snakemake.params.get("compression_level", "-5") +trimmer = " ".join(snakemake.params.trimmer) + + +if snakemake.input.get("r2", False): + trim_mode = "PE" + in_files = [snakemake.input.r1, snakemake.input.r2] + out_files = [ + snakemake.output.r1, + snakemake.output.r1_unpaired, + snakemake.output.r2, + snakemake.output.r2_unpaired, + ] +else: + trim_mode = "SE" + in_files = [snakemake.input[0]] + out_files = [snakemake.output[0]] + + +shell( + "trimmomatic {trim_mode}" + " -threads {snakemake.threads}" + " {java_opts}" + " {extra}" + " {in_files}" + " {out_files}" + " {trimmer}" + " {log}" +) diff --git a/test_wrappers.py b/test_wrappers.py index 018bb1735d7..8dc61646e05 100644 --- a/test_wrappers.py +++ b/test_wrappers.py @@ -4552,141 +4552,21 @@ def test_trim_galore_se_uncompressed(run): def test_trimmomatic_pe(run): """Four tests, one per fq-gz combination""" run( - "bio/trimmomatic/pe", + "bio/trimmomatic", [ "snakemake", "--cores", - "1", - "trimmed/a.1.fastq", + "10", + "trimmed/se/fq_fq/a.1.fastq", + "trimmed/se/gz_fq/a.1.fastq", + "trimmed/se/fq_gz/a.1.fastq.gz", + "trimmed/se/gz_gz/a.1.fastq.gz", + "trimmed/pe/fq_fq/a.1.fastq", + "trimmed/pe/gz_fq/a.1.fastq", + "trimmed/pe/fq_gz/a.1.fastq.gz", + "trimmed/pe/gz_gz/a.1.fastq.gz", "--use-conda", "-F", - "-s", - "Snakefile_fq_fq", - ], - ) - run( - "bio/trimmomatic/pe", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.1.fastq.gz", - "--use-conda", - "-F", - "-s", - "Snakefile_fq_gz", - ], - ) - run( - "bio/trimmomatic/pe", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.1.fastq", - "--use-conda", - "-F", - "-s", - "Snakefile_gz_fq", - ], - ) - run( - "bio/trimmomatic/pe", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.1.fastq.gz", - "--use-conda", - "-F", - "-s", - "Snakefile_gz_gz", - ], - ) - run( - "bio/trimmomatic/pe", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.1.fastq.gz", - "--use-conda", - "-F", - "--cores", - "32", - "-s", - "Snakefile_gz_gz", - ], - ) - - -def test_trimmomatic_se(run): - """Four tests, one per fq-gz combination""" - run( - "bio/trimmomatic/se", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.fastq", - "--use-conda", - "-F", - "-s", - "Snakefile_fq_fq", - ], - ) - run( - "bio/trimmomatic/se", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.fastq.gz", - "--use-conda", - "-F", - "-s", - "Snakefile_fq_gz", - ], - ) - run( - "bio/trimmomatic/se", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.fastq", - "--use-conda", - "-F", - "-s", - "Snakefile_gz_fq", - ], - ) - run( - "bio/trimmomatic/se", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.fastq.gz", - "--use-conda", - "-F", - "-s", - "Snakefile_gz_gz", - ], - ) - run( - "bio/trimmomatic/se", - [ - "snakemake", - "--cores", - "1", - "trimmed/a.fastq.gz", - "--use-conda", - "-F", - "--cores", - "32", - "-s", - "Snakefile_gz_gz", ], )