miniprot: protein 配列を genome にマップする。

# make でインストール

[github](https://github.com/lh3/miniprot)
 conda はないみたいなので、git からソースを落としてきて make する。
 git hub の手順に従って行い、特にひっかかることなく make 完了。

  ```
git clone https://github.com/lh3/miniprot
cd miniprot && make
  ```
# ヘルプ 
  ```  
miniprot --help
Usage: miniprot [options] <ref.fa> <query.faa> [...]
Options:
  Indexing:
    -k INT       k-mer size [6]
    -s INT       submer size (density: 1/(2*(k-s)+1)) [4]
    -b INT       bits per block [8]
    -d FILE      save index to FILE []
  Mapping:
    -S           no splicing (applying -G1k -J1k -e1k)
    -c NUM       max k-mer occurrence [50000]
    -G NUM       max intron size [200k]
    -n NUM       minimum number of syncmers in a chain [5]
    -m NUM       min chaining score [0]
    -l INT       k-mer size for the second round of chaining [5]
    -e NUM       max extension for 2nd round of chaining and alignment [10k]
    -p FLOAT     min secondary-to-primary score ratio [0.7]
    -N NUM       consider at most INT secondary alignments [50]
  Alignment:
    -O INT       gap open penalty [11]
    -E INT       gap extension (a k-long gap costs O+k*E) [1]
    -J INT       intron open penalty [31]
    -C INT       penalty for non-canonical splicing [11]
    -F INT       frameshift penalty [17]
    -B INT       end bonus [5]
  Input/output:
    -t INT       number of threads [4]
    --gff        output in the GFF3 format
    -P STR       prefix for IDs in GFF3 [MP]
    -u           print unmapped query proteins
    --outn=NUM   output up to min{NUM,-N} alignments per query [100]
    -K NUM       query batch size [2M]
  ```

# テスト実行 
テストデータが付属されているので、実行してみる。
(私は gff format が見慣れているので gff で出力。)  
  ```
./miniprot --gff test/DPP3-hs.gen.fa.gz test/DPP3-mm.pep.fa.gz > test/aln.gff

## 実行ログ
[M::mp_ntseq_read@0.001*3.74] read 27033 bases in 1 contigs
[M::mp_idx_build@0.001*3.63] 212 blocks
[M::mp_idx_build@0.002*2.52] collected syncmers
[M::mp_idx_build@0.064*1.05] 9412 kmer-block pairs
[M::mp_idx_print_stat] 8265 distinct k-mers; mean occ of infrequent k-mers: 1.14; 0 frequent k-mers accounting for 0 occurrences
[M::worker_pipeline::0.086*1.04] mapped 1 sequences
[M::main] Version: 0.2-r127-dirty
[M::main] CMD: ./miniprot --gff test/DPP3-hs.gen.fa.gz test/DPP3-mm.pep.fa.gz
[M::main] Real time: 0.086 sec; CPU: 0.089 sec; Peak RSS: 0.134 GB

## 結果ファイル  
more test/aln.gff
##gff-version 3
##PAF	ENSMUSP00000025851.4	738	0	738	+	chr11:66478458-66505490	27033	0	27030	2055	2214	0	AS:i:3008	ms:i:3549	np:i:711	da:i:0do:i:0	cg:Z:90M2702N30M1272N46M590N25M571N31M3235U43M110N43M76V19M962U64M159U37M361N31M1572N21M96N41M143V40M1547N60M7134N54M4307U49M1I7M	cs:Z::34*tacH:55~gt2702ag:30~gt1272ag*gaaD:2*ga
aG:6*gagK:4*cacR:5*ggcD:6*gagD:17~gt590ag:1*atcV:6*aatD:16~gt571ag:11*gagV:1*gatG*ggaQ:3*cccS*tacH:9*ggcN*tcaT*gD~gt3232ag-ag:1*tccA:4*gtgL:5*agcR:3*cggQ:1*agcN*cctH:17*cagH:5~gt110ag:8*gggE:
6*ataV:27*agS~gt73ag-t:19*gG~gt959ag-gt:3*gtgM:26*ccaL*accA:32*tY~gt156ag-ac:23*acgA*cagK:9*gatE:2~gt361ag:4*ctcR:26~gt1572ag:9*cagK:11~gt96ag:36*cacN:4*gaE~gt140ag-g:35*ttcA:4~gt1547ag:22*at
cV:25*aagR:11~gt7134ag:8*gccV*ggaA:9*acgA:34*gG~gt4304ag-gc:1*gacE:3*ctgV:13*tctC:12*atcV:1*acaI:3*acaA:6*aagR*ggcN*cccQ*agtA+Q:3*tctP:3
chr11:66478458-66505490	miniprot	mRNA	1	27033	3549	+	.	ID=MP000001;Identity=0.9282;Positive=0.9634;Target=ENSMUSP00000025851.4 1 738
chr11:66478458-66505490	miniprot	CDS	1	270	460	+	0	Parent=MP000001;Identity=0.9889;Target=ENSMUSP00000025851.4 1 90
chr11:66478458-66505490	miniprot	CDS	2973	3062	160	+	0	Parent=MP000001;Identity=1.0000;Target=ENSMUSP00000025851.4 91 120
chr11:66478458-66505490	miniprot	CDS	4335	4472	209	+	0	Parent=MP000001;Identity=0.8696;Target=ENSMUSP00000025851.4 121 166
chr11:66478458-66505490	miniprot	CDS	5063	5137	126	+	0	Parent=MP000001;Identity=0.9200;Target=ENSMUSP00000025851.4 167 191
chr11:66478458-66505490	miniprot	CDS	5709	5802	116	+	0	Parent=MP000001;Identity=0.7500;Target=ENSMUSP00000025851.4 192 222
chr11:66478458-66505490	miniprot	CDS	9035	9165	183	+	2	Parent=MP000001;Identity=0.8372;Target=ENSMUSP00000025851.4 223 266
chr11:66478458-66505490	miniprot	CDS	9276	9406	221	+	0	Parent=MP000001;Identity=0.9545;Target=ENSMUSP00000025851.4 267 309
chr11:66478458-66505490	miniprot	CDS	9480	9538	110	+	1	Parent=MP000001;Identity=1.0000;Target=ENSMUSP00000025851.4 310 329
chr11:66478458-66505490	miniprot	CDS	10498	10692	316	+	2	Parent=MP000001;Identity=0.9538;Target=ENSMUSP00000025851.4 330 394
chr11:66478458-66505490	miniprot	CDS	10849	10961	172	+	2	Parent=MP000001;Identity=0.9189;Target=ENSMUSP00000025851.4 395 432
chr11:66478458-66505490	miniprot	CDS	11323	11415	162	+	0	Parent=MP000001;Identity=0.9677;Target=ENSMUSP00000025851.4 433 463
chr11:66478458-66505490	miniprot	CDS	12988	13050	108	+	0	Parent=MP000001;Identity=0.9524;Target=ENSMUSP00000025851.4 464 484
chr11:66478458-66505490	miniprot	CDS	13147	13271	221	+	0	Parent=MP000001;Identity=0.9762;Target=ENSMUSP00000025851.4 485 525
chr11:66478458-66505490	miniprot	CDS	13412	13532	208	+	1	Parent=MP000001;Identity=0.9750;Target=ENSMUSP00000025851.4 526 566
chr11:66478458-66505490	miniprot	CDS	15080	15259	291	+	0	Parent=MP000001;Identity=0.9667;Target=ENSMUSP00000025851.4 567 626
chr11:66478458-66505490	miniprot	CDS	22394	22556	264	+	0	Parent=MP000001;Identity=0.9455;Target=ENSMUSP00000025851.4 627 680
chr11:66478458-66505490	miniprot	CDS	26861	27030	222	+	2	Parent=MP000001;Identity=0.7895;Target=ENSMUSP00000025851.4 681 738
chr11:66478458-66505490	miniprot	stop_codon	27031	27033	0	+	0	Parent=MP000001
  ```

genome 配列は、index 化しなくても動くが、index を作っておくことが推奨。  
  ```
## index 作成
./miniprot -d test/DPP3-hs.gen.fa.mpi test/DPP3-hs.gen.fa.gz
#ログ
[M::mp_ntseq_read@0.002*1.98] read 27033 bases in 1 contigs
[M::mp_idx_build@0.002*1.96] 212 blocks
[M::mp_idx_build@0.003*2.17] collected syncmers
[M::mp_idx_build@0.063*1.06] 9412 kmer-block pairs
[M::mp_idx_print_stat] 8265 distinct k-mers; mean occ of infrequent k-mers: 1.14; 0 frequent k-mers accounting for 0 occurrences
[M::main] Version: 0.2-r127-dirty
[M::main] CMD: ./miniprot -d test/DPP3-hs.gen.fa.mpi test/DPP3-hs.gen.fa.gz
[M::main] Real time: 0.189 sec; CPU: 0.192 sec; Peak RSS: 0.134 GB
## アライメント
 ./miniprot --gff test/DPP3-hs.gen.fa.mpi test/DPP3-mm.pep.fa.gz > test/aln_mpi.gff
#ログ
[M::mp_idx_restore@0.051*1.05] loaded the index
[M::mp_idx_print_stat] 8265 distinct k-mers; mean occ of infrequent k-mers: 1.14; 0 frequent k-mers accounting for 0 occurrences
[M::worker_pipeline::0.073*1.04] mapped 1 sequences
[M::main] Version: 0.2-r127-dirty
[M::main] CMD: ./miniprot --gff test/DPP3-hs.gen.fa.mpi test/DPP3-mm.pep.fa.gz
[M::main] Real time: 0.074 sec; CPU: 0.076 sec; Peak RSS: 0.130 GB
  ```