Skip to content

Commit

Permalink
Added handling of BED/BEDGRAPH track files where all chromosomes are …
Browse files Browse the repository at this point in the history
…not present. (#53)
  • Loading branch information
mnshgl0110 committed Jun 21, 2023
1 parent 1e5a8c4 commit cd9f7c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plotsr/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.1"
__version__ = "1.1.2"
6 changes: 3 additions & 3 deletions plotsr/scripts/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -1801,11 +1801,11 @@ def drawtracks(ax, tracks, s, chrgrps, chrlengths, v, itx, cfg, minl=0, maxl=-1)
chrpos = [k[0] if not itx else k[0] + rbuff[chrs[j]] for k in bedbin[chrs[j]]]
tpos = [k[1] for k in bedbin[chrs[j]]]
# print(cl, len(tpos))
tposmax = max(tpos)
tposmax = max(tpos) if len(tpos) > 0 else 0
tvars = {'color': tracks[i].lc, 'lw': tracks[i].lw, 'zorder': 2, 'alpha': tracks[i].ta}
if not v:
y0 = cl - j - th*(ti) if not itx else 1 - th*(ti)
ypos = [(t*diff/tposmax)+y0 for t in tpos]
ypos = [(t*diff/tposmax)+y0 for t in tpos] if len(tpos) > 0 else y0
if tracks[i].tt == 'f':
ax.fill_between(chrpos, ypos, y0, **tvars)
elif tracks[i].tt == 'l':
Expand All @@ -1817,7 +1817,7 @@ def drawtracks(ax, tracks, s, chrgrps, chrlengths, v, itx, cfg, minl=0, maxl=-1)
ax.text(xpos, y0 + diff/2, tracks[i].n, color=tracks[i].nc, fontsize=tracks[i].ns, fontfamily=tracks[i].nf, ha='left', va='center', rotation='horizontal')
else:
x0 = j + (ti)*th - diff if not itx else (ti)*th - diff
xpos = [x0 + diff - (t*diff/tposmax) for t in tpos]
xpos = [x0 + diff - (t*diff/tposmax) for t in tpos] if len(tpos) > 0 else x0
if tracks[i].tt == 'f':
ax.fill_betweenx(chrpos, xpos, x0+diff, **tvars)
elif tracks[i].tt == 'l':
Expand Down

0 comments on commit cd9f7c2

Please sign in to comment.