Skip to main content
6 votes
Accepted

Autodetect max number of cores and pass as an argument in Nextflow

I have not read the full Nextflow manual in depth, but I think there is no Nextflow command to detect the maximum number of threads you can use. However, you can try to automatize this task by using ...
jxx_fa's user avatar
  • 1,062
6 votes
Accepted

Nextflow: dynamically setting resource directives for a process

It's possible to specify dynamic computing resources using a closure. For example, this sets the cpus and memory directives using the values supplied via the input declaration: ...
Steve's user avatar
  • 3,287
6 votes

Nextflow - Process has already been used

I believe adding a comma after val(sample_name) on line tuple val(sample_name) path(reads) will solve the issue. EDIT: Also ...
haci's user avatar
  • 4,202
5 votes
Accepted

Why are my Nextflow processes not executing in parallel?

I have tested it on my end with the following script: ...
user324810's user avatar
  • 1,135
5 votes

How to merge back the processes by sample after splitting by chromosome in Nextflow?

Use the groupBy operator. If the content of channel xasxa is: ...
Pallie's user avatar
  • 716
5 votes

How fo force nextflow to repeat a process until all values in a particular channels are used up BUT a single value from another channel is needed

I discovered a solution using a combination of .collect() and each. If one collects from a path the result is a value channel of ...
jh_'s user avatar
  • 101
5 votes
Accepted

Using SED command in Nextflow script

Inside your script's command string, assembly_id is actually a java.lang.String so trying to manipulate it with a Bash operation (i.e. using ...
Steve's user avatar
  • 3,287
5 votes
Accepted

How to solve Nextflow error: "Trace file already exists"?

Rotation of report files (trace, execution, timeline etc) was removed recently (since version 22.10.0 in a762ed5). To overwrite the existing trace file you will ...
Steve's user avatar
  • 3,287
5 votes

Easier / lazy way to convert an existing bash pipeline to nextflow pipeline?

If your objective is to convert Bash scripts into Nextflow code, you might find Viash (https://viash.io) a particularly useful open source tool. It automatically generates independent Nextflow modules ...
Andy Boschmans's user avatar
5 votes
Accepted

Nextflow Best Practice When Collecting a Large Number of Files in One Step

A better way would be to stage the files in a sub-directory, which would allow you to simply pass in a glob pattern to your tool. This can be achieved using the path...
Steve's user avatar
  • 3,287
4 votes
Accepted

Nextflow: No signature of Method: chr() is applicable for argument types; unknown variable

The documation re conditional scripts is useful here: Process scripts can contain conditional statements by simply prefixing the script block with the keyword ...
Steve's user avatar
  • 3,287
4 votes
Accepted

Nextflow: Can I parameterize similar processes inside a for loop?

Use channels, this is what nextflow's entire design is based on. I'm honestly surprised that spawning 5 processes with the same name in a loop even works. Turn your parameters into regular channels, ...
Pallie's user avatar
  • 716
4 votes
Accepted

Nextflow: how to create many-to-many tuple for process

The combine operator can be used to produce the Cartesian product: ...
Steve's user avatar
  • 3,287
4 votes
Accepted

Nextflow (DSL v2): how to best synchronize multiple outputs from a single process

Nextflow channels guarantee that items are delivered in the same order as they are sent. So if a process declares two (or more) output channels, the items that are emitted should already be ...
Steve's user avatar
  • 3,287
4 votes

Nextflow with Minimap2 not working

Command error: .command.sh: line 2: ./minimap2: No such file or directory Work dir: /Users/rimo/Desktop/AWS/minimap2/work/ae/47e3c0708f33b1949315fc83066b95 ...
Steve's user avatar
  • 3,287
4 votes
Accepted

How to handle output from a python script that gives different outputs depending upon the condition - Nextflow

You should be able to just use a glob pattern that accounts for all possible output files, regardless of the specified conditions. As long as a single file matches the glob pattern when the process ...
Steve's user avatar
  • 3,287
4 votes
Accepted

How to run a nextflow process for each file generated by another process separately - Input tuple does not match input set cardinality error

If the output channel produces a tuple where the first element is a simple value and the second element is a collection of files, like in this case, you can simply use the transpose operator to ...
Steve's user avatar
  • 3,287
3 votes

Nextflow: Can I parameterize similar processes inside a for loop?

You don't need to create processes in a loop when you have channels. The each qualifier allows you to repeat the execution of a process for each item in a collection. For example, the contents of '...
Steve's user avatar
  • 3,287
3 votes
Accepted

Merge multiple channels each emits multiple files in nextflow

The merge operator is deprecated and will be removed from future Nextflow releases. You'll need instead the join operator to join by chromosome. You can use the fromFilePairs operator to quickly get ...
Steve's user avatar
  • 3,287
3 votes

Master of Pores Installation Mac OS Mojave 10.14

you should not move nextflow within ~/master_of_pores/NanoPreProcess/bin . Just add nextflow in your path. ...
Luca Cozzuto's user avatar
3 votes

Run Nextflow with file dependencies inside a Docker container?

The following workaround seems to work but ideally I don’t want to have to change the script portion of my process so that it works with Docker. ...
Konrad Rudolph's user avatar
3 votes

Autodetect max number of cores and pass as an argument in Nextflow

Here's an example I wrote recently: ...
user324810's user avatar
  • 1,135
3 votes
Accepted

add task to nextflow and resume

It is actually very hard to answer this using only the information you have provided. It'd be necessary to actually see your test.nf file and read the processes. ...
Felipe Almeida's user avatar
3 votes

Nextflow (DSL v2): how to best synchronize multiple outputs from a single process

Update 3 While the code in Update 2 works, @Steve pointed out that my approach may not be ideal in cloud environments (see comments). He also provided a Nextflow ...
Mark Ebbert's user avatar
  • 1,414
3 votes
Accepted

Nextflow: cannot get file pairs from Channel.fromFilePairs

TLDR, use: nextflow.enable.dsl=2 workflow { Channel.fromFilePairs('/path/to/adsp/cram/snd10000/A-CUHS-CU000*.cram{,.crai}') | view() } Results: ...
Steve's user avatar
  • 3,287
3 votes
Accepted

recover files after groupTuple

My preference is to avoid working with files with the same name as much as possible. However, sometimes this might be unavoidable. Fortunately, file name collisions can be avoided when working with ...
Steve's user avatar
  • 3,287
3 votes
Accepted

How to keep the basename of an input file and change its extension in Nextflow?

You can use the getBaseName() method on file objects to get the basename: The invocation of any method name starting with the <...
Steve's user avatar
  • 3,287
3 votes
Accepted

Why does this nextflow script finish after running one sample?

The issue here is that the fromPath factory method produces a queue channel, but you don't want all of your input channels to be queue channels. Most of the time, ...
Steve's user avatar
  • 3,287
3 votes
Accepted

Nextflow Error: failed to read header from "-"

This is not a Nextflow error. The problem is that without an input file, samtools sort tries to read from stdin. Using a recent ...
Steve's user avatar
  • 3,287
3 votes
Accepted

nextflow: tumor normal sample - how to make code organic

I think you have a design problem here. A better way would be perform this operation in your workflow block. This would allow you to feed in the tumor and normal BAMs (and avoid accessing files ...
Steve's user avatar
  • 3,287

Only top scored, non community-wiki answers of a minimum length are eligible