+title: Bam2Seq
This tool takes a BAM file containing CIGAR strings, reads, and ~MD~ tags,
and outputs a ~.seq~ file containing pairs of reads and reconstructed references.
** Installation
Simply clone the repository, and optionally install the binary.
+begin_src
git clone https://github.com/ragnargrootkoerkamp/bam2seq.git
cd bam2seq
cargo install --path .
+end_src
** Usage
+begin_src
cargo run --release -- [--clip] [--min-len ]
+end_src
- ~--clip~ :: If the CIGAR string contains ~S~ at the start/end,
remove the first/last ~~ characters from the read.
- ~--min-len ~ :: Only output (clipped) reads of at least this length.
This outputs a ~.seq~ file, which looks like this:
+begin_src
ACTGATGA
+end_src
** Links
- This is quite similar to [[https://github.com/mlafave/sam2pairwise][sam2pairwise]] but writes a simpler output format.
- All the work in the implementation is done by the [[https://docs.rs/bam/latest/bam/][BAM]] crate.