SKILL.md
Version Compatibility
Reference examples tested with: bcftools 1.19+, minimap2 2.26+, samtools 1.19+
Before using code patterns, verify installed versions match. If versions differ:
- CLI:
<tool> --versionthen<tool> --helpto confirm flags
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Medaka Polishing and Variant Calling
"Polish my ONT assembly with medaka" → Use neural networks trained on specific basecaller models to correct assembly errors and call variants from Nanopore data.
- CLI:
medaka_polisher -i reads.fq -d draft.fa -o polished.fa -m r1041_e82_400bps_sup_v5.0.0
Basic Consensus Polishing
# Polish assembly with medaka
medaka_consensus -i reads.fastq.gz \
-d draft_assembly.fa \
-o medaka_output \
-t 4 \
-m r1041_e82_400bps_sup_v5.0.0
Variant Calling (Haploid)
# Call variants against reference
medaka_variant \
-i reads.fastq.gz \
-r reference.fa \
-o output_dir \
-m r1041_e82_400bps_sup_v5.0.0
Note: Diploid variant calling has been deprecated in medaka v2.0. For diploid samples, use Clair3 instead.
Step-by-Step Workflow
Goal: Polish an ONT assembly or call variants using medaka's neural network models with explicit control over each step.
Approach: Align reads with minimap2, run medaka neural network inference on the alignment, then generate either a polished consensus or variant calls from the probability output.
# 1. Align reads to reference/draft
minimap2 -ax map-ont reference.fa reads.fastq.gz | \
samtools sort -o aligned.bam
samtools index aligned.bam
# 2. Run neural network inference
medaka inference aligned.bam consensus.hdf \
--model r1041_e82_400bps_sup_v5.0.0 \
--threads 2 # >2 threads has poor scaling
# 3. Create consensus sequence from probabilities
medaka sequence consensus.hdf reference.fa polished.fa
# 4. Call variants from probabilities
medaka vcf reference.fa consensus.hdf variants.vcf
