Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions telescope/utils/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def __init__(self, score_matrix, opts):
# Y[i] is the ambiguity indicator for fragment i, where Y[i]=1 if
# fragment i is aligned to multiple transcripts and Y[i]=0 otherwise.
# Store as N x 1 matrix
self.Y = (self.Q.count(1) > 1).astype(np.uint8)
self.Y = (self.Q.count(1) > 1).astype(int)
self._yslice = self.Y[:,0].nonzero()[0]

# Log-likelihood score
Expand Down Expand Up @@ -856,10 +856,10 @@ def reassign(self, method, thresh=0.9, initial=False):
assignments = v.norm(1)
elif method == 'unique':
# Zero all rows that are ambiguous
assignments = _z.multiply(1 - self.Y).ceil().astype(np.uint8)
assignments = _z.multiply(1 - self.Y).ceil().astype(int)
elif method == 'all':
# Return all nonzero elements
assignments = _z.apply_func(lambda x: 1 if x > 0 else 0).astype(np.uint8)
assignments = _z.apply_func(lambda x: 1 if x > 0 else 0).astype(int)

assignments = csr_matrix(assignments)
return assignments
Expand Down
6 changes: 3 additions & 3 deletions telescope/utils/sparse_plus.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def _norm(self, axis=None):

def _norm_loop(self, axis=None):
if axis is None:
ret = self.copy().astype(np.float)
ret = self.copy().astype(float)
ret.data /= sum(ret)
return ret
elif axis == 0:
raise NotImplementedError
elif axis == 1:
ret = self.copy().astype(np.float)
ret = self.copy().astype(float)
rowiter = zip(ret.indptr[:-1], ret.indptr[1:], ret.sum(1).A1)
for d_start, d_end, d_sum in rowiter:
if d_sum != 0:
Expand Down Expand Up @@ -89,7 +89,7 @@ def scale(self, axis=None):
def _scale(self, axis=None):
if axis is None:
return type(self)(self.multiply(1. / self.max()))
# ret = self.copy().astype(np.float)
# ret = self.copy().astype(float)
# return ret / ret.max()
elif axis == 0:
raise NotImplementedError
Expand Down