
Bio Longread Alignment
- 4 installs
- 1.1k repo stars
- Updated July 25, 2026
- gptomics/bioskills
Align Oxford Nanopore and PacBio long reads to a reference genome with minimap2 using presets for variant calling, SV detection, or coverage.
About
Aligns Oxford Nanopore and PacBio long reads to a reference genome using minimap2 with read-type presets. A developer uses it when preparing long-read alignments for variant calling, SV detection, or coverage analysis.
- minimap2 presets for ONT and PacBio
- Supports variant, SV, and coverage workflows
Bio Longread Alignment by the numbers
- 4 all-time installs (skills.sh)
- Ranked #1,625 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/gptomics/bioskills --skill bio-longread-alignmentAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 4 |
|---|---|
| repo stars | ★ 1.1k |
| Last updated | July 25, 2026 |
| Repository | gptomics/bioskills ↗ |
What it does
Align Oxford Nanopore and PacBio long reads to a reference genome with minimap2 using presets for variant calling, SV detection, or coverage.
Files
Long-Read Alignment with minimap2
Oxford Nanopore Alignment
# Basic ONT alignment
minimap2 -ax map-ont reference.fa reads.fastq.gz | \
samtools sort -o aligned.bam
samtools index aligned.bamPacBio HiFi Alignment
# PacBio HiFi reads (high accuracy)
minimap2 -ax map-hifi reference.fa reads.fastq.gz | \
samtools sort -o aligned.bam
samtools index aligned.bamPacBio CLR Alignment
# PacBio CLR (continuous long reads, lower accuracy)
minimap2 -ax map-pb reference.fa reads.fastq.gz | \
samtools sort -o aligned.bam
samtools index aligned.bamPre-Build Index for Multiple Runs
# Build index once
minimap2 -d reference.mmi reference.fa
# Use index for alignment
minimap2 -ax map-ont reference.mmi reads.fastq.gz | samtools sort -o aligned.bamCommon Options
minimap2 -ax map-ont \
-t 8 \ # Threads
-R '@RG\tID:sample\tSM:sample' \ # Read group
--secondary=no \ # No secondary alignments
--MD \ # Generate MD tag for variants
-Y \ # Use soft clipping for supplementary
reference.fa reads.fastq.gz | \
samtools sort -@ 4 -o aligned.bamSplice-Aware Alignment (RNA)
# For direct RNA or cDNA sequencing
minimap2 -ax splice reference.fa reads.fastq.gz | \
samtools sort -o aligned.bamWith Junction BED (Known Splice Sites)
# Provide known splice junctions
minimap2 -ax splice --junc-bed junctions.bed \
reference.fa reads.fastq.gz | samtools sort -o aligned.bamAssembly to Reference Alignment
# Assembly with ~0.1% divergence
minimap2 -ax asm5 reference.fa assembly.fa > aligned.sam
# Assembly with higher divergence (~5%)
minimap2 -ax asm20 reference.fa assembly.fa > aligned.samOutput PAF (Faster, No BAM)
# PAF format (faster, for quick analysis)
minimap2 -x map-ont reference.fa reads.fastq.gz > alignments.pafKeep Secondary and Supplementary
# Keep all alignments (for SV calling)
minimap2 -ax map-ont \
--secondary=yes \
-N 5 \ # Max secondary alignments
reference.fa reads.fastq.gz | samtools sort -o aligned.bamFilter Alignments
# During alignment pipeline
minimap2 -ax map-ont reference.fa reads.fastq.gz | \
samtools view -b -q 10 | \ # Min mapping quality 10
samtools sort -o aligned.bamMultiple FASTQ Files
# Concatenate inputs
minimap2 -ax map-ont reference.fa reads1.fastq.gz reads2.fastq.gz | \
samtools sort -o aligned.bam
# Or use file list
cat file_list.txt | xargs minimap2 -ax map-ont reference.fa | \
samtools sort -o aligned.bamOutput Statistics
# Get alignment statistics
samtools flagstat aligned.bam
# Detailed stats
samtools stats aligned.bam | grep ^SNConvert PAF to BED
# Extract alignments to BED
awk 'OFS="\t" {print $6, $8, $9, $1, $12, ($5=="+")?"+":"-"}' alignments.paf > alignments.bedKey Presets
| Preset | Description | Best For |
|---|---|---|
| map-ont | ONT reads | Nanopore genomic |
| map-hifi | PacBio HiFi | PacBio genomic |
| map-pb | PacBio CLR | PacBio CLR |
| splice | Long RNA reads | cDNA, direct RNA |
| asm5 | Low divergence | Same species assembly |
| asm20 | High divergence | Cross-species assembly |
| sr | Short reads | Illumina (basic) |
Key Parameters
| Parameter | Default | Description |
|---|---|---|
| -t | 3 | CPU threads |
| -k | 15 | K-mer size |
| -w | 10 | Minimizer window |
| -a | off | Output SAM |
| -x | none | Preset |
| --secondary | yes | Output secondary |
| -N | 5 | Max secondary alignments |
| --MD | off | Generate MD tag |
| -R | none | Read group header |
| -Y | off | Soft clipping for supplementary |
Output Formats
| Format | Flag | Description |
|---|---|---|
| PAF | (default) | Pairwise Alignment Format |
| SAM | -a | Sequence Alignment Map |
| BAM | -a \ | samtools |
Related Skills
- medaka-polishing - Polish consensus with medaka
- structural-variants - Call SVs from alignments
- alignment-files - BAM manipulation
Related skills
Data Science & MLpipelines