This repository was archived by the owner on May 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfobjects.py
More file actions
64 lines (53 loc) · 1.77 KB
/
fobjects.py
File metadata and controls
64 lines (53 loc) · 1.77 KB
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
#!/usr/bin/env python3
import re
#variant object holds a row of variant info
class variant:
def __init__(self, id=None, loc=None, gene=None, gt=None, rs=None, sevartype=None, anvartype=None, clinvartype=None, anpred=None, sepred=None, sig=None, dn=None):
self.id = id
self.loc = loc
self.gene = gene
self.gt = gt
self.rs = rs
self.sevartype = sevartype
self.anvartype = anvartype
self.clinvartype = clinvartype
self.anpred = anpred
self.sepred = sepred
self.sig = sig
self.dn = dn
#checks if the chromosome has "chr" or not and adds if it doesn't
def check_loc(self, loc):
m = re.search("chr", loc)
if m:
self.loc = loc
else:
self.loc = "chr" + loc
def format_gt(self, gt):
if gt == "0/1":
self.gt = "HT"
if gt == "1/1":
self.gt = "HM"
if gt == "2/1":
self.gt = "CHT"
def format_dn(self, dn):
new = dn.replace("|", " | ")
new2 = new.replace("_", " ")
self.dn = new2
def format_sevartype(self, sevartype):
new = sevartype.replace("_", " ")
self.sevartype = new
def format_clinvartype(self, clinvartype):
new = clinvartype.replace("_", " ")
self.clinvartype = new
def format_anvartype(self, anvartype):
new = anvartype.replace("_", " ")
self.anvartype = new
def format_anpred(self, anpred):
if anpred == "A":
self.anpred = "Automatic_disease_causing"
if anpred == "D":
self.anpred = "Disease_causing"
if anpred == "N":
self.anpred = "Polymorphism"
if anpred == "P":
self.anpred = "Automatic_polymorphism"