mask-fasta-from-bed
Quick Start
- Command:
maskFastaFromBed -fi <input.fasta> -bed <intervals.bed> -fo <output.fasta> - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/maskFastaFromBed - Full reference: See
references/help.md
When To Use This Tool
- Hard-mask repetitive, blacklisted, or excluded regions in a FASTA with
Nor another replacement character. - Soft-mask regions by lowercasing the existing sequence with
-soft. - Apply interval masks from BED, GFF, or VCF files to a reference or contig FASTA.
- Produce a derived masked FASTA without changing the original source file.
Common Patterns
# 1) Hard-mask listed regions with Ns
maskFastaFromBed \
-fi genome.fa \
-bed blacklist.bed \
-fo genome.masked.fa
# 2) Soft-mask repeats by converting bases to lowercase
maskFastaFromBed \
-fi genome.fa \
-bed repeats.bed \
-fo genome.softmasked.fa \
-soft
# 3) Hard-mask with a custom replacement character and full FASTA headers
maskFastaFromBed \
-fi contigs.fa \
-bed mask-regions.bed \
-fo contigs.masked.fa \
-mc X \
-fullHeader
Recommended Workflow
- Confirm the interval file uses the same sequence naming convention as the FASTA headers.
- Choose hard masking (default), soft masking with
-soft, or an alternate hard-mask character with-mc. - Write the result to a new FASTA via
-foand preserve the original FASTA as the unmasked source. - Spot-check a few loci to confirm the intended regions were masked and the header matching behaved as expected.
Guardrails
-fois required; this tool does not modify the input FASTA in place.- Default behavior replaces masked sequence with uppercase
N;-softinstead lowercases the original bases. -mcchanges the hard-mask character; it is not a substitute for-soft.- By default bedtools matches only the first token of a FASTA header; use
-fullHeaderwhen interval names must match the entire header line. - Prefer
-hfor help; GNU-style--helpand--versionemit wrapper errors before usage text.