mopdepth

build Lines of Code Static Badge

A fast BAM/CRAM depth calculation tool written in Crystal, inspired by mosdepth.

This is an experiment to see if well-known tools can be ported to Crystal using “vibe coding”.

Features

Installation

Prerequisites

Build from source

git clone https://github.com/kojix2/mopdepth
cd mopdepth
shards install
shares build --release

Usage

./mopdepth [options] <prefix> <BAM-or-CRAM>

Basic example

./mopdepth output sample.bam

Options

Processing modes

Note: Fast mode and fragment mode cannot be used together.

Output files

By default, files are named with the mopdepth.* label. Use -M/--mos to switch to mosdepth.*.

Summary file format

The summary file contains the following columns:

Examples

Basic depth calculation

./mopdepth output sample.bam

With BED regions

./mopdepth -b regions.bed output sample.bam

Window-based analysis (1kb windows)

./mopdepth -b 1000 output sample.bam

Fast mode with MAPQ filtering

./mopdepth -x -Q 20 output sample.bam

Fragment mode for paired-end data

./mopdepth -a -l 100 -u 1000 output sample.bam

License

MIT License