diff --git a/deltaSHAPE.py b/deltaSHAPE.py index 82eef1a..6a4f157 100644 --- a/deltaSHAPE.py +++ b/deltaSHAPE.py @@ -75,8 +75,8 @@ def smooth(data,err,pad): # use numpy masked array to calculate average without including no-data (nan) nucleotides. new_data.append(np.mean(np.ma.MaskedArray([j for j in data[i-pad:i+pad+1]], np.isnan([j for j in data[i-pad:i+pad+1]])))) - # use stats.nanmean to calculate average without including no-data (nan) nucleotides. This causes long_scalars runtime warnings. - #new_data.append(stats.nanmean([j for j in data[i-pad:i+pad+1] if np.isnan(j) != True])) + # use np.nanmean to calculate average without including no-data (nan) nucleotides. This causes long_scalars runtime warnings. + #new_data.append(np.nanmean([j for j in data[i-pad:i+pad+1] if np.isnan(j) != True])) errs = np.array(err[i-pad:i+pad+1]) squerrs = np.power([j for j in errs if np.isnan(j) != True], 2) total = np.sum(squerrs) @@ -106,8 +106,8 @@ def z_factor(data1, data2, err1, err2, factor=1.96): return z_factors def calc_zScores(diffs): - mean = stats.nanmean(diffs) - sigma = stats.nanstd(diffs) + mean = np.nanmean(diffs) + sigma = np.nanstd(diffs) # calc Z-score z_scores = (diffs - mean) / sigma return np.array(z_scores)