more functional minimap2.py; added categories

This commit is contained in:
Heng Li
2017-09-17 17:06:39 -04:00
parent 0b660c70e2
commit cf93e5c0a1
5 changed files with 43 additions and 7 deletions

View File

@@ -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