Skip to content

Commit

Permalink
Update neutralstats.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yjiangnan authored Apr 20, 2018
1 parent 4ada1e7 commit 5ad5b48
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rosely/neutralstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ def neup(pvals0, getLFDR=True, LFDRthr0 = 0.5, minr0=0.00001, nbins=30, df_fit=5
re = r0 + (1 - r0) * pe
x = ps[int(len(ps) * re):]
y = linspace(pe, 1, len(x)) + 1./len(x)
a = linalg.lstsq(transpose([log(x)*y*y]), log(y)*y*y, rcond=None)[0][0]
logX = transpose([log(x)*y*y]); logY = log(y)*y*y
try: a = linalg.lstsq(logX, logY, rcond=None)[0][0]
except: a = linalg.lstsq(logX, logY)[0][0]
# a = dot(log(y), linalg.pinv([log(x)]))[0]
if (1-a)*(1-a0) < 0: aa *= a; break
aa *= a
Expand Down

0 comments on commit 5ad5b48

Please sign in to comment.