Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions umap/uint8_to_bed_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ def write_as_wig(self, uint_path, out_path, kmer, chrom):
unimap_diff = np.diff(np.array(ar_quant > 0, dtype=int))
poses_start, = np.where(unimap_diff == 1)
poses_end, = np.where(unimap_diff == -1)
if len(poses_start) != len(poses_end):
if len(poses_start) > len(poses_end):
poses_end = np.append(poses_end, [len(uniquely_mappable)])
else:
poses_start = np.append([0], poses_start)
elif uniquely_mappable[0] == 1:
if uniquely_mappable[0] > 0:
# If the first element of uniquely_mappable is nonzero,
# then poses_start is missing the start position of the first "run"
poses_start = np.append([0], poses_start)
poses_end = np.append(poses_end, [len(uniquely_mappable)])
if uniquely_mappable[-1] > 0:
# If the last element of uniquely_mappable is nonzero,
# then poses_end is missing the end position of the last "run".
poses_end = np.append(poses_end, [len(uniquely_mappable) - 1])
for ind_st in range(len(poses_start)):
pos_st = poses_start[ind_st] + 1
pos_end = poses_end[ind_st] + 1
Expand Down