-
Notifications
You must be signed in to change notification settings - Fork 0
/
FilterMain.py
65 lines (46 loc) · 2.43 KB
/
FilterMain.py
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
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python
# encoding: utf-8
'''
@author: Jiadong Lin
@contact: jiadong324@gmail.com
@time: 2022/1/10
'''
import sys
import argparse
import os
from FilterRG import run_filter_region_graph
from FilterRep import run_filter_rep
def main():
## Filtering for the results in the paper
# svision_vcf = '/Users/jiadonglin/SVision/HG00733/svision/v136/HG00733_docker_test.svision.s5.graph.vcf'
# svision_exact_graph = '/Users/jiadonglin/SVision/HG00733/svision/v136/HG00733_docker_test.graph_exactly_match.txt'
# outdir = '/Users/jiadonglin/SVision/HG00733/svision/v136'
# exclude_graphid = ['0', '3']
arguments = sys.argv[1:]
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description="""Support functions for SVision downstream analysis""")
required_params = parser.add_argument_group("Input/Output parameters")
required_params.add_argument('-v', dest="vcf", type=os.path.abspath, required=True,
help='VCF file generated by SVision')
required_params.add_argument('-g', dest="graph", type=os.path.abspath, required=True,
help='Isomorphic graph file generated by SVision')
required_params.add_argument('-w', dest='workdir', type=str, required=True,
help='Absolute path to the work directory containing the VCF file')
required_params.add_argument('-i', dest="id", type=str, required=True,
help='Comma separated graph structures to excluded (e.g., 0,3)')
optional_params = parser.add_argument_group("Optional parameters")
optional_params.add_argument('-s', dest='min_sr', type=int, default=5, help='Minimum support read')
optional_params.add_argument('-m', dest='max_sv_size', type=int, default=100000, help='Maximum SV size')
options = parser.parse_args(arguments)
svision_vcf = options.vcf
svision_exact_graph = options.graph
outdir = options.workdir
exclude_graphid = options.id.split(',')
min_sr = options.min_sr
max_sv_size = options.max_sv_size
print('===== Step 1 filter CSVs by region and graph structures =====')
run_filter_region_graph(svision_vcf, svision_exact_graph, exclude_graphid, min_sr, max_sv_size, outdir)
print('===== Step2 filter CSVs by simple repeats =====')
run_filter_rep(outdir, svision_vcf)
if __name__ == '__main__':
main()