MultiShred
Shreds all sequences in a directory into one output file, using a single JVM invocation. Equivalent to running shred.sh on every file individually, but orders of magnitude faster for large directories.
Basic Usage
multishred.sh indir=<directory> out=<file> length=<number>
multishred.sh is a thin bash wrapper: it decompresses and concatenates every matching file in a directory on the fly (via unpigz/zcat/cat), then streams the combined sequence data through a single shred.sh process over stdin. This avoids the per-file JVM startup cost of calling shred.sh once per file, which matters when a directory holds thousands of genomes.
Parameters
File Parameters
- indir=<dir>
- Directory containing input sequence files. Required. Note: use indir=, not in= — multishred.sh will error out if given in=.
- out=<file>
- Destination of output shreds. Required.
- ext=fna.gz
- Extension filter for which files in indir are included. Default is fna.gz.
Pass-Through Parameters
- length=<number>, overlap=, equal=, qfake=, ...
- All parameters other than indir/out/ext are passed straight through to the underlying shredding engine (shred.sh). Run shred.sh with no arguments for the full parameter list.
Examples
Basic Directory Shredding
multishred.sh indir=/data/genomes out=shreds.fasta length=1000
Shreds every *.fna.gz file in /data/genomes into 1000-base fragments, all written to a single output file.
Custom Extension Filter
multishred.sh indir=/data/assemblies ext=fasta.gz out=shreds.fasta length=500
Shreds only the *.fasta.gz files in the directory, ignoring other extensions.
Passing Through Shred Options
multishred.sh indir=/data/genomes out=shreds.fasta length=500 overlap=100 equal=t
overlap and equal are not multishred.sh's own parameters — they pass straight through to shred.sh, exactly as if each file had been shredded individually with those settings.
Support
For questions and support:
- Email: bbushnell@lbl.gov
- Documentation: bbmap.org
- Related tool: Shred — the underlying single-file shredding engine; see it for the full parameter list.