# mamba安装
$ mamba create -n Minimap2
$ mamba activate Minimap2
$ mamba install -c bioconda minimap2
minimap2是一个通用的序列比对程序,可将DNA或mRNA序列与大型参考数据库进行比对。
用法包括:
对于~10kb的noisy reads sequences,minimap2比主流的long reads mappers(BLASR, BWA-MEM, NGMLR and GMAP)快很多;
对于大于100bp的二代测序short reads,minimap2比BWA-MEM 和 Bowtie2快3倍。
# long sequences against a reference genome
./minimap2 -a test/MT-human.fa test/MT-orang.fa > test.sam
# create an index first and then map
./minimap2 -x map-ont -d MT-human-ont.mmi test/MT-human.fa
./minimap2 -a MT-human-ont.mmi test/MT-orang.fa > test.sam
# use presets (no test data)
./minimap2 -ax map-pb ref.fa pacbio.fq.gz > aln.sam # PacBio CLR genomic reads
./minimap2 -ax map-ont ref.fa ont.fq.gz > aln.sam # Oxford Nanopore genomic reads
./minimap2 -ax map-hifi ref.fa pacbio-ccs.fq.gz > aln.sam # PacBio HiFi/CCS genomic reads (v2.19 or later)
./minimap2 -ax asm20 ref.fa pacbio-ccs.fq.gz > aln.sam # PacBio HiFi/CCS genomic reads (v2.18 or earlier)
./minimap2 -ax sr ref.fa read1.fa read2.fa > aln.sam # short genomic paired-end reads
./minimap2 -ax splice ref.fa rna-reads.fa > aln.sam # spliced long reads (strand unknown)
./minimap2 -ax splice -uf -k14 ref.fa reads.fa > aln.sam # noisy Nanopore Direct RNA-seq
./minimap2 -ax splice:hq -uf ref.fa query.fa > aln.sam # Final PacBio Iso-seq or traditional cDNA
./minimap2 -ax splice --junc-bed anno.bed12 ref.fa query.fa > aln.sam # prioritize on annotated junctions
./minimap2 -cx asm5 asm1.fa asm2.fa > aln.paf # intra-species asm-to-asm alignment
./minimap2 -x ava-pb reads.fa reads.fa > overlaps.paf # PacBio read overlap
./minimap2 -x ava-ont reads.fa reads.fa > overlaps.paf # Nanopore read overlap
# man page for detailed command line options
man ./minimap2.1
#没有任何选项下,minimap2将参考数据库和查询序列文件作为输入,产生近似的映射,没有碱基级的比对,采用paf格式
minimap2 ref.fa query.fq > approx-mapping.paf
#在PAF文件中制造CIGAR的cg标签
minimap2 -c ref.fa query.fq > alignment.paf
#或者以SAM 格式输出对齐
minimap2 -a ref.fa query.fq > alignment.sam
#使用gzip'd FASTA和FASTQ格式作为输入,对于人类参考基因组,minimap2需要几分钟的时间来生成参考基因组的最小化索引,然后进行映射。为了减少索引的时间,你可以选择用选项-d保存索引,并在minimap2命令行中用索引文件替换参考序列文件
minimap2 -d ref.mmi ref.fa # indexing
minimap2 -a ref.mmi reads.fq > alignment.sam # alignment
一旦你建立了索引,索引参数如 -k, -w, -H 和 -I 就不能在映射期间改变,因此可能需要保留多个用不同参数生成的索引。
具体用法
读取long noisy基因序列
minimap2 -ax map-pb ref.fa pacbio-reads.fq > aln.sam # for PacBio CLR reads
minimap2 -ax map-ont ref.fa ont-reads.fq > aln.sam # for Oxford Nanopore reads
# -a:设置输出为sam格式
#-x:对不同类型数据,设置不同参数
map-pb和map-ont的区别在于map-pb使用均聚物压缩(HPC)最小化器作为种子,而map-ont使用普通最小化器作为种子。经验评估表明,在对准PacBio CLR读数时,HPC最小化器提高了性能和灵敏度,但在对准Nanopore读数时却受到了影响。
查找长reads之间的重叠
minimap2 -x ava-pb reads.fq reads.fq > ovlp.paf # PacBio CLR read overlap
minimap2 -x ava-ont reads.fq reads.fq > ovlp.paf # Oxford Nanopore read overlap
同样地,ava-pb使用HPC最小化器,而ava-ont使用普通最小化器。