Skip to content

Commit

Permalink
replace np.float/np.int
Browse files Browse the repository at this point in the history
  • Loading branch information
PengNi committed Aug 24, 2023
1 parent 9fe57b1 commit dc5208b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ optimize/test more on multi-gpu support in call_mods module

add scipy==1.7.3 in requirements (floating point error in scipy>=1.9->tombo). fix this in deepsignal-plant, although tombo only is the pre-process tool for this tool.

replace np.float/np.int with float/int in extract_features module


0.1.6
-----
Expand Down
8 changes: 4 additions & 4 deletions deepsignal_plant/extract_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _get_label_raw(fast5_fn, correct_group, correct_subgroup):
fast5_data.close()
raise KeyError('no read_start_rel_to_raw in event attributes')

lengths = event['length'].astype(np.int)
lengths = event['length'].astype(int)
base = [x.decode("UTF-8") for x in event['base']]
assert len(starts) == len(lengths)
assert len(lengths) == len(base)
Expand Down Expand Up @@ -178,9 +178,9 @@ def _get_alignment_info_from_fast5(fast5_path, corrected_group='RawGenomeCorrect

def _normalize_signals(signals, normalize_method="mad"):
if normalize_method == 'zscore':
sshift, sscale = np.mean(signals), np.float(np.std(signals))
sshift, sscale = np.mean(signals), float(np.std(signals))
elif normalize_method == 'mad':
sshift, sscale = np.median(signals), np.float(robust.mad(signals))
sshift, sscale = np.median(signals), float(robust.mad(signals))
else:
raise ValueError("")
if sscale == 0.0:
Expand Down Expand Up @@ -271,7 +271,7 @@ def _get_scaling_of_a_read(fast5fp):


def _rescale_signals(rawsignals, scaling, offset):
return np.array(scaling * (rawsignals + offset), dtype=np.float)
return np.array(scaling * (rawsignals + offset), dtype=float)


def _extract_features(fast5s, corrected_group, basecall_subgroup, normalize_method,
Expand Down

0 comments on commit dc5208b

Please sign in to comment.