PrimalBedTools is a library for manipulating and processing BED files, particularly focused on primer-related operations. It provides several functions for common BED file operations including coordinate remapping, sorting, updating, and amplicon generation.
Functions are wrapped in a CLI for ease of use.
pip install primalbedtools
primalbedtools <command> [options]
Remaps coordinates in a BED file using a multiple sequence alignment (MSA).
primalbedtools remap --bed input.bed --msa alignment.fasta --from_id source_id --to_id target_id
Required arguments:
--bed
: Input BED file--msa
: Multiple sequence alignment file in FASTA format--from_id
: Source sequence ID to remap from--to_id
: Target sequence ID to remap to
Sorts entries in a BED file.
primalbedtools sort input.bed
Required arguments:
bed
: Input BED file to sort
Updates information in a BED file, particularly primer names.
primalbedtools update input.bed
Required arguments:
bed
: Input BED file to update
Creates an amplicon BED file from primer pairs.
primalbedtools amplicon input.bed [--primertrim]
Required arguments:
bed
: Input BED file containing primer information
Optional arguments:
-t, --primertrim
: Generate primer-trimmed amplicons
- Remap coordinates from one reference to another:
primalbedtools remap --bed primers.bed --msa refs.fasta --from_id ref1 --to_id ref2
- Sort a BED file:
primalbedtools sort input.bed > sorted.bed
- Generate amplicons with primer trimming:
primalbedtools amplicon primers.bed --primertrim > trimmed_amplicons.bed
All commands output modified BED files to stdout while preserving the original header information. The amplicon command outputs either standard or primer-trimmed amplicon coordinates based on the provided options.