Command line utility for manipulating FASTQ files
fq filters, subsamples, and validates FASTQ files.
There are different methods to install fq.
Precompiled binaries are built for modern Linux distributions
(x86_64-unknown-linux-gnu), macOS (x86_64-apple-darwin), and Windows
(x86_64-pc-windows-msvc). The Linux binaries require glibc 2.31+ (CentOS/RHEL
9+, Debian 11+, Ubuntu 20.04+, etc.).
fq is available via Bioconda.
$ conda install fq=0.12.0Clone the repository and use Cargo to install fq.
$ git clone --depth 1 --branch v0.12.0 https://github.com/stjude-rust-labs/fq.git
$ cd fq
$ cargo install --locked --path .Container images are managed by Bioconda and available through Quay.io, e.g., using Docker:
$ docker image pull quay.io/biocontainers/fq:See the repository tags for the available tags.
Alternatively, build the development container image:
$ git clone --depth 1 --branch v0.12.0 https://github.com/stjude-rust-labs/fq.git
$ cd fq
$ docker image build --tag fq:0.12.0 .fq provides subcommands for filtering, subsampling, and validating FASTQ files.
fq filter filters a given FASTQ file by a set of names or a sequence pattern. The result includes only the records that match the given options.
Filters a FASTQ file
Usage: fq filter [OPTIONS] --dsts [SRCS]...
Arguments:
[SRCS]... FASTQ sources. Accepts both raw and gzipped FASTQ inputs
Options:
--names
Allowlist of record names
--sequence-pattern
Keep records that have sequences that match the given regular expression
--dsts
Filtered FASTQ destinations
-h, --help
Print help
-V, --version
Print version# Filters an input FASTQ using the given allowlist.
$ fq filter --names allowlist.txt --dsts /dev/stdout in.fastq
# Filters FASTQ files by matching a sequence pattern in the first input's
# records and applying the match to all inputs.
$ fq filter --sequence-pattern ^TC --dsts out.1.fq --dsts out.2.fq in.1.fq in.2.fqfq lint is a FASTQ file pair validator.
…validate includes a set of validators that run on single or paired records.
By default, records are validated with all rules, but validators can be
disabled using --disable-validator CODE, where CODE is one of validators
listed below.
| Code | Level | Name | Validation |
|---|---|---|---|
| S001 | low | PlusLine | Plus line starts with a "+". |
| S002 | medium | Alphabet | All characters in sequence line are one of "ACGTN", case-insensitive. |
| S003 | high | Name | Name line starts with an "@". |
| S004 | low | Complete | All four record lines (name, sequence, plus line, and quality) are present. |
| S005 | high | ConsistentSeqQual | Sequence and quality lengths are the same. |
| S006 | medium | QualityString | All characters in quality line are between "!" and "~" (ordinal values). |
| S007 | high | DuplicateName | All record names are unique. |
| Code | Level | Name | Validation |
|---|---|---|---|
| P001 | medium | Names | Each paired read name is the same, excluding interleave. |
# Validate both reads using all validators. Exits cleanly (0) if no validation
# errors occur.
$ fq lint r1.fastq r2.fastq
# Log errors instead of quitting on first error.
$ fq lint --lint-mode log r1.fastq r2.fastq
# Disable validators S004 and S007.
$ fq lint --disable-validator S004 --disable-validator S007 r1.fastq r2.fastqfq subsample outputs a subset of records from single or paired FASTQ files.
When using a probability (-p, --probability), each file is read through once,
and a subset of records is selected based on that chance. Given the randomness
used when sampling a uniform distribution, the output record count will not be
exact but (statistically) close.
When using a record count (-n, --record-count), the first input is read
twice, but it provides an exact number of records to be selected.
A seed (-s, --seed) can be provided to influence the results, e.g.,
for a deterministic subset of records.
For paired input, the sampling is applied to each pair.
……Please see the disclaimer that applies to all crates and command line tools made available by St. Jude Rust Labs.
No open issues yet, or sync has not completed.