Skip to content

Commit

Permalink
sliding window bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Huanle committed Oct 6, 2020
1 parent c3f8be7 commit 0cd0e42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion epinano_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ def slide_per_site_var (per_site_var,win=5):
consecutive_lines.append (window+',+0' +','+",".join (middle))
kmer = kmer +middle[2]
for i in range(1,win//2+1):
k = (ref,str(int(pos) + i),strand)
k = (ref,str(int(pos)+i),strand)
relative_pos = '+'+str(i)
if k in contents:
kmer = kmer +contents[k].split(',')[2]
Expand Down Expand Up @@ -862,8 +862,11 @@ def slide_per_site_var (per_site_var,win=5):
current_win = (firstline[0], firstline[1], firstline[3], firstline[6])
lines = []
lines.append (firstline)
ary = []
for l in tmpfh:
ary = l.rstrip().split(',')
if len (ary) < 14:
continue
window = (ary[0], ary[1], ary[3], ary[6])
if window != current_win:
cov, q, mis, ins, dele = [], [], [], [], []
Expand All @@ -885,6 +888,8 @@ def slide_per_site_var (per_site_var,win=5):
# last 5 lines
cov, q, mis, ins,dele = [], [], [], [], []
for ele in lines:
if len (ary) <14:
continue
q.append (ele[8])
mis.append (ele[11])
ins.append (ele[12])
Expand Down

0 comments on commit 0cd0e42

Please sign in to comment.