MotifScan is a streaming, low-memory, multi-threaded Rust CLI for exact motif scanning in FASTA and FASTQ reads.
- Rust toolchain for building from source
git clone https://github.com/jiehua1995/MotifScan
cd MotifScan
cargo build --releaseBinary path:
./target/release/motifscancargo install motifscanCrates.io page: https://crates.io/crates/motifscan
motifscan -v
motifscan --versionMultiple motifs:
motifscan count \
-i reads.fastq \
--motifs motifs.csv \
--revcomp \
-o count.csvSingle motif:
motifscan count \
-i reads.fa \
--motif ATTATGAGAATAGTGTG \
--motif-name motif1 \
-o count.csvRead-level hits:
motifscan count \
-i reads.fastq \
--motifs motifs.csv \
--report-read-hits read_hits.csv \
-o count.csvLogging: control logging via the RUST_LOG environment variable or the environment filter; no per-command --debug flag is available.
| Option | Default | Description | Notes |
|---|---|---|---|
-i, --input |
required | Input reads file (FASTA/FASTQ or gz) | Use single -i followed by file |
-o, --output |
required | Output CSV path | Summary CSV; first column is motif |
-t, --threads |
auto | Number of worker threads | 0 means auto-select |
--progress |
false | Show progress bar on stderr | Useful for long runs |
--motif |
- | Single motif sequence | Mutually exclusive with --motifs |
--motifs |
- | Two-column CSV of motifs | name,sequence |
--motif-name |
motif |
Name used with --motif |
Only valid when --motif is provided |
--revcomp |
false | Also scan reverse complements | When set, reverse strand matches counted separately |
name,sequence
motif1,ATTATGAGAATAGTGTG
motif2,TTCATTCATGGTGGCAGTAAAATGTTTATTGTG
motif3,ATGAA
Summary:
motif,sequence,length,reads_with_hit,total_hits,forward_hits,revcomp_hits
Read hits:
read_id,motif,strand,position,matched_sequence
- Input sequences are normalized to uppercase before matching.
- Overlapping hits are counted.
- Palindromic motifs are not double-counted in reverse-complement mode.
- If a motif is longer than a read, that read is skipped for that motif.
- FASTQ input is parsed as standard four-line records.
- The scanner currently supports exact matching only.
Just mention this repository or cite like:
@software{motifscan,
author = {jiehua1995},
title = {MotifScan},
url = {https://github.com/jiehua1995/MotifScan},
version = {0.1.7}
}If you do not want to build from source, you can download a prebuilt artifact from GitHub Releases generated by CI. Local builds are still recommended because they are the best way to ensure the binary matches your environment.