-
Notifications
You must be signed in to change notification settings - Fork 215
Update GIN #87
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
base: main
Are you sure you want to change the base?
Update GIN #87
Changes from 2 commits
a282d62
89b80f1
fcbafd3
200d833
0db446d
9ad04fa
1b2d4c7
5229b06
ebb808b
9299ea2
36d5d4b
c92cb8f
4f168e8
e307426
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,45 @@ | ||||||||||||||
#------------------------------------------------------------------------------- | ||||||||||||||
# Name: 模块1 | ||||||||||||||
# Purpose: | ||||||||||||||
# | ||||||||||||||
# Author: YY | ||||||||||||||
# | ||||||||||||||
# Created: 03/03/2021 | ||||||||||||||
# Copyright: (c) YY 2021 | ||||||||||||||
# Licence: <your licence> | ||||||||||||||
#------------------------------------------------------------------------------- | ||||||||||||||
import math | ||||||||||||||
from scipy.stats import chi2 | ||||||||||||||
|
||||||||||||||
def FisherTest(pvals,alph=0.01): | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: comma between different variables. You can follow Google Python codestyle when writing code: https://google.github.io/styleguide/pyguide.html You can find automated tool like pylint in the link.
Suggested change
|
||||||||||||||
Fisher_Stat=0 | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space between operand
Suggested change
|
||||||||||||||
L = len(pvals) | ||||||||||||||
for i in range(0,L): | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. address this? |
||||||||||||||
if pvals[i] ==0: | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
TP = 1e-05 | ||||||||||||||
else: | ||||||||||||||
TP = pvals[i] | ||||||||||||||
|
||||||||||||||
Fisher_Stat = Fisher_Stat-2*math.log(TP) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
Fisher_pval = 1-chi2.cdf(Fisher_Stat, 2*L) #自由度2*L | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||||||||||||||
|
||||||||||||||
#print(Fisher_pval) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this |
||||||||||||||
|
||||||||||||||
if Fisher_pval >alph: | ||||||||||||||
return True,Fisher_pval | ||||||||||||||
else: | ||||||||||||||
return False,Fisher_pval | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
def main(): | ||||||||||||||
pvals = [0.01,0.9] | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
FisherTest(pvals,0.1) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
if __name__ == '__main__': | ||||||||||||||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should delete this, or fill it.
In the open-source code, we should maintain high code quality --- we shouldn't allow any unnecessary comments in the code.
Sorry there are lots of rules in industry code that are different from research code :(