I have several fastq files per sample and all of them should be provided at once as an input (as they all belong to one sample, they should NOT be treated independently like in a for loop, as they are inputs for one sample so should be treated together).

This is a simple example when there are only three fastq files for s1 sample:

NanoPlot -t 2 --fastq s1.reads1.fastq.gz s1.reads2.fastq.gz s1.reads3.fastq.g --maxlength 40000 --plots hex dot

Now imagine I have over 100 fastq files for s1, how can I modify the command to have them all as an input?

  • 1
    How about NanoPlot -t 2 --fastq s1.*.fastq.gz --maxlength 40000 --plots hex dot ?
    – user469457
    Commented Apr 14, 2023 at 18:40
  • 1
    You can read about shell globs here: mywiki.wooledge.org/glob
    – user469457
    Commented Apr 14, 2023 at 18:42
  • 1
    Does it matter what order the files are listed in? Commented Apr 14, 2023 at 18:58
  • no, it does not
    – Anna1364
    Commented Apr 14, 2023 at 19:04

2 Answers 2


So my suggestion would be to provide a single filename as a parameter to NanoPlot, containing the list of FASTQ files, and handle the list in the program accordingly, e.g.

NanoPlot -t 2 --fastq fastq_files.list --maxlength 40000 --plots hex dot

With the contents of fastq_files.list as:

  • That's a bit harsh to downvote! Since despite the source of the limit being vague, which I have clarified by stating it's a hard coded Linux kernel limit, the problem and solution I proposed is very much valid - and one I have used myself to fix the same issue encountered by the Galaxy Project (galaxyproject.org).
    – user123570
    Commented Apr 15, 2023 at 10:08

If this works with NanoPlot:

NanoPlot -t 2 --fastq s1.reads1.fastq.gz s1.reads2.fastq.gz s1.reads3.fastq.gz --maxlength 40000 --plots hex dot

and you want to pass all filenames starting with s1. and ending in .fastq.gz, then a simple shell glob should also work to do that:

NanoPlot -t 2 --fastq s1.*.fastq.gz --maxlength 40000 --plots hex dot

The shell should sort the filenames in the usual lexicographic order, so numbers sort as 1 < 10 < 11 < 2 etc., so take care if that matters.

If you want the program to see a single file containing the data from all such files, then you can use a process substitution (in Bash/ksh/zsh) with cat to do that:

NanoPlot -t 2 --fastq <(cat s1.*.fastq.gz) --maxlength 40000 --plots hex dot
  • 2
    You could use s1.reads{1..100}.fastq.gz if you wanted a numerically ordered list, I suppose, provided you knew the lower and upper bounds and the sequence was consecutive. But in a comment the OP has said the file order doesn't matter. Commented Apr 15, 2023 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .