-
Notifications
You must be signed in to change notification settings - Fork 17
/
mdm
executable file
·56 lines (55 loc) · 3.91 KB
/
mdm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
################################################################
# This file part of GALA Gap-free Long-reads Assembler #
# Auther: Mohamed awad #
# Company: Xiangchao Gan lab (MPIPZ) #
# Released under the (MIT) license (see LICENSE file) #
################################################################
import os
import sys
scr='src'
path=os.path.dirname(os.path.abspath(__file__))
absolute=os.path.join(path,scr)
sys.path.insert(0, absolute)
from cut_gathering import cut_gathering
import argparse
parser = argparse.ArgumentParser(prog="mdm",usage='%(prog)s -h [options] -m path/to/mapping_files -n number of drafts',description='MDM Mis-Assembly Detector Module, part of GALA Gap-free Long-reads Assembler')
parser.add_argument("mapping_files",nargs=1,type=str,help='mapping paf file \t [required]')
parser.add_argument("drafts",nargs=1,type=int,help='Number of drafts\t[required]')
parser.add_argument("-b",nargs=1, type=int, default=[5000], metavar='Alignment block length\t [default 5000]',dest="block")
parser.add_argument("-p",nargs=1, type=int, default=[70], metavar='Alignment identity percentage\t [default 70%]',dest="percent")
parser.add_argument("-c",nargs=1, type=int, default=[5000], metavar='Shortest contig length\t [default 5000]',dest="contig")
parser.add_argument("-q",nargs=1, type=int, default=[20], metavar='Mapping quality\t [default 20]',dest="qty")
parser.add_argument("-k",nargs=1, type=int, default=[175], metavar='Mis-assembly block\t [default 175]\n\t\tIt is better to extend the misassembly block in case of\n\t\tunpolished assemblies or expected mis-assemblies in highly repetative regions',dest="cutblock")
parser.add_argument("-t",nargs=1, type=str, default=['False'], metavar='cut on a threshold passed by -u\t[default False]',dest="threshold")
parser.add_argument("-u",nargs=1, type=int, default=[3], metavar='threshold cut value\t[default 3]',dest="threshold_value")
parser.add_argument("-l",nargs=1, type=int, default=[1], metavar='lowest number of discordances to cut\t[default 1]',dest="lowest_cut")
parser.add_argument("--cut1",nargs=1, type=int, default=[50000], metavar='The length of the smallest discordance on contigs of length >= 1000000 \t[default 50000]\n\t\t Be very careful with this parameter',dest="diff_1")
parser.add_argument("--cut2",nargs=1, type=int, default=[25000], metavar='The length of the smallest discordance on contigs of length >= 100000 \t[default 25000]\n\t\t Be very careful with this parameter',dest="diff_2")
parser.add_argument("--cut3",nargs=1, type=int, default=[15000], metavar='The length of the smallest discordance on contigs of length >= 5000 \t[default 15000]\n\t\t Be very careful with this parameter',dest="diff_3")
parser.add_argument("-f",nargs=1, type=str, default=['gathering'], metavar='Output files name\t[default gathering]',dest="name")
parser.add_argument("-o",nargs=1, type=str, default=[os.getcwd()], metavar='output files path\t[default current directory]',dest="output")
parser.add_argument('-v','--version', action='version', version='%(prog)s 1.0.0')
args = parser.parse_args()
paf=args.mapping_files[0]
drafts=args.drafts[0]
block=args.block[0]
percent=args.percent[0]
qty=args.qty[0]
output=args.output[0]
name=args.name[0]
contig=args.contig[0]
cutblock=args.cutblock[0]
threshold_value=args.threshold_value[0]
lowest_cut=args.lowest_cut[0]
diff_1=args.diff_1[0]
diff_2=args.diff_2[0]
diff_3=args.diff_3[0]
threshold=args.threshold[0]
if threshold in ('False','FALSE','F','f'):
threshold=False
elif threshold in ('True','TRUE','T','t'):
threshold=True
cut_gathering(path=paf,number_of_drafts=drafts,block=block,percentage=percent,shortage_contig=contig,quality=qty,out_file=True,out_name=name,out_path=output,lowest_cut=lowest_cut,cut_block=cutblock,threshold=threshold,threshold_value=threshold_value,diff_1=diff_1,diff_2=diff_2,diff_3=diff_3)
if '-v':
parser.parse_args(['-v'])