{"repo":"lh3/minimap2","free":true,"listed":false,"github":"https://github.com/lh3/minimap2","clone":"git clone https://github.com/lh3/minimap2.git","description":"A versatile pairwise aligner for genomic and spliced nucleotide sequences","language":"C","stars":2234,"topics":["bioinformatics","genomics","sequence-alignment","spliced-alignment"],"license":null,"category":"bioinformatics_tool","readme_excerpt":"[![GitHub Downloads](https://img.shields.io/github/downloads/lh3/minimap2/total.svg?style=social&logo=github&label=Download)](https://github.com/lh3/minimap2/releases)\n[![BioConda Install](https://img.shields.io/conda/dn/bioconda/minimap2.svg?style=flag&label=BioConda%20install)](https://anaconda.org/bioconda/minimap2)\n[![PyPI](https://img.shields.io/pypi/v/mappy.svg?style=flat)](https://pypi.python.org/pypi/mappy)\n[![Build Status](https://github.com/lh3/minimap2/actions/workflows/ci.yaml/badge.svg)](https://github.com/lh3/minimap2/actions)\n## <a name=\"started\"></a>Getting Started\n**ALERT:** `minimap2.com` is a [phishing site](https://github.com/lh3/minimap2/issues/1316). Please don't use anything from that website.\n```sh\ngit clone https://github.com/lh3/minimap2\ncd minimap2 && make\n# long sequences against a reference genome\n./minimap2 -a test/MT-human.fa test/MT-orang.fa > test.sam\n# create an index first and then map\n./minimap2 -x map-ont -d MT-human-ont.mmi test/MT-human.fa\n./minimap2 -a MT-human-ont.mmi test/MT-orang.fa > test.sam\n# use presets (no test data)\n./minimap2 -ax map-pb ref.fa pacbio.fq.gz > aln.sam       # PacBio CLR genomic reads\n./minimap2 -ax map-ont ref.fa ont.fq.gz > aln.sam         # Oxford Nanopore genomic reads\n./minimap2 -ax map-hifi ref.fa pacbio-ccs.fq.gz > aln.sam # PacBio HiFi/CCS genomic reads (v2.19+)\n./minimap2 -ax lr:hq ref.fa ont-Q20.fq.gz > aln.sam       # Nanopore Q20 genomic reads (v2.27+)\n./minimap2 -ax sr ref.fa read1.fa read2.fa > aln.sam      # short genomic paired-end reads\n./minimap2 -ax splice ref.fa rna-reads.fa > aln.sam       # spliced long reads (strand unknown)\n./minimap2 -ax splice -uf -k14 ref.fa reads.fa > aln.sam  # noisy Nanopore direct RNA-seq\n./minimap2 -ax splice:hq -uf ref.fa query.fa > aln.sam    # PacBio Kinnex/Iso-seq (RNA-seq)\n./minimap2 -ax splice --junc-bed=anno.bed12 ref.fa query.fa > aln.sam  # use annotated junctions\n./minimap2 -ax splice:sr ref.fa r1.fq r2.fq > aln.sam     # short-read RNA-seq (v2.29+)\n./minimap2 -ax splice:sr -j anno.bed12 ref.fa r1.fq r2.fq > aln.sam\n./minimap2 -cx asm5 asm1.fa asm2.fa > aln.paf             # intra-species asm-to-asm alignment\n./minimap2 -x ava-pb reads.fa reads.fa > overlaps.paf     # PacBio read overlap\n./minimap2 -x ava-ont reads.fa reads.fa > overlaps.paf    # Nanopore read overlap\n# man page for detailed command line options\nman ./minimap2.1\n```\n\n## Table of Contents\n\n- [Getting Started](#started)\n- [Users' Guide](#uguide)\n  - [Installation](#install)\n  - [General usage](#general)\n  - [Use cases](#cases)\n    - [Map long noisy genomic reads](#map-long-genomic)\n    - [Map long mRNA/cDNA reads](#map-long-splice)\n    - [Find overlaps between long reads](#long-overlap)\n    - [Map short genomic reads](#short-genomic)\n    - [Map short RNA-seq reads](#short-rna-seq)\n    - [Full genome/assembly alignment](#full-genome)\n  - [Advanced features](#advanced)\n    - [Working with >65535 CIGAR operations](#long-cigar)\n    - [The cs optional tag](#cs)\n    - [Working with the PAF format](#paftools)\n  - [Algorithm overview](#algo)\n  - [Getting help](#help)\n  - [Citing minimap2](#cite)\n- [Developers' Guide](#dguide)\n- [Limitations](#limit)\n\n## <a name=\"uguide\"></a>Users' Guide\n\nMinimap2 is a versatile sequence alignment program that aligns DNA or mRNA\nsequences against a large reference database. Typical use cases include: (1)\nmapping PacBio or Oxford Nanopore genomic reads to the human genome; (2)\nfinding overlaps between long reads with error rate up to ~15%; (3)\nsplice-aware alignment of PacBio Iso-Seq or Nanopore cDNA or Direct RNA reads\nagainst a reference genome; (4) aligning Illumina single- or paired-end reads;\n(5) assembly-to-assembly alignment; (6) full-genome alignment between two\nclosely related species with divergence below ~15%.\n\nFor ~10kb noisy reads sequences, minimap2 is tens of times faster than\nmainstream long-read mappers such as BLASR, BWA-MEM, NGMLR and GMAP. It is more\naccurate on simulated long reads and produces biologically meaningful alignment\nready for downstream analyses. For >100bp Illumina short reads, minimap2 is\nthree times as fast as BWA-MEM and Bowtie2, and as accurate on simulated data.\nDetailed evaluations are available from the [minimap2 paper][doi] or the\n[preprint][preprint].\n\n### <a name=\"install\"></a>Installation\n\nMinimap2 is optimized for x86-64 CPUs. You can acquire precompiled binaries from\nthe [release page][release] with:\n```sh\ncurl -L https://github.com/lh3/minimap2/releases/download/v2.31/minimap2-2.31_x64-linux.tar.bz2 | tar -jxvf -\n./minimap2-2.31_x64-linux/minimap2\n```\nIf you want to compile from the source, you need to have a C compiler, GNU make\nand zlib development files installed. Then type `make` in the source code\ndirectory to compile. If you see compilation errors, try `make sse2only=1`\nto disable SSE4 code, which will make minimap2 slightly slower.\n\nMinimap2 also works with ARM CPUs supporting the NEON instruction sets. To\ncompile for 32 bit ARM architectures (such as ARMv7), use `make arm_neon=1`. To\ncompile for for 64 bit ARM architectures (such as ARMv8), use `make arm_neon=1\naarch64=1`.\n\nMinimap2 can use [SIMD Everywhere (SIMDe)][simde] library for porting\nimplementation to the different SIMD instruction sets. To compile using SIMDe,\nuse `make -f Makefile.simde`. To compile for ARM CPUs, use `Makefile.simde`\nwith the ARM related command lines given above.\n\n### <a name=\"general\"></a>General usage\n\nWithout any options, minimap2 takes a reference database and a query sequence\nfile as input and produce approximate mapping, without base-level alignment\n(i.e. coordinates are only approximate and no CIGAR in output), in the [PAF format][paf]:\n```sh\nminimap2 ref.fa query.fq > approx-mapping.paf\n```\nYou can ask minimap2 to generate CIGAR at the `cg` tag of PAF with:\n```sh\nminimap2 -c ref.fa query.fq > alignment.paf\n```\nor to output alignments in the [SAM format][sam]:\n```sh\nminimap2 -a ref.fa query.fq > alignment.sam\n```\nMinimap2 seamlessly works with gzip'd FASTA and FASTQ formats as input. You\ndon't need to convert between FASTA and FASTQ or decompress gzip'd files first.\n\nFor the human reference genome, minimap2 takes a few minutes to generate a\nminimizer index for the reference before mapping. To reduce indexing time, you\ncan optionally save the index with option **-d** and replace the reference\nsequence file with the index file on the minimap2 command line:\n```sh\nminimap2 -d ref.mmi ref.fa                     # indexing\nminimap2 -a ref.mmi reads.fq > alignment.sam   # alignment\n```\n***Importantly***, it should be noted that once you build the index, indexing\nparameters such as **-k**, **-w**, **-H** and **-I** can't be changed during\nmapping. If you are running minimap2 for different data types, you will\nprobably need to keep multiple indexes generated with different parameters.\nThis makes minimap2 different from BWA which always uses the same index\nregardless of query data types.\n\n### <a name=\"cases\"></a>Use cases\n\nMinimap2 uses the same base algorithm for all applications. However, due to the\ndifferent data types it supports (e.g. short vs long reads; DNA vs mRNA reads),\nminimap2 needs to be tuned for optimal performance and accuracy. It is usually\nrecommended to choose a preset with option **-x**, which sets multiple\nparameters at the same time. The default setting is the same as `map-ont`.\n\n#### <a name=\"map-long-genomic\"></a>Map long noisy genomic reads\n\n```sh\nminimap2 -ax map-pb  ref.fa pacbio-reads.fq > aln.sam   # for PacBio CLR reads\nminimap2 -ax map-ont ref.fa ont-reads.fq > aln.sam      # for Oxford Nanopore reads\nminimap2 -ax map-iclr ref.fa iclr-reads.fq > aln.sam    # for Illumina Complete Long Reads\n```\nThe difference between `map-pb` and `map-ont` is that `map-pb` uses\nhomopolymer-compressed (HPC) minimizers as seeds, while `map-ont` uses ordinary\nminimizers as seeds. Empirical evaluation suggests HPC minimizers improve\nperformance and sensitivity when aligning PacBio CLR reads, but hurt when aligning\nNanopore reads. `map-iclr` uses an adjusted alignment scoring matrix that\naccounts for the low overall error rate in the reads, with transversion errors\nbeing less frequent than transitions.\n\n#### <a name=\"map-long-splice\"></a>Map long mRNA/cDNA reads\n\n```sh\nminimap2 -ax splice:hq -uf ref.fa iso-seq.fq > aln.sam       # PacBio Iso-seq/traditional cDNA\nminimap2 -ax splice ref.fa nanopore-cdna.fa > aln.sam        # Nanopore 2D cDNA-seq\nminimap2 -ax splice -uf -k14 ref.fa direct-rna.fq > aln.sam  # Nanopore Direct RNA-seq\nminimap2 -ax splice --splice-flank=no SIRV.fa SIRV-seq.fa    # mapping against SIRV control\n```\nThere are different long-read RNA-seq technologies, including tranditional\nfull-length cDNA, EST, PacBio Iso-seq, Nanopore 2D cDNA-seq and Direct RNA-seq.\nThey produce data of varying quality and properties. By default, `-x splice`\nassumes the read orientation relative to the transcript strand is unknown. It\ntries two rounds of alignment to infer the orientation and write the strand to\nthe `ts` SAM/PAF tag if possible. For Iso-seq, Direct RNA-seq and tranditional\nfull-length cDNAs, it would be desired to apply `-u f` to force minimap2 to\nconsider the forward transcript strand only. This speeds up alignment with\nslight improvement to accuracy. For noisy Nanopore Direct RNA-seq reads, it is\nrecommended to use a smaller k-mer size for increased sensitivity to the first\nor the last exons.\n\nMinimap2 rates an alignment by the score of the max-scoring sub-segment,\n*excluding* introns, and marks the best alignment as primary in SAM. When a\nspliced gene also has unspliced pseudogenes, minimap2 slightly prefers\nthe spliced alignment. By default, minimap2 outputs up to five secondary\nalignments (i.e. likely pseudogenes in the context of RNA-seq mapping). This\ncan be tuned with option **-N**.\n\nFor long RNA-seq reads, minimap2 may produce chimeric alignments potentially\ncaused by gene fusions/structural variations or by an intron longer than the\nmax intr","default_branch":"master","files":93,"tree":[".github/workflows/ci.yaml",".gitignore",".gitmodules","FAQ.md","LICENSE.txt","MANIFEST.in","Makefile","Makefile.simde","NEWS.md","README.md","align.c","bseq.c","bseq.h","code_of_conduct.md","cookbook.md","esterr.c","example.c","format.c","hit.c","index.c","jump.c","kalloc.c","kalloc.h","kdq.h","ketopt.h","khash.h","krmq.h","kseq.h","ksort.h","ksw2.h","ksw2_dispatch.c","ksw2_extd2_sse.c","ksw2_exts2_sse.c","ksw2_extz2_sse.c","ksw2_ll_sse.c","kthread.c","kthread.h","kvec.h","lchain.c","main.c","map.c","minimap.h","minimap2.1","misc.c","misc/README.md","misc/pafcluster.js","misc/paftools.js","mmpriv.h","options.c","pe.c","pyproject.toml","python/README.rst","python/cmappy.h","python/cmappy.pxd","python/mappy.pyx","python/minimap2.py","sdust.c","sdust.h","seed.c","setup.py","sketch.c","splitidx.c","sse2neon/emmintrin.h","test/MT-human.fa","test/MT-orang.fa","test/q-inv.fa","test/q2.fa","test/t-inv.fa","test/t2.fa","test/x3s-aln.txt","test/x3s-qry.fa","test/x3s-ref.fa","tex/Makefile","tex/bioinfo.cls","tex/blasr-mc.eval","tex/bowtie2-s3.sam.eval","tex/bwa-s3.sam.eval","tex/bwa.eval","tex/eval2roc.pl","tex/graphmap.eval","tex/hs38-simu.sh","tex/minialign.eval","tex/minimap2.bib","tex/minimap2.tex","tex/mm2-s3.sam.eval","tex/mm2-update.tex","tex/mm2.approx.eval","tex/mm2.eval","tex/natbib.bst","tex/natbib.sty","tex/ngmlr.eval","tex/roc.gp","tex/snap-s3.sam.eval"],"storefront":"/r/lh3","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/lh3/minimap2/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}