-
Notifications
You must be signed in to change notification settings - Fork 2
/
compute_charr.py
105 lines (100 loc) · 2.8 KB
/
compute_charr.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import argparse
from .utils import *
def main(args):
hl.init(default_reference="GRCh38")
hl._set_flags(grouped_aggregate_buffer_size="5")
hl._set_flags(use_new_shuffle="1")
run_charr(
format=args.input_file_format,
path=args.input_file_path,
output_dir=args.output_dir,
output_name=args.output_name,
min_af=args.min_af,
max_af=args.max_af,
min_dp=args.min_dp,
max_dp=args.max_dp,
min_gq=args.min_gq,
ref_AF_field=args.ref_AF_field,
data_type=args.data_type,
num_partitions=args.n_partitions,
write_charr=True,
extension=args.extension,
overwrite=args.overwrite,
)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--input-file-format",
type=str,
nargs="?",
default="vcf",
choices=["gvcf", "mt", "vcf", "vds"],
help="Format of the input genotype data.",
)
parser.add_argument(
"--input-file-path", type=str, help="Path to import the genotype data from"
)
parser.add_argument(
"--output-dir", type=str, help="Directory to write charr table to"
)
parser.add_argument("--output-name", type=str, help="Filename to write charr table")
parser.add_argument(
"--min-af",
type=float,
nargs="?",
help="Filter to variants with reference allele frequency above this value",
default=0.05,
)
parser.add_argument(
"--max-af",
type=float,
nargs="?",
help="Filter to variants with reference allele frequency below this value",
default=0.95,
)
parser.add_argument(
"--min-dp",
type=float,
nargs="?",
help="Filter to variants with DP above this value",
default=20,
)
parser.add_argument(
"--max-dp",
type=float,
nargs="?",
help="Filter to variants with DP below this value",
default=100,
)
parser.add_argument(
"--min-gq",
type=float,
nargs="?",
help="Filter to variants with GQ above this value",
default=20,
)
parser.add_argument("--ref-AF-field", type=str, default=None)
parser.add_argument(
"--data_type",
type=str,
nargs="?",
default="genomes",
choices=["genomes", "exomes"],
)
parser.add_argument(
"--extension",
type=str,
nargs="?",
default="ht",
choices=["ht", "tsv"],
)
parser.add_argument(
"--n_partitions",
help="Number of desired partitions for import VCF",
default=1000,
type=int,
)
parser.add_argument("--overwrite", help="Overwrite", action="store_true")
args = parser.parse_args()
print(args)
main(args)