Skip to content

Commit

Permalink
Merge pull request #27 from BergmannLab/v0.0.4
Browse files Browse the repository at this point in the history
V0.0.4
  • Loading branch information
Dan-RAI authored Feb 6, 2023
2 parents ecaef18 + 6ce84dd commit 5e1c1e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
19 changes: 11 additions & 8 deletions python/PascalX/pathway.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _genefusion_fuse(self,modules,chrs=None):

return COMPUTE_SET, FUSION_SET

def _genefusion(self,modules,method='auto',mode='auto',reqacc=1e-100,parallel=1,nobar=False,chrs=None):
def _genefusion(self,modules,method='auto',mode='auto',reqacc=1e-100,parallel=1,nobar=False,chrs=None,autorescore=False):

COMPUTE_SET, FUSION_SET = self._genefusion_fuse(modules,chrs)

Expand All @@ -214,7 +214,7 @@ def _genefusion(self,modules,method='auto',mode='auto',reqacc=1e-100,parallel=1,
print("Scoring",len(SET),"missing (meta)-genes")

# Compute missing (meta)-genes
R = self._genescorer.score(SET,method=method,mode=mode,reqacc=reqacc,parallel=parallel,nobar=nobar,autorescore=True)
R = self._genescorer.score(SET,method=method,mode=mode,reqacc=reqacc,parallel=parallel,nobar=nobar,autorescore=autorescore)

#print(R)
#print(FUSION_SET)
Expand Down Expand Up @@ -263,7 +263,7 @@ class chi2rank(pathwayscorer):
"""

def score(self,modules,method='saddle',mode='auto',reqacc=1e-100,parallel=1,nobar=False,genes_only=False,chrs_only=None):
def score(self,modules,method='saddle',mode='auto',reqacc=1e-100,parallel=1,nobar=False,genes_only=False,chrs_only=None,autorescore=True):
"""
Scores a set of pathways/modules
Expand All @@ -274,15 +274,17 @@ def score(self,modules,method='saddle',mode='auto',reqacc=1e-100,parallel=1,noba
method(string): Method to use to evaluate tail probability ('auto','davies','ruben','satterthwaite','pearson','saddle')
mode(string): Precision mode to use ('','128b','100d','auto')
reqacc(float): requested accuracy
autorescore(bool): Automatically try to re-score failed genes
nobar(bool): Show progress bar
genes_only(bool): Compute only (fused)-genescores (accessible via genescorer method)
chrs_only(list): Only consider genes on listed chromosomes. None for all.
chrs_only(list): Only consider genes on listed chromosomes. None for all
"""
tic = time.time()


# Compute fusion sets
if self._fuse:
COMPUTE_SET,FUSION_SET,R = self._genefusion(modules,method=method,mode=mode,reqacc=reqacc,parallel=parallel,nobar=nobar,chrs=chrs_only)
COMPUTE_SET,FUSION_SET,R = self._genefusion(modules,method=method,mode=mode,reqacc=reqacc,parallel=parallel,nobar=nobar,chrs=chrs_only,autorescore=autorescore)
else:
COMPUTE_SET,FUSION_SET,R = self._nogenefusion(modules)

Expand Down Expand Up @@ -400,7 +402,7 @@ class chi2perm(pathwayscorer):
Genes in the background gene sets are NOT fused.
"""

def score(self,modules,samples=100000,method='saddle',mode='auto',reqacc=1e-100,parallel=1,nobar=False):
def score(self,modules,samples=100000,method='saddle',mode='auto',reqacc=1e-100,parallel=1,nobar=False,autorescore=True):
"""
Scores a set of pathways/modules
Expand All @@ -412,11 +414,12 @@ def score(self,modules,samples=100000,method='saddle',mode='auto',reqacc=1e-100,
mode(string): Precision mode to use ('','128b','100d','auto')
reqacc(float): requested accuracy
nobar(bool): Show progress bar
autorescore(bool): Automatically try to re-score failed genes
"""
# Compute fusion sets
if self._fuse:
COMPUTE_SET,FUSION_SET,R = self._genefusion(modules,method=method,mode=mode,reqacc=reqacc,parallel=parallel,nobar=nobar)
COMPUTE_SET,FUSION_SET,R = self._genefusion(modules,method=method,mode=mode,reqacc=reqacc,parallel=parallel,nobar=nobar,autorescore=autorescore)
else:
COMPUTE_SET,FUSION_SET,R = self._nogenefusion(modules)

Expand Down
2 changes: 1 addition & 1 deletion python/docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Welcome to PascalX's documentation!
===================================

PascalX is a python3 library (`source <https://github.com/BergmannLab/PascalX>`_) for high precision gene and pathway scoring for GWAS summary statistics. Aggregation of SNP p-values to gene and pathway scores follows the `Pascal <https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1004714>`_ methodology, which is based on :math:`\chi^2` statistics. The cummulative distribution function of the weighted :math:`\chi^2` distribution can be calculated approximately or exactly via a multi-precision C++ implementation of Ruben's and Davies algorithm. This allows to apply the Pascal methodology to modern UK BioBank scale GWAS. In addition, PascalX offers a novel coherence test between two different GWAS on the level of genes, based on the product-normal distribution, as described `here <https://doi.org/10.1101/2021.05.16.21257289>`_.
PascalX is a python3 library (`source <https://github.com/BergmannLab/PascalX>`_) for high precision gene and pathway scoring for GWAS summary statistics. Aggregation of SNP p-values to gene and pathway scores follows the `Pascal <https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1004714>`_ methodology, which is based on :math:`\chi^2` statistics. The cumulative distribution function of the weighted :math:`\chi^2` distribution can be calculated approximately or exactly via a multi-precision C++ implementation of Ruben's and Davies algorithm. This allows to apply the Pascal methodology to modern UK BioBank scale GWAS. In addition, PascalX offers a novel coherence test between two different GWAS on the level of genes, based on the product-normal distribution, as described `here <https://doi.org/10.1101/2021.05.16.21257289>`_.

**Highlights:**

Expand Down
10 changes: 5 additions & 5 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def find_version(*file_paths):
"numpy>=1.18.0",
"seaborn>=0.11.0",
"progressbar>=2.5",
"docutils<0.18",
"sphinx<6,>=1.6",
"sphinx-rtd-theme>=0.5.0",
"fastnumbers>=3.1.0"
],
"fastnumbers>=3.1.0",
#"docutils<0.18",
#"sphinx<6,>=1.6",
#"sphinx-rtd-theme>=0.5.0",
],
setup_requires=["cffi","path.py"],
cffi_modules=["hpstats.py:ffibuilder","wchissum.py:ffibuilder"],
zip_safe=False,
Expand Down

0 comments on commit 5e1c1e7

Please sign in to comment.