-
Notifications
You must be signed in to change notification settings - Fork 0
/
freqacq.py
34 lines (29 loc) · 1001 Bytes
/
freqacq.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
import sys
import os
frqfilename = sys.argv[1]
pathwaybedfile = sys.argv[2]
population = sys.argv[3]
frqfile= open(frqfilename,"r")
frqfilelist = frqfile.readlines()
frqfile.close()
dicfreq = {}
for i in frqfilelist:
dicfreq[i.split()[1]] = {}
if i.split()[1] == "A":
dicfreq[i.split()[1]]["A"] = 1-float(i.split()[4])
dicfreq[i.split()[1]]["G"] = float(i.split()[4])
else:
dicfreq[i.split()[1]]["A"] = float(i.split()[4])
dicfreq[i.split()[1]]["G"] = 1- float(i.split()[4])
pathwaybedfile= open(pathwaybedfilename,"r")
pathwaybedfilelist = pathwaybedfile.readlines()
pathwaybedfile.close()
for i in pathwaybedfilelist:
pathchr = i.split()[0]
pathst = int(i.split()[1])
pathed = int(i.split()[2])
for j in dicfreq.keys():
freqchr = j.split("_")[0]
freqpoi = int(j.split("_")[1])
if freqchr==pathchr and pathst < freqpoi < pathed:
print(freqpoi-50,freqpoi+50, dicfreq[j]["A"],populationmark)