-
Notifications
You must be signed in to change notification settings - Fork 0
/
varify.py
executable file
·49 lines (38 loc) · 1.26 KB
/
varify.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
# v.1.0.0
import argparse
import sys
import pandas as pd
import warnings
from pathlib import Path
script_dir = Path(__file__).parent
sys.path.append(script_dir)
import utility as utils
# Input Data
'''
-- in_pileup: mpileup.txt #mpileup table
-- in_snpeff: snp_out.txt #SNPEff-like table
'''
if __name__ == "__main__":
PARSER = argparse.ArgumentParser()
PARSER.add_argument('--in_pileup', type=str, required=True)
PARSER.add_argument('--in_snpeff', type=str, required=True)
ARGS = PARSER.parse_args()
# INPUT_CSV = os.path.abspath(ARGS.input_csv)
# file_ending = INPUT_CSV.split(".")[-1]
# if file_ending != "txt":
# raise Exception("Invalid input file format: File is not a CSV file")
#
# csv_input_file = utils.read_file_with_encoding(INPUT_CSV)
# header = csv_input_file.columns.to_list()
# if len(header) == 1:
# raise Exception("Invalid input file format: Input CSV file is not comma-separated.")
# MAIN
# mpileup input
mp = utils.readMP(ARGS.in_pileup)
#snpeff-like table input
so = pd.read_table(ARGS.in_snpeff)
x = utils.mergeTab(mp, so)
pos, alt_dict = utils.checkRNADict(x, mp)
df = utils.varify(x, mp)
# create report csv
df.to_csv('varify_report.csv', header=True)