diff --git a/.nf-test.log b/.nf-test.log new file mode 100644 index 0000000..249b54a --- /dev/null +++ b/.nf-test.log @@ -0,0 +1,14 @@ +May-14 01:14:49.220 [main] INFO com.askimed.nf.test.App - nf-test 0.9.2 +May-14 01:14:49.227 [main] INFO com.askimed.nf.test.App - Arguments: [test, --verbose, subworkflows/local/hmmer/tests/main.nf.test] +May-14 01:14:49.737 [main] INFO com.askimed.nf.test.App - Nextflow Version: 24.04.2 +May-14 01:14:49.738 [main] WARN com.askimed.nf.test.commands.RunTestsCommand - No nf-test config file found. +May-14 01:14:49.765 [main] INFO com.askimed.nf.test.lang.dependencies.DependencyResolver - Loaded 33 files from directory /Users/saba.nafees/code/nextflow/proteinannotator in 0.026 sec +May-14 01:14:49.766 [main] INFO com.askimed.nf.test.lang.dependencies.DependencyResolver - Found 1 files containing tests. +May-14 01:14:49.766 [main] DEBUG com.askimed.nf.test.lang.dependencies.DependencyResolver - Found files: [/Users/saba.nafees/code/nextflow/proteinannotator/subworkflows/local/hmmer/tests/main.nf.test] +May-14 01:14:49.981 [main] INFO com.askimed.nf.test.commands.RunTestsCommand - Found 1 tests to execute. +May-14 01:14:49.982 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Started test plan +May-14 01:14:49.982 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Running testsuite 'Test Workflow HMMER_ANNOTATION' from file '/Users/saba.nafees/code/nextflow/proteinannotator/subworkflows/local/hmmer/tests/main.nf.test'. +May-14 01:14:49.982 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Run test '67aaf421: Test HMMER database preparation and search'. type: com.askimed.nf.test.lang.workflow.WorkflowTest +May-14 01:14:53.891 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Test '67aaf421: Test HMMER database preparation and search' finished. status: PASSED +May-14 01:14:53.892 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Testsuite 'Test Workflow HMMER_ANNOTATION' finished. snapshot file: false, skipped tests: false, failed tests: false +May-14 01:14:53.892 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Executed 1 tests. 0 tests failed. Done! diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/mock.nf b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/mock.nf new file mode 100644 index 0000000..2745178 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/mock.nf @@ -0,0 +1,95 @@ +import groovy.json.JsonGenerator +import groovy.json.JsonGenerator.Converter + +nextflow.enable.dsl=2 + +// comes from nf-test to store json files +params.nf_test_output = "" + +// include dependencies + + +// include test workflow +include { HMMER_ANNOTATION } from '/Users/saba.nafees/code/nextflow/proteinannotator/subworkflows/local/hmmer/tests/../main.nf' + +// define custom rules for JSON that will be generated. +def jsonOutput = + new JsonGenerator.Options() + .addConverter(Path) { value -> value.toAbsolutePath().toString() } // Custom converter for Path. Only filename + .build() + +def jsonWorkflowOutput = new JsonGenerator.Options().excludeNulls().build() + +workflow { + + // run dependencies + + + // workflow mapping + def input = [] + + // Create test protein channel + input[0] = Channel.of( + [ + [ id:'test_protein' ], + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz", checkIfExists: true) + ] + ) + // Create test HMM database channel (unpressed) + input[1] = Channel.of( + [ + [ id:'test_hmm' ], + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz", checkIfExists: true) + ] + ) + + //---- + + //run workflow + HMMER_ANNOTATION(*input) + + if (HMMER_ANNOTATION.output){ + + // consumes all named output channels and stores items in a json file + for (def name in HMMER_ANNOTATION.out.getNames()) { + serializeChannel(name, HMMER_ANNOTATION.out.getProperty(name), jsonOutput) + } + + // consumes all unnamed output channels and stores items in a json file + def array = HMMER_ANNOTATION.out as Object[] + for (def i = 0; i < array.length ; i++) { + serializeChannel(i, array[i], jsonOutput) + } + + } +} + + +def serializeChannel(name, channel, jsonOutput) { + def _name = name + def list = [ ] + channel.subscribe( + onNext: { + list.add(it) + }, + onComplete: { + def map = new HashMap() + map[_name] = list + def filename = "${params.nf_test_output}/output_${_name}.json" + new File(filename).text = jsonOutput.toJson(map) + } + ) +} + + +workflow.onComplete { + + def result = [ + success: workflow.success, + exitStatus: workflow.exitStatus, + errorMessage: workflow.errorMessage, + errorReport: workflow.errorReport + ] + new File("${params.nf_test_output}/workflow.json").text = jsonWorkflowOutput.toJson(result) + +} diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/nextflow.log b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/nextflow.log new file mode 100644 index 0000000..399dce4 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/nextflow.log @@ -0,0 +1,108 @@ +May-14 01:14:50.910 [main] DEBUG nextflow.cli.Launcher - $> nextflow -log /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/nextflow.log run /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test-67aaf421e02387adceb68ea1093eea83.nf -c /Users/saba.nafees/code/nextflow/proteinannotator/nextflow.config -params-file /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/params.json -ansi-log false -with-trace /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/trace.csv -w /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work +May-14 01:14:50.948 [main] INFO nextflow.cli.CmdRun - N E X T F L O W ~ version 24.04.2 +May-14 01:14:50.960 [main] DEBUG nextflow.plugin.PluginsFacade - Setting up plugin manager > mode=prod; embedded=false; plugins-dir=/Users/saba.nafees/.nextflow/plugins; core-plugins: nf-amazon@2.5.2,nf-azure@1.6.0,nf-cloudcache@0.4.1,nf-codecommit@0.2.0,nf-console@1.1.3,nf-ga4gh@1.3.0,nf-google@1.13.2,nf-tower@1.9.1,nf-wave@1.4.2 +May-14 01:14:50.966 [main] INFO o.pf4j.DefaultPluginStatusProvider - Enabled plugins: [] +May-14 01:14:50.967 [main] INFO o.pf4j.DefaultPluginStatusProvider - Disabled plugins: [] +May-14 01:14:50.968 [main] INFO org.pf4j.DefaultPluginManager - PF4J version 3.10.0 in 'deployment' mode +May-14 01:14:50.974 [main] INFO org.pf4j.AbstractPluginManager - No plugins +May-14 01:14:50.985 [main] DEBUG nextflow.config.ConfigBuilder - Found config base: /Users/saba.nafees/code/nextflow/proteinannotator/nextflow.config +May-14 01:14:50.987 [main] DEBUG nextflow.config.ConfigBuilder - User config file: /Users/saba.nafees/code/nextflow/proteinannotator/nextflow.config +May-14 01:14:50.988 [main] DEBUG nextflow.config.ConfigBuilder - Parsing config file: /Users/saba.nafees/code/nextflow/proteinannotator/nextflow.config +May-14 01:14:50.988 [main] DEBUG nextflow.config.ConfigBuilder - Parsing config file: /Users/saba.nafees/code/nextflow/proteinannotator/nextflow.config +May-14 01:14:51.008 [main] DEBUG n.secret.LocalSecretsProvider - Secrets store: /Users/saba.nafees/.nextflow/secrets/store.json +May-14 01:14:51.010 [main] DEBUG nextflow.secret.SecretsLoader - Discovered secrets providers: [nextflow.secret.LocalSecretsProvider@73aff8f1] - activable => nextflow.secret.LocalSecretsProvider@73aff8f1 +May-14 01:14:51.021 [main] DEBUG nextflow.config.ConfigBuilder - Applying config profile: `standard` +May-14 01:14:51.788 [main] DEBUG nextflow.config.ConfigBuilder - Applying config profile: `standard` +May-14 01:14:51.981 [main] DEBUG nextflow.cli.CmdRun - Applied DSL=2 from script declaration +May-14 01:14:51.988 [main] INFO nextflow.cli.CmdRun - Launching `/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test-67aaf421e02387adceb68ea1093eea83.nf` [confident_hamilton] DSL2 - revision: b9589f0468 +May-14 01:14:51.989 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins declared=[nf-schema@2.2.0] +May-14 01:14:51.989 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins default=[] +May-14 01:14:51.989 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins resolved requirement=[nf-schema@2.2.0] +May-14 01:14:51.989 [main] DEBUG nextflow.plugin.PluginUpdater - Installing plugin nf-schema version: 2.2.0 +May-14 01:14:51.992 [main] INFO org.pf4j.AbstractPluginManager - Plugin 'nf-schema@2.2.0' resolved +May-14 01:14:51.993 [main] INFO org.pf4j.AbstractPluginManager - Start plugin 'nf-schema@2.2.0' +May-14 01:14:51.995 [main] DEBUG nextflow.plugin.BasePlugin - Plugin started nf-schema@2.2.0 +May-14 01:14:52.024 [main] DEBUG nextflow.Session - Session UUID: 58ad274a-474b-4ac7-9a94-c1e9bf36c8ad +May-14 01:14:52.024 [main] DEBUG nextflow.Session - Run name: confident_hamilton +May-14 01:14:52.024 [main] DEBUG nextflow.Session - Executor pool size: 14 +May-14 01:14:52.027 [main] DEBUG nextflow.file.FilePorter - File porter settings maxRetries=3; maxTransfers=50; pollTimeout=null +May-14 01:14:52.029 [main] DEBUG nextflow.util.ThreadPoolBuilder - Creating thread pool 'FileTransfer' minSize=10; maxSize=42; workQueue=LinkedBlockingQueue[10000]; allowCoreThreadTimeout=false +May-14 01:14:52.040 [main] DEBUG nextflow.cli.CmdRun - + Version: 24.04.2 build 5914 + Created: 29-05-2024 06:19 UTC (02:19 EDT) + System: Mac OS X 15.3.1 + Runtime: Groovy 4.0.21 on OpenJDK 64-Bit Server VM 17.0.15+0 + Encoding: UTF-8 (UTF-8) + Process: 54157@MacBook-Pro.local [127.0.0.1] + CPUs: 14 - Mem: 96 GB (9.8 GB) - Swap: 0 (0) +May-14 01:14:52.055 [main] DEBUG nextflow.Session - Work-dir: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work [Mac OS X] +May-14 01:14:52.055 [main] DEBUG nextflow.Session - Script base path does not exist or is not a directory: /Users/saba.nafees/code/nextflow/proteinannotator/bin +May-14 01:14:52.060 [main] DEBUG nextflow.executor.ExecutorFactory - Extension executors providers=[] +May-14 01:14:52.065 [main] DEBUG nextflow.Session - Observer factory: DefaultObserverFactory +May-14 01:14:52.078 [main] WARN nextflow.config.Manifest - Invalid config manifest attribute `contributors` +May-14 01:14:52.090 [main] DEBUG nextflow.cache.CacheFactory - Using Nextflow cache factory: nextflow.cache.DefaultCacheFactory +May-14 01:14:52.094 [main] DEBUG nextflow.util.CustomThreadPool - Creating default thread pool > poolSize: 15; maxThreads: 1000 +May-14 01:14:52.123 [main] DEBUG nextflow.Session - Session start +May-14 01:14:52.124 [main] DEBUG nextflow.trace.TraceFileObserver - Workflow started -- trace file: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/trace.csv +May-14 01:14:52.252 [main] DEBUG nextflow.script.ScriptRunner - > Launching execution +May-14 01:14:52.569 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: null +May-14 01:14:52.570 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local' +May-14 01:14:52.572 [main] DEBUG nextflow.executor.Executor - [warm up] executor > local +May-14 01:14:52.574 [main] DEBUG n.processor.LocalPollingMonitor - Creating local task monitor for executor 'local' > cpus=14; memory=96 GB; capacity=14; pollInterval=100ms; dumpInterval=5m +May-14 01:14:52.576 [main] DEBUG n.processor.TaskPollingMonitor - >>> barrier register (monitor: local) +May-14 01:14:52.605 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: null +May-14 01:14:52.606 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local' +May-14 01:14:52.611 [main] DEBUG nextflow.script.ProcessConfig - Config settings `withLabel:process_single` matches labels `process_single` for process with name HMMER_ANNOTATION:HMMER_HMMPRESS +May-14 01:14:52.612 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: null +May-14 01:14:52.612 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local' +May-14 01:14:52.632 [main] DEBUG nextflow.script.ProcessConfig - Config settings `withLabel:process_medium` matches labels `process_medium` for process with name HMMER_ANNOTATION:HMMER_HMMSEARCH +May-14 01:14:52.634 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: null +May-14 01:14:52.634 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local' +May-14 01:14:52.653 [main] DEBUG nextflow.Session - Config process names validation disabled as requested +May-14 01:14:52.654 [main] DEBUG nextflow.Session - Igniting dataflow network (7) +May-14 01:14:52.655 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > HMMER_ANNOTATION:DECOMPRESS_HMM +May-14 01:14:52.655 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > HMMER_ANNOTATION:DECOMPRESS_PROTEINS +May-14 01:14:52.655 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > HMMER_ANNOTATION:HMMER_HMMPRESS +May-14 01:14:52.655 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > HMMER_ANNOTATION:HMMER_HMMSEARCH +May-14 01:14:52.655 [main] DEBUG nextflow.script.ScriptRunner - Parsed script files: + Script_e7e322f88f35de2e: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test-67aaf421e02387adceb68ea1093eea83.nf + Script_bccdacc34e930bc6: /Users/saba.nafees/code/nextflow/proteinannotator/subworkflows/local/hmmer/tests/../../../../modules/nf-core/hmmer/hmmsearch/main.nf + Script_f4a1ea36ac7c6f03: /Users/saba.nafees/code/nextflow/proteinannotator/subworkflows/local/hmmer/tests/../../../../modules/nf-core/hmmer/hmmpress/main.nf + Script_21a3e529e694b262: /Users/saba.nafees/code/nextflow/proteinannotator/subworkflows/local/hmmer/tests/../main.nf +May-14 01:14:52.655 [main] DEBUG nextflow.script.ScriptRunner - > Awaiting termination +May-14 01:14:52.655 [main] DEBUG nextflow.Session - Session await +May-14 01:14:52.728 [FileTransfer-1] DEBUG nextflow.file.FilePorter - Copying foreign file https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz to work dir: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/stage-58ad274a-474b-4ac7-9a94-c1e9bf36c8ad/7c/ba98106efb21d743695f76bf878eea/e_coli_k12_16s.fna.gz +May-14 01:14:52.728 [FileTransfer-2] DEBUG nextflow.file.FilePorter - Copying foreign file https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz to work dir: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/stage-58ad274a-474b-4ac7-9a94-c1e9bf36c8ad/d9/fc6896eac155200a8ab60b55b99e0e/bac.16S_rRNA.hmm.gz +May-14 01:14:52.846 [Task submitter] WARN n.executor.BashWrapperBuilder - Task runtime metrics are not reported when using macOS without a container engine +May-14 01:14:52.853 [Task submitter] DEBUG n.executor.local.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run +May-14 01:14:52.854 [Task submitter] INFO nextflow.Session - [a8/1988a6] Submitted process > HMMER_ANNOTATION:DECOMPRESS_PROTEINS (test_protein) +May-14 01:14:52.859 [Task submitter] DEBUG n.executor.local.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run +May-14 01:14:52.860 [Task submitter] INFO nextflow.Session - [0c/cca9d6] Submitted process > HMMER_ANNOTATION:DECOMPRESS_HMM (test_hmm) +May-14 01:14:52.938 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 2; name: HMMER_ANNOTATION:DECOMPRESS_PROTEINS (test_protein); status: COMPLETED; exit: 0; error: -; workDir: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/a8/1988a6d2e4f887f2a9328a099f23a7] +May-14 01:14:52.938 [Task monitor] DEBUG nextflow.util.ThreadPoolBuilder - Creating thread pool 'TaskFinalizer' minSize=10; maxSize=42; workQueue=LinkedBlockingQueue[10000]; allowCoreThreadTimeout=false +May-14 01:14:52.943 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 1; name: HMMER_ANNOTATION:DECOMPRESS_HMM (test_hmm); status: COMPLETED; exit: 0; error: -; workDir: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/0c/cca9d6e3102359210f1879d26ac697] +May-14 01:14:52.963 [TaskFinalizer-2] WARN nextflow.processor.PublishDir - Process `HMMER_ANNOTATION:DECOMPRESS_HMM` publishDir path contains a variable with a null value +May-14 01:14:52.963 [TaskFinalizer-1] WARN nextflow.processor.PublishDir - Process `HMMER_ANNOTATION:DECOMPRESS_PROTEINS` publishDir path contains a variable with a null value +May-14 01:14:52.967 [TaskFinalizer-2] DEBUG nextflow.util.ThreadPoolBuilder - Creating thread pool 'PublishDir' minSize=10; maxSize=42; workQueue=LinkedBlockingQueue[10000]; allowCoreThreadTimeout=false +May-14 01:14:52.969 [Task submitter] DEBUG n.executor.local.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run +May-14 01:14:52.969 [Task submitter] INFO nextflow.Session - [12/3df667] Submitted process > HMMER_ANNOTATION:HMMER_HMMPRESS (test_hmm) +May-14 01:14:52.973 [Task submitter] DEBUG n.executor.local.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run +May-14 01:14:52.973 [Task submitter] INFO nextflow.Session - [73/044ac4] Submitted process > HMMER_ANNOTATION:HMMER_HMMSEARCH (test_protein) +May-14 01:14:53.092 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 3; name: HMMER_ANNOTATION:HMMER_HMMPRESS (test_hmm); status: COMPLETED; exit: 0; error: -; workDir: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d] +May-14 01:14:53.095 [TaskFinalizer-3] WARN nextflow.processor.PublishDir - Process `HMMER_ANNOTATION:HMMER_HMMPRESS` publishDir path contains a variable with a null value +May-14 01:14:53.159 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 4; name: HMMER_ANNOTATION:HMMER_HMMSEARCH (test_protein); status: COMPLETED; exit: 0; error: -; workDir: /Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952] +May-14 01:14:53.163 [TaskFinalizer-4] WARN nextflow.processor.PublishDir - Process `HMMER_ANNOTATION:HMMER_HMMSEARCH` publishDir path contains a variable with a null value +May-14 01:14:53.165 [main] DEBUG nextflow.Session - Session await > all processes finished +May-14 01:14:53.264 [Task monitor] DEBUG n.processor.TaskPollingMonitor - <<< barrier arrives (monitor: local) - terminating tasks monitor poll loop +May-14 01:14:53.264 [main] DEBUG nextflow.Session - Session await > all barriers passed +May-14 01:14:53.266 [main] DEBUG nextflow.util.ThreadPoolManager - Thread pool 'TaskFinalizer' shutdown completed (hard=false) +May-14 01:14:53.266 [main] DEBUG nextflow.util.ThreadPoolManager - Thread pool 'PublishDir' shutdown completed (hard=false) +May-14 01:14:53.275 [main] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=4; failedCount=0; ignoredCount=0; cachedCount=0; pendingCount=0; submittedCount=0; runningCount=0; retriesCount=0; abortedCount=0; succeedDuration=696ms; failedDuration=0ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=2; peakCpus=7; peakMemory=42 GB; ] +May-14 01:14:53.275 [main] DEBUG nextflow.trace.TraceFileObserver - Workflow completed -- saving trace file +May-14 01:14:53.275 [main] DEBUG nextflow.trace.ReportObserver - Workflow completed -- rendering execution report +May-14 01:14:53.774 [main] DEBUG nextflow.trace.TimelineObserver - Workflow completed -- rendering execution timeline +May-14 01:14:53.844 [main] DEBUG nextflow.cache.CacheDB - Closing CacheDB done +May-14 01:14:53.852 [main] INFO org.pf4j.AbstractPluginManager - Stop plugin 'nf-schema@2.2.0' +May-14 01:14:53.852 [main] DEBUG nextflow.plugin.BasePlugin - Plugin stopped nf-schema +May-14 01:14:53.852 [main] DEBUG nextflow.util.ThreadPoolManager - Thread pool 'FileTransfer' shutdown completed (hard=false) +May-14 01:14:53.852 [main] DEBUG nextflow.script.ScriptRunner - > Execution complete -- Goodbye diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_0.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_0.json new file mode 100644 index 0000000..10452d6 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_0.json @@ -0,0 +1 @@ +{"0":[[{"id":"test_hmm"},["/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3f","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3i","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3m","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3p"]]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_1.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_1.json new file mode 100644 index 0000000..f7ca511 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_1.json @@ -0,0 +1 @@ +{"1":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.txt.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_2.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_2.json new file mode 100644 index 0000000..34345ee --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_2.json @@ -0,0 +1 @@ +{"2":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.domtbl.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_3.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_3.json new file mode 100644 index 0000000..99e4ace --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_3.json @@ -0,0 +1 @@ +{"3":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.tbl.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_4.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_4.json new file mode 100644 index 0000000..0894a4a --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_4.json @@ -0,0 +1 @@ +{"4":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.sto.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_5.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_5.json new file mode 100644 index 0000000..2cf55d4 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_5.json @@ -0,0 +1 @@ +{"5":["/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/versions.yml","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/versions.yml"]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_alignments.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_alignments.json new file mode 100644 index 0000000..94a6e20 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_alignments.json @@ -0,0 +1 @@ +{"alignments":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.sto.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_domain_summary.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_domain_summary.json new file mode 100644 index 0000000..592df93 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_domain_summary.json @@ -0,0 +1 @@ +{"domain_summary":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.domtbl.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_pressed_db.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_pressed_db.json new file mode 100644 index 0000000..a01e0b4 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_pressed_db.json @@ -0,0 +1 @@ +{"pressed_db":[[{"id":"test_hmm"},["/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3f","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3i","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3m","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/bac.16S_rRNA.hmm.h3p"]]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_target_summary.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_target_summary.json new file mode 100644 index 0000000..65ff98f --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_target_summary.json @@ -0,0 +1 @@ +{"target_summary":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.tbl.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_txt_output.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_txt_output.json new file mode 100644 index 0000000..a6bc34f --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_txt_output.json @@ -0,0 +1 @@ +{"txt_output":[[{"id":"test_protein"},"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/test_protein.txt.gz"]]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_versions.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_versions.json new file mode 100644 index 0000000..9c19987 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/output_versions.json @@ -0,0 +1 @@ +{"versions":["/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/12/3df6677fcee297119e730c26d2869d/versions.yml","/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/work/73/044ac4d02da6ece722d5d629a93952/versions.yml"]} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/params.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/params.json new file mode 100644 index 0000000..527fe9a --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/params.json @@ -0,0 +1 @@ +{"nf_test_output":"/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta"} \ No newline at end of file diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/std.err b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/std.err new file mode 100644 index 0000000..5890cc1 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/std.err @@ -0,0 +1 @@ +Nextflow 25.04.2 is available - Please consider updating your version to it(B diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/std.out b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/std.out new file mode 100644 index 0000000..dae8292 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/std.out @@ -0,0 +1,12 @@ +N E X T F L O W ~ version 24.04.2 +Launching `/Users/saba.nafees/code/nextflow/proteinannotator/.nf-test-67aaf421e02387adceb68ea1093eea83.nf` [confident_hamilton] DSL2 - revision: b9589f0468 +WARN: Invalid config manifest attribute `contributors` +WARN: Task runtime metrics are not reported when using macOS without a container engine +[a8/1988a6] Submitted process > HMMER_ANNOTATION:DECOMPRESS_PROTEINS (test_protein) +[0c/cca9d6] Submitted process > HMMER_ANNOTATION:DECOMPRESS_HMM (test_hmm) +WARN: Process `HMMER_ANNOTATION:DECOMPRESS_HMM` publishDir path contains a variable with a null value +WARN: Process `HMMER_ANNOTATION:DECOMPRESS_PROTEINS` publishDir path contains a variable with a null value +[12/3df667] Submitted process > HMMER_ANNOTATION:HMMER_HMMPRESS (test_hmm) +[73/044ac4] Submitted process > HMMER_ANNOTATION:HMMER_HMMSEARCH (test_protein) +WARN: Process `HMMER_ANNOTATION:HMMER_HMMPRESS` publishDir path contains a variable with a null value +WARN: Process `HMMER_ANNOTATION:HMMER_HMMSEARCH` publishDir path contains a variable with a null value diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/trace.csv b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/trace.csv new file mode 100644 index 0000000..395559b --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/trace.csv @@ -0,0 +1,5 @@ +task_id hash native_id name status exit submit duration realtime %cpu peak_rss peak_vmem rchar wchar +1 0c/cca9d6 54190 HMMER_ANNOTATION:DECOMPRESS_HMM (test_hmm) COMPLETED 0 2025-05-14 01:14:52.860 83ms 15ms - - - - - +2 a8/1988a6 54188 HMMER_ANNOTATION:DECOMPRESS_PROTEINS (test_protein) COMPLETED 0 2025-05-14 01:14:52.854 82ms 16ms - - - - - +3 12/3df667 54228 HMMER_ANNOTATION:HMMER_HMMPRESS (test_hmm) COMPLETED 0 2025-05-14 01:14:52.969 122ms 53ms - - - - - +4 73/044ac4 54230 HMMER_ANNOTATION:HMMER_HMMSEARCH (test_protein) COMPLETED 0 2025-05-14 01:14:52.973 186ms 102ms - - - - - diff --git a/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/workflow.json b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/workflow.json new file mode 100644 index 0000000..7d54df0 --- /dev/null +++ b/.nf-test/tests/67aaf421e02387adceb68ea1093eea83/meta/workflow.json @@ -0,0 +1 @@ +{"success":true,"exitStatus":0} \ No newline at end of file diff --git a/modules.json b/modules.json index 58e1d30..a666118 100644 --- a/modules.json +++ b/modules.json @@ -5,6 +5,21 @@ "https://github.com/nf-core/modules.git": { "modules": { "nf-core": { + "gunzip": { + "branch": "master", + "git_sha": "05954dab2ff481bcb999f24455da29a5828af08d", + "installed_by": ["modules"] + }, + "hmmer/hmmpress": { + "branch": "master", + "git_sha": "26b0fc18fe9c717394e05482e65d8434556f24e1", + "installed_by": ["modules"] + }, + "hmmer/hmmsearch": { + "branch": "master", + "git_sha": "05954dab2ff481bcb999f24455da29a5828af08d", + "installed_by": ["modules"] + }, "multiqc": { "branch": "master", "git_sha": "f0719ae309075ae4a291533883847c3f7c441dad", diff --git a/modules/nf-core/gunzip/environment.yml b/modules/nf-core/gunzip/environment.yml new file mode 100644 index 0000000..9b926b1 --- /dev/null +++ b/modules/nf-core/gunzip/environment.yml @@ -0,0 +1,12 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::coreutils=9.5 + - conda-forge::grep=3.11 + - conda-forge::gzip=1.13 + - conda-forge::lbzip2=2.5 + - conda-forge::sed=4.8 + - conda-forge::tar=1.34 diff --git a/modules/nf-core/gunzip/main.nf b/modules/nf-core/gunzip/main.nf new file mode 100644 index 0000000..3ffc8e9 --- /dev/null +++ b/modules/nf-core/gunzip/main.nf @@ -0,0 +1,55 @@ +process GUNZIP { + tag "${archive}" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/52/52ccce28d2ab928ab862e25aae26314d69c8e38bd41ca9431c67ef05221348aa/data' + : 'community.wave.seqera.io/library/coreutils_grep_gzip_lbzip2_pruned:838ba80435a629f8'}" + + input: + tuple val(meta), path(archive) + + output: + tuple val(meta), path("${gunzip}"), emit: gunzip + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def extension = (archive.toString() - '.gz').tokenize('.')[-1] + def name = archive.toString() - '.gz' - ".${extension}" + def prefix = task.ext.prefix ?: name + gunzip = prefix + ".${extension}" + """ + # Not calling gunzip itself because it creates files + # with the original group ownership rather than the + # default one for that user / the work directory + gzip \\ + -cd \\ + ${args} \\ + ${archive} \\ + > ${gunzip} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def extension = (archive.toString() - '.gz').tokenize('.')[-1] + def name = archive.toString() - '.gz' - ".${extension}" + def prefix = task.ext.prefix ?: name + gunzip = prefix + ".${extension}" + """ + touch ${gunzip} + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//') + END_VERSIONS + """ +} diff --git a/modules/nf-core/gunzip/meta.yml b/modules/nf-core/gunzip/meta.yml new file mode 100644 index 0000000..69d3102 --- /dev/null +++ b/modules/nf-core/gunzip/meta.yml @@ -0,0 +1,47 @@ +name: gunzip +description: Compresses and decompresses files. +keywords: + - gunzip + - compression + - decompression +tools: + - gunzip: + description: | + gzip is a file format and a software application used for file compression and decompression. + documentation: https://www.gnu.org/software/gzip/manual/gzip.html + licence: ["GPL-3.0-or-later"] + identifier: "" +input: + - - meta: + type: map + description: | + Optional groovy Map containing meta information + e.g. [ id:'test', single_end:false ] + - archive: + type: file + description: File to be compressed/uncompressed + pattern: "*.*" +output: + - gunzip: + - meta: + type: file + description: Compressed/uncompressed file + pattern: "*.*" + - ${gunzip}: + type: file + description: Compressed/uncompressed file + pattern: "*.*" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@joseespinosa" + - "@drpatelh" + - "@jfy133" +maintainers: + - "@joseespinosa" + - "@drpatelh" + - "@jfy133" + - "@gallvp" diff --git a/modules/nf-core/gunzip/tests/main.nf.test b/modules/nf-core/gunzip/tests/main.nf.test new file mode 100644 index 0000000..776211a --- /dev/null +++ b/modules/nf-core/gunzip/tests/main.nf.test @@ -0,0 +1,121 @@ +nextflow_process { + + name "Test Process GUNZIP" + script "../main.nf" + process "GUNZIP" + tag "gunzip" + tag "modules_nfcore" + tag "modules" + + test("Should run without failures") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("Should run without failures - prefix") { + + config './nextflow.config' + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [ id: 'test' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("Should run without failures - stub") { + + options '-stub' + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("Should run without failures - prefix - stub") { + + options '-stub' + config './nextflow.config' + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [ id: 'test' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/gunzip/tests/main.nf.test.snap b/modules/nf-core/gunzip/tests/main.nf.test.snap new file mode 100644 index 0000000..a0f0e67 --- /dev/null +++ b/modules/nf-core/gunzip/tests/main.nf.test.snap @@ -0,0 +1,134 @@ +{ + "Should run without failures - prefix - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.xyz.fastq:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ], + "gunzip": [ + [ + { + "id": "test" + }, + "test.xyz.fastq:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-13T11:48:22.080222697" + }, + "Should run without failures - stub": { + "content": [ + { + "0": [ + [ + [ + + ], + "test_1.fastq:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ], + "gunzip": [ + [ + [ + + ], + "test_1.fastq:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-13T11:48:14.593020264" + }, + "Should run without failures": { + "content": [ + { + "0": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "1": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ], + "gunzip": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "versions": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-13T11:48:01.295397925" + }, + "Should run without failures - prefix": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.xyz.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "1": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ], + "gunzip": [ + [ + { + "id": "test" + }, + "test.xyz.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "versions": [ + "versions.yml:md5,d327e4a19a6d5c5e974136cef8999d8c" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-13T11:48:07.414271387" + } +} \ No newline at end of file diff --git a/modules/nf-core/gunzip/tests/nextflow.config b/modules/nf-core/gunzip/tests/nextflow.config new file mode 100644 index 0000000..dec7764 --- /dev/null +++ b/modules/nf-core/gunzip/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: GUNZIP { + ext.prefix = { "${meta.id}.xyz" } + } +} diff --git a/modules/nf-core/hmmer/hmmpress/environment.yml b/modules/nf-core/hmmer/hmmpress/environment.yml new file mode 100644 index 0000000..1967d40 --- /dev/null +++ b/modules/nf-core/hmmer/hmmpress/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::hmmer=3.4 diff --git a/modules/nf-core/hmmer/hmmpress/main.nf b/modules/nf-core/hmmer/hmmpress/main.nf new file mode 100644 index 0000000..bde9a86 --- /dev/null +++ b/modules/nf-core/hmmer/hmmpress/main.nf @@ -0,0 +1,48 @@ +process HMMER_HMMPRESS { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hmmer:3.4--hdbdd923_1' : + 'biocontainers/hmmer:3.4--hdbdd923_1' }" + + input: + tuple val(meta), path(hmmfile) + + output: + tuple val(meta), path("*.h3?"), emit: compressed_db + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + + """ + hmmpress \\ + $args \\ + ${hmmfile} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hmmer: \$(echo \$(hmmpress -h | grep HMMER | sed 's/# HMMER //' | sed 's/ .*//' 2>&1)) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "stub" + + """ + touch ${prefix}.h3m + touch ${prefix}.h3i + touch ${prefix}.h3f + touch ${prefix}.h3p + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hmmer: \$(echo \$(hmmpress -h | grep HMMER | sed 's/# HMMER //' | sed 's/ .*//' 2>&1)) + END_VERSIONS + """ +} diff --git a/modules/nf-core/hmmer/hmmpress/meta.yml b/modules/nf-core/hmmer/hmmpress/meta.yml new file mode 100644 index 0000000..7e730ab --- /dev/null +++ b/modules/nf-core/hmmer/hmmpress/meta.yml @@ -0,0 +1,47 @@ +name: "hmmer_hmmpress" +description: compress and index profile database for hmmscan +keywords: + - hidden Markov model + - HMM + - hmmer + - hmmpress + - hmmscan +tools: + - "hmmer": + description: "Biosequence analysis using profile hidden Markov models" + homepage: "http://hmmer.org" + documentation: "http://hmmer.org/documentation.html" + tool_dev_url: "https://github.com/EddyRivasLab/hmmer" + doi: "10.1371/journal.pcbi.1002195" + licence: ["BSD"] + identifier: biotools:hmmer +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - hmmfile: + type: file + description: HMMER flatfile database of HMM profiles + pattern: "*" +output: + - compressed_db: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.h3?": + type: list + description: Binary files with compressed profiles and their index + pattern: "*.h3?" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@ochkalova" +maintainers: + - "@ochkalova" diff --git a/modules/nf-core/hmmer/hmmpress/tests/main.nf.test b/modules/nf-core/hmmer/hmmpress/tests/main.nf.test new file mode 100644 index 0000000..896a9ed --- /dev/null +++ b/modules/nf-core/hmmer/hmmpress/tests/main.nf.test @@ -0,0 +1,66 @@ + +nextflow_process { + + name "Test Process HMMER_HMMPRESS" + script "../main.nf" + process "HMMER_HMMPRESS" + + tag "modules" + tag "modules_nfcore" + tag "hmmer" + tag "hmmer/hmmpress" + tag "gunzip" + + setup { + run("GUNZIP") { + script "../../../gunzip" + + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.hmm.gz', checkIfExists: true) + ] + """ + } + } + } + + test("sarscov2 - proteome - hmm - gz") { + + when { + process { + """ + input[0] = GUNZIP.out.gunzip + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 - proteome - hmm - gz - stub") { + options '-stub' + + when { + process { + """ + input[0] = GUNZIP.out.gunzip + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/hmmer/hmmpress/tests/main.nf.test.snap b/modules/nf-core/hmmer/hmmpress/tests/main.nf.test.snap new file mode 100644 index 0000000..8735e77 --- /dev/null +++ b/modules/nf-core/hmmer/hmmpress/tests/main.nf.test.snap @@ -0,0 +1,88 @@ +{ + "sarscov2 - proteome - hmm - gz": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "proteome.hmm.h3f:md5,d0640e710a5eec56aa95a64e6dcb9971", + "proteome.hmm.h3i:md5,1e68ee61bfe47697e3df24b5551dbb82", + "proteome.hmm.h3m:md5,9fa27bd2fda0e8c037852301245dcbfb", + "proteome.hmm.h3p:md5,e73ab76f194340b797e8485464caa369" + ] + ] + ], + "1": [ + "versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6" + ], + "compressed_db": [ + [ + { + "id": "test" + }, + [ + "proteome.hmm.h3f:md5,d0640e710a5eec56aa95a64e6dcb9971", + "proteome.hmm.h3i:md5,1e68ee61bfe47697e3df24b5551dbb82", + "proteome.hmm.h3m:md5,9fa27bd2fda0e8c037852301245dcbfb", + "proteome.hmm.h3p:md5,e73ab76f194340b797e8485464caa369" + ] + ] + ], + "versions": [ + "versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-25T14:43:13.712539" + }, + "sarscov2 - proteome - hmm - gz - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "stub.h3f:md5,d41d8cd98f00b204e9800998ecf8427e", + "stub.h3i:md5,d41d8cd98f00b204e9800998ecf8427e", + "stub.h3m:md5,d41d8cd98f00b204e9800998ecf8427e", + "stub.h3p:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + "versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6" + ], + "compressed_db": [ + [ + { + "id": "test" + }, + [ + "stub.h3f:md5,d41d8cd98f00b204e9800998ecf8427e", + "stub.h3i:md5,d41d8cd98f00b204e9800998ecf8427e", + "stub.h3m:md5,d41d8cd98f00b204e9800998ecf8427e", + "stub.h3p:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions": [ + "versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-25T14:43:19.740161" + } +} \ No newline at end of file diff --git a/modules/nf-core/hmmer/hmmsearch/environment.yml b/modules/nf-core/hmmer/hmmsearch/environment.yml new file mode 100644 index 0000000..1967d40 --- /dev/null +++ b/modules/nf-core/hmmer/hmmsearch/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::hmmer=3.4 diff --git a/modules/nf-core/hmmer/hmmsearch/main.nf b/modules/nf-core/hmmer/hmmsearch/main.nf new file mode 100644 index 0000000..603a865 --- /dev/null +++ b/modules/nf-core/hmmer/hmmsearch/main.nf @@ -0,0 +1,70 @@ +process HMMER_HMMSEARCH { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hmmer:3.4--hdbdd923_1' : + 'biocontainers/hmmer:3.4--hdbdd923_1' }" + + input: + tuple val(meta), path(hmmfile), path(seqdb), val(write_align), val(write_target), val(write_domain) + + output: + tuple val(meta), path('*.txt.gz') , emit: output + tuple val(meta), path('*.sto.gz') , emit: alignments , optional: true + tuple val(meta), path('*.tbl.gz') , emit: target_summary, optional: true + tuple val(meta), path('*.domtbl.gz'), emit: domain_summary, optional: true + 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}" + output = "${prefix}.txt" + alignment = write_align ? "-A ${prefix}.sto" : '' + target_summary = write_target ? "--tblout ${prefix}.tbl" : '' + domain_summary = write_domain ? "--domtblout ${prefix}.domtbl" : '' + """ + hmmsearch \\ + $args \\ + --cpu $task.cpus \\ + -o $output \\ + $alignment \\ + $target_summary \\ + $domain_summary \\ + $hmmfile \\ + $seqdb + + gzip --no-name *.txt \\ + ${write_align ? '*.sto' : ''} \\ + ${write_target ? '*.tbl' : ''} \\ + ${write_domain ? '*.domtbl' : ''} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hmmer: \$(hmmsearch -h | grep -o '^# HMMER [0-9.]*' | sed 's/^# HMMER *//') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch "${prefix}.txt" + ${write_align ? "touch ${prefix}.sto" : ''} \\ + ${write_target ? "touch ${prefix}.tbl" : ''} \\ + ${write_domain ? "touch ${prefix}.domtbl" : ''} + + gzip --no-name *.txt \\ + ${write_align ? '*.sto' : ''} \\ + ${write_target ? '*.tbl' : ''} \\ + ${write_domain ? '*.domtbl' : ''} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hmmer: \$(hmmsearch -h | grep -o '^# HMMER [0-9.]*' | sed 's/^# HMMER *//') + END_VERSIONS + """ +} diff --git a/modules/nf-core/hmmer/hmmsearch/meta.yml b/modules/nf-core/hmmer/hmmsearch/meta.yml new file mode 100644 index 0000000..0e07865 --- /dev/null +++ b/modules/nf-core/hmmer/hmmsearch/meta.yml @@ -0,0 +1,92 @@ +name: hmmer_hmmsearch +description: search profile(s) against a sequence database +keywords: + - Hidden Markov Model + - HMM + - hmmer + - hmmsearch +tools: + - hmmer: + description: Biosequence analysis using profile hidden Markov models + homepage: http://hmmer.org/ + documentation: http://hmmer.org/documentation.html + tool_dev_url: https://github.com/EddyRivasLab/hmmer + doi: "10.1371/journal.pcbi.1002195" + licence: ["BSD"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - hmmfile: + type: file + description: One or more HMM profiles created with hmmbuild + pattern: "*.{hmm,hmm.gz}" + - seqdb: + type: file + description: Database of sequences in FASTA format + pattern: "*.{fasta,fna,faa,fa,fasta.gz,fna.gz,faa.gz,fa.gz}" + - write_align: + type: boolean + description: Flag to save optional alignment output. Specify with 'true' to + save. + - write_target: + type: boolean + description: Flag to save optional per target summary. Specify with 'true' to + save. + - write_domain: + type: boolean + description: Flag to save optional per domain summary. Specify with 'true' to + save. +output: + - output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.txt.gz": + type: file + description: Human readable output summarizing hmmsearch results + pattern: "*.{txt.gz}" + - alignments: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.sto.gz": + type: file + description: Optional multiple sequence alignment (MSA) in Stockholm format + pattern: "*.{sto.gz}" + - target_summary: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.tbl.gz": + type: file + description: Optional tabular (space-delimited) summary of per-target output + pattern: "*.{tbl.gz}" + - domain_summary: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.domtbl.gz": + type: file + description: Optional tabular (space-delimited) summary of per-domain output + pattern: "*.{domtbl.gz}" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@Midnighter" +maintainers: + - "@Midnighter" diff --git a/modules/nf-core/hmmer/hmmsearch/tests/main.nf.test b/modules/nf-core/hmmer/hmmsearch/tests/main.nf.test new file mode 100644 index 0000000..f1b59e9 --- /dev/null +++ b/modules/nf-core/hmmer/hmmsearch/tests/main.nf.test @@ -0,0 +1,126 @@ +nextflow_process { + + name "Test Process HMMER_HMMSEARCH" + script "../main.nf" + process "HMMER_HMMSEARCH" + + tag "modules" + tag "modules_nfcore" + tag "hmmer" + tag "hmmer/hmmsearch" + + test("hmmer/hmmsearch") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz', checkIfExists: true), + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz', checkIfExists: true), + false, + false, + false + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.output[0][1]).linesGzip.toString().contains('[ok]') }, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + test("hmmer/hmmsearch - optional") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz', checkIfExists: true), + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz', checkIfExists: true), + true, + true, + true + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.output.get(0).get(1)).linesGzip.toString().contains('[ok]') }, + { assert path(process.out.target_summary.get(0).get(1)).linesGzip.toString().contains('[ok]') }, + { assert snapshot( + process.out.alignments + + process.out.versions + ).match() } + ) + } + + } + + test("hmmer/hmmsearch - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz', checkIfExists: true), + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz', checkIfExists: true), + false, + false, + false + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("hmmer/hmmsearch - optional - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz', checkIfExists: true), + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz', checkIfExists: true), + true, + true, + true + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/hmmer/hmmsearch/tests/main.nf.test.snap b/modules/nf-core/hmmer/hmmsearch/tests/main.nf.test.snap new file mode 100644 index 0000000..e6b2277 --- /dev/null +++ b/modules/nf-core/hmmer/hmmsearch/tests/main.nf.test.snap @@ -0,0 +1,175 @@ +{ + "hmmer/hmmsearch": { + "content": [ + [ + "versions.yml:md5,37393b1da5a14113d3290ab8b3b4c40f" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-28T12:18:47.293093635" + }, + "hmmer/hmmsearch - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + "versions.yml:md5,37393b1da5a14113d3290ab8b3b4c40f" + ], + "alignments": [ + + ], + "domain_summary": [ + + ], + "output": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "target_summary": [ + + ], + "versions": [ + "versions.yml:md5,37393b1da5a14113d3290ab8b3b4c40f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-28T12:18:57.862047944" + }, + "hmmer/hmmsearch - optional - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sto.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tbl.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.domtbl.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + "versions.yml:md5,37393b1da5a14113d3290ab8b3b4c40f" + ], + "alignments": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sto.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "domain_summary": [ + [ + { + "id": "test", + "single_end": false + }, + "test.domtbl.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "output": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "target_summary": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tbl.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,37393b1da5a14113d3290ab8b3b4c40f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-28T12:19:03.49192788" + }, + "hmmer/hmmsearch - optional": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.sto.gz:md5,5c44c289b9e36aa1f7f3afae2005fbb7" + ], + "versions.yml:md5,37393b1da5a14113d3290ab8b3b4c40f" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-28T12:18:52.725638562" + } +} \ No newline at end of file diff --git a/subworkflows/local/functional_annotation/main.nf b/subworkflows/local/functional_annotation/main.nf index af1134b..7878de6 100644 --- a/subworkflows/local/functional_annotation/main.nf +++ b/subworkflows/local/functional_annotation/main.nf @@ -1,5 +1,10 @@ -workflow FUNCTIONAL_ANNOTATION { +// +// Functional annotation of protein sequences +// +include { HMMER } from '../hmmer/main' +workflow FUNCTIONAL_ANNOTATION { + // TODO nf-core: substitute modules here for the modules of your subworkflow take: ch_fasta // channel: [ val(meta), [ fasta ] ] @@ -7,11 +12,29 @@ workflow FUNCTIONAL_ANNOTATION { ch_versions = Channel.empty() - // TODO nf-core: substitute modules here for the modules of your subworkflow - + // SUBWORKFLOW: HMMER domain annotation + // + if (params.run_hmmer && params.hmm_db) { + // Prepare HMM database channel + ch_hmm_db = Channel + .fromPath(params.hmm_db, checkIfExists: true) + .map { hmm -> + def meta = [:] + meta.id = hmm.baseName + [ meta, hmm ] + } + HMMER ( + ch_proteins, + ch_hmm_db + ) + ch_versions = ch_versions.mix(HMMER.out.versions) + } + // TODO: Add other annotation tools in the future emit: - // TODO nf-core: edit emitted channels - - versions = ch_versions // channel: [ versions.yml ] + hmmer_domtblout = params.run_hmmer ? HMMER.out.domtblout : Channel.empty() + hmmer_results = params.run_hmmer ? HMMER.out.search_results : Channel.empty() + hmmer_target_summary = params.run_hmmer ? HMMER.out.target_summary : Channel.empty() + hmmer_alignments = params.run_hmmer ? HMMER.out.domain_alignments : Channel.empty() + versions = ch_versions } diff --git a/subworkflows/local/functional_annotation/meta.yml b/subworkflows/local/functional_annotation/meta.yml index cf6ee7a..7a703c9 100644 --- a/subworkflows/local/functional_annotation/meta.yml +++ b/subworkflows/local/functional_annotation/meta.yml @@ -1,17 +1,46 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json name: "functional_annotation" -description: Functional annotation of proteins +description: "Perform functional annotation of protein sequences" keywords: - - fasta + - annotation + - protein + - function + - domains + - hmmer components: + - hmmer input: - - ch_fasta: + - ch_proteins: type: file description: | - The input channel containing the fasta files + Channel containing protein sequences in FASTA format Structure: [ val(meta), path(fasta) ] - pattern: "*.{fa,fasta,fa.gz,fasta.gz}" + pattern: "*.{fasta,fa,faa}" output: + - hmmer_domtblout: + type: file + description: | + HMMER domain table output + Structure: [ val(meta), path(domtblout) ] + pattern: "*.domtblout" + - hmmer_results: + type: file + description: | + HMMER search results + Structure: [ val(meta), path(txt) ] + pattern: "*.txt" + - hmmer_target_summary: + type: file + description: | + HMMER per-target summary table + Structure: [ val(meta), path(tblout) ] + pattern: "*.tblout" + - hmmer_alignments: + type: file + description: | + HMMER domain alignments (optional) + Structure: [ val(meta), path(sto) ] + pattern: "*.sto" - versions: type: file description: | @@ -19,6 +48,6 @@ output: Structure: [ path(versions.yml) ] pattern: "versions.yml" authors: - - "@eweizy" + - "@snafees" maintainers: - - "@eweizy" + - "@snafees" diff --git a/subworkflows/local/functional_annotation/tests/main.nf.test b/subworkflows/local/functional_annotation/tests/main.nf.test index 06cba21..72c94e0 100644 --- a/subworkflows/local/functional_annotation/tests/main.nf.test +++ b/subworkflows/local/functional_annotation/tests/main.nf.test @@ -2,44 +2,35 @@ // nf-core subworkflows test functional_annotation nextflow_workflow { - name "Test Subworkflow FUNCTIONAL_ANNOTATION" + name "Test Workflow FUNCTIONAL_ANNOTATION" script "../main.nf" workflow "FUNCTIONAL_ANNOTATION" - tag "subworkflows" - tag "subworkflows_" - tag "subworkflows/functional_annotation" - // TODO nf-core: Add tags for all modules used within this subworkflow. Example: - tag "samtools" - tag "samtools/sort" - tag "samtools/index" - - - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam - single_end") { + test("Test functional annotation with HMMER") { when { workflow { """ - // TODO nf-core: define inputs of the workflow here. Example: - input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), - ] - input[1] = [ - [ id:'genome' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), - ] + // Create test protein channel + input[0] = Channel.of( + [ + [ id:'test_protein' ], + file("${projectDir}/test-datasets/proteins/test.fasta", checkIfExists: true) + ] + ) """ } + params { + run_hmmer = true + hmm_db = "${projectDir}/test-datasets/hmm/test.hmm" + } } then { - assertAll( - { assert workflow.success}, - { assert snapshot(workflow.out).match()} - //TODO nf-core: Add all required assertions to verify the test output. - ) + assert workflow.success + assert workflow.out.hmmer_domtblout + assert workflow.out.hmmer_results + assert workflow.out.versions } } } diff --git a/subworkflows/local/hmmer/main.nf b/subworkflows/local/hmmer/main.nf new file mode 100644 index 0000000..d76f64c --- /dev/null +++ b/subworkflows/local/hmmer/main.nf @@ -0,0 +1,85 @@ +// TODO nf-core: If in doubt look at other nf-core/subworkflows to see how we are doing things! :) +// https://github.com/nf-core/modules/tree/master/subworkflows +// You can also ask for help via your pull request or on the #subworkflows channel on the nf-core Slack workspace: +// https://nf-co.re/join +// TODO nf-core: A subworkflow SHOULD import at least two modules + +include { HMMER_HMMPRESS } from '../../../modules/nf-core/hmmer/hmmpress/main' +include { HMMER_HMMSEARCH } from '../../../modules/nf-core/hmmer/hmmsearch/main' + +process DECOMPRESS_HMM { + tag "$meta.id" + input: + tuple val(meta), path(file_in) + output: + tuple val(meta), path("*.hmm"), emit: decompressed + script: + def file_out = file_in.baseName + """ + if [[ ${file_in} == *.gz ]]; then + gunzip -c ${file_in} > ${file_out} + else + ln -s ${file_in} ${file_out} + fi + """ +} +process DECOMPRESS_PROTEINS { + tag "$meta.id" + input: + tuple val(meta), path(file_in) + output: + tuple val(meta), path("*.{fasta,fna,fa,faa}"), emit: decompressed + script: + def file_out = file_in.baseName + """ + if [[ ${file_in} == *.gz ]]; then + gunzip -c ${file_in} > ${file_out} + else + ln -s ${file_in} ${file_out} + fi + """ +} + +workflow HMMER_ANNOTATION { + take: + ch_proteins // channel: [ val(meta), path(fasta) ] + ch_hmm_db // channel: [ val(meta), path(hmm) ] + main: + ch_versions = Channel.empty() + // + // Decompress HMM files if needed + + // Process HMM files + DECOMPRESS_HMM(ch_hmm_db) + ch_hmm_ready = DECOMPRESS_HMM.out.decompressed + // Process protein files + DECOMPRESS_PROTEINS(ch_proteins) + ch_proteins_ready = DECOMPRESS_PROTEINS.out.decompressed + // MODULE: Prepare HMM database with hmmpress + + HMMER_HMMPRESS ( + ch_hmm_ready + ) + // + // MODULE: Run HMMER hmmsearch + // + ch_hmmsearch_input = ch_proteins_ready + .combine(ch_hmm_ready) + .map { protein_meta, fasta, hmm_meta, hmm -> + // Use protein meta for the output, hmm first, then sequences + [ protein_meta, hmm, fasta, true, true, true ] + } + // + HMMER_HMMSEARCH ( + ch_hmmsearch_input + ) + ch_versions = ch_versions.mix(HMMER_HMMPRESS.out.versions) + ch_versions = ch_versions.mix(HMMER_HMMSEARCH.out.versions) + emit: + pressed_db = HMMER_HMMPRESS.out.compressed_db // channel: [ val(meta), path(hmm) ] + txt_output = HMMER_HMMSEARCH.out.output // channel: [ val(meta), path(txt) ] + domain_summary = HMMER_HMMSEARCH.out.domain_summary // channel: [ val(meta), path(domtblout) ] + target_summary = HMMER_HMMSEARCH.out.target_summary // channel: [ val(meta), path(tblout) ] + alignments = HMMER_HMMSEARCH.out.alignments // channel: [ val(meta), path(sto) ] + versions = ch_versions // channel: [ versions.yml ] +} diff --git a/subworkflows/local/hmmer/meta.yml b/subworkflows/local/hmmer/meta.yml new file mode 100644 index 0000000..545ca7d --- /dev/null +++ b/subworkflows/local/hmmer/meta.yml @@ -0,0 +1,71 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "hmmer" +## TODO nf-core: Add a description of the subworkflow and list keywords +description: Prepare HMM database and run HMMER hmmsearch for protein annotation +keywords: + - hmmer + - protein + - domain + - annotation + - hmmsearch + - hmmpress +## TODO nf-core: Add a list of the modules and/or subworkflows used in the subworkflow +components: + - hmmer/hmmpress + - hmmer/hmmsearch +## TODO nf-core: List all of the channels used as input with a description and their structure" +input: + - ch_proteins: + type: file + description: | + Channel containing protein sequences in FASTA format to search against HMM database + Structure: [ val(meta), path(fasta) ] + pattern: "*.{fasta,fna,fa,faa}" +- ch_hmm_db: + type: file + description: | + Channel containing HMM database file(s) (pressed or unpressed) + Structure: [ val(meta), path(hmm) ] + pattern: "*.{hmm}" +## TODO nf-core: List all of the channels used as output with a descriptions and their structure +output: + - pressed_db: + type: file + description: | + Pressed HMM database files ready for searching (includes .h3f, .h3i, .h3m, .h3p files) + Structure: [ val(meta), path(hmm), path(h3f), path(h3i), path(h3m), path(h3p) ] + pattern: "*.{hmm,h3f,h3i,h3m,h3p}" + - search_results: + type: file + description: | + HMMER hmmsearch standard output containing human-readable results + Structure: [ val(meta), path(txt) ] + pattern: "*.txt" + - domtblout: + type: file + description: | + Domain table output in tab-delimited format (--domtblout) + Structure: [ val(meta), path(domtblout) ] + pattern: "*.domtblout" + - target_summary: + type: file + description: | + Per-target summary table in tab-delimited format (--tblout) + Structure: [ val(meta), path(tblout) ] + pattern: "*.tblout" + - domain_alignments: + type: file + description: | + Domain alignments in Stockholm format (optional) + Structure: [ val(meta), path(sto) ] + pattern: "*.sto" + - versions: + type: file + description: | + File containing software versions + Structure: [ path(versions.yml) ] + pattern: "versions.yml" +authors: + - "@snafees" +maintainers: + - "@snafees" diff --git a/subworkflows/local/hmmer/tests/main.nf.test b/subworkflows/local/hmmer/tests/main.nf.test new file mode 100644 index 0000000..3da9c28 --- /dev/null +++ b/subworkflows/local/hmmer/tests/main.nf.test @@ -0,0 +1,42 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core subworkflows test hmmer + +nextflow_workflow { + + name "Test Workflow HMMER_ANNOTATION" + script "../main.nf" + workflow "HMMER_ANNOTATION" + + test("Test HMMER database preparation and search") { + + when { + workflow { + """ + // Create test protein channel + input[0] = Channel.of( + [ + [ id:'test_protein' ], + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz", checkIfExists: true) + ] + ) + // Create test HMM database channel (unpressed) + input[1] = Channel.of( + [ + [ id:'test_hmm' ], + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz", checkIfExists: true) + ] + ) + """ + } + } + + then { + assert workflow.success + assert workflow.out.pressed_db + assert workflow.out.txt_output + assert workflow.out.domain_summary + assert workflow.out.target_summary + assert workflow.out.versions + } + } +} diff --git a/workflows/proteinannotator.nf b/workflows/proteinannotator.nf index f7e4b65..2203f59 100644 --- a/workflows/proteinannotator.nf +++ b/workflows/proteinannotator.nf @@ -26,6 +26,19 @@ workflow PROTEINANNOTATOR { ch_versions = Channel.empty() ch_multiqc_files = Channel.empty() + // Create a multifasta, with one fasta per entry, add the sequence ID to the meta id + ch_fasta + .map { + meta, fasta -> + [ + [id:"${meta.id}_${fasta[0].splitFasta(record: [id: true]).id[0].replaceAll(/\|/, '-')}"] , + fasta[0].splitFasta(file:true) + ] + } + .transpose() + .view() + .set { ch_multifasta } + FUNCTIONAL_ANNOTATION ( ch_samplesheet ) @@ -33,6 +46,7 @@ workflow PROTEINANNOTATOR { // todo: move this to stats on input fasta subworkflow SEQKIT_STATS(ch_samplesheet) ch_versions = ch_versions.mix(SEQKIT_STATS.out.versions) + ch_versions = ch_versions.mix(FUNCTIONAL_ANNOTATION.out.versions) // // Collate and save software versions