Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deltaSHAPE.py #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions deltaSHAPE.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down