mirror of
https://github.com/lh3/minimap2.git
synced 2026-09-15 21:17:54 +08:00
more functional minimap2.py; added categories
This commit is contained in:
@@ -67,8 +67,11 @@ cdef class Alignment:
|
||||
else: strand = '?'
|
||||
if self._is_primary != 0: tp = 'tp:A:P'
|
||||
else: tp = 'tp:A:S'
|
||||
if self._trans_strand > 0: ts = 'ts:A:+'
|
||||
elif self._trans_strand < 0: ts = 'ts:A:-'
|
||||
else: ts = 'ts:A:.'
|
||||
return "\t".join([str(self._q_st), str(self._q_en), strand, self._ctg, str(self._ctg_len), str(self._r_st), str(self._r_en),
|
||||
str(self._blen - self._NM), str(self._blen), str(self._mapq), "NM:i:" + str(self._NM), tp, "cg:Z:" + self.cigar_str])
|
||||
str(self._blen - self._NM), str(self._blen), str(self._mapq), tp, ts, "cg:Z:" + self.cigar_str])
|
||||
|
||||
cdef class ThreadBuffer:
|
||||
cdef cmappy.mm_tbuf_t *_b
|
||||
|
||||
@@ -4,11 +4,28 @@ import sys, getopt
|
||||
import mappy as mp
|
||||
|
||||
def main(argv):
|
||||
opts, args = getopt.getopt(argv[1:], "")
|
||||
opts, args = getopt.getopt(argv[1:], "x:n:m:k:w:r:")
|
||||
if len(args) < 2:
|
||||
print("Usage: minimap2.py <ref.fa>|<ref.mmi> <query.fq>")
|
||||
print("Usage: minimap2.py [options] <ref.fa>|<ref.mmi> <query.fq>")
|
||||
print("Options:")
|
||||
print(" -x STR preset: sr, map-pb, map-ont, asm5, asm10 or splice")
|
||||
print(" -n INT mininum number of minimizers")
|
||||
print(" -m INT mininum chaining score")
|
||||
print(" -k INT k-mer length")
|
||||
print(" -w INT minimizer window length")
|
||||
print(" -r INT band width")
|
||||
sys.exit(1)
|
||||
a = mp.Aligner(args[0]) # load/build index
|
||||
|
||||
preset, min_cnt, min_sc, k, w, bw = None, None, None, None, None, None
|
||||
for opt, arg in opts:
|
||||
if opt == '-x': preset = arg
|
||||
elif opt == '-n': min_cnt = int(arg)
|
||||
elif opt == '-m': min_chain_score = int(arg)
|
||||
elif opt == '-r': bw = int(arg)
|
||||
elif opt == '-k': k = int(arg)
|
||||
elif opt == '-w': w = int(arg)
|
||||
|
||||
a = mp.Aligner(args[0], preset=preset, min_cnt=min_cnt, min_chain_score=min_sc, k=k, w=w, bw=bw)
|
||||
if not a: raise Exception("ERROR: failed to load/build index file '{}'".format(args[0]))
|
||||
for name, seq, qual in mp.fastx_read(args[1]): # read one sequence
|
||||
for h in a.map(seq): # traverse hits
|
||||
|
||||
Reference in New Issue
Block a user