tanghaibao / goatools

Python library to handle Gene Ontology (GO) terms
BSD 2-Clause "Simplified" License
781 stars 210 forks source link

AttributeError: 'module' object has no attribute '__version__' #157

Closed gosalone closed 4 years ago

gosalone commented 4 years ago

Hi dear colleagues, I installed and run goatools with the test data and I got the error below.

$ python scripts/find_enrichment.py --pval=0.05 --indent data/study.txt data/population.txt data/association.txt --outfile=goea_results.tsv

go-basic.obo: fmt(1.2) rel(2020-02-21) 47,245 GO Terms HMS:0:00:00.703169 128,975 annotations READ: data/association.txt Study: 276 vs. Population 33239

Load BP Gene Ontology Analysis ... Propagating term counts up: is_a 87% 28,991 of 33,239 population items found in association

Load CC Gene Ontology Analysis ... Propagating term counts up: is_a 86% 28,574 of 33,239 population items found in association

Load MF Gene Ontology Analysis ... Propagating term counts up: is_a 87% 28,910 of 33,239 population items found in association

Run BP Gene Ontology Analysis: current study set of 276 IDs ... 86% 237 of 276 study items found in association 100% 276 of 276 study items found in population(33239) Calculating 3,478 uncorrected p-values using fisher 3,478 GO terms are associated with 28,991 of 33,239 population items 461 GO terms are associated with 237 of 276 study items METHOD bonferroni: 3 GO terms found significant (< 0.05=alpha) ( 3 enriched + 0 purified): local bonferroni 33 study items associated with significant GO IDs (enriched) 0 study items associated with significant GO IDs (purified) METHOD sidak: 3 GO terms found significant (< 0.05=alpha) ( 3 enriched + 0 purified): local sidak 33 study items associated with significant GO IDs (enriched) 0 study items associated with significant GO IDs (purified) METHOD holm: 3 GO terms found significant (< 0.05=alpha) ( 3 enriched + 0 purified): local holm 33 study items associated with significant GO IDs (enriched) 0 study items associated with significant GO IDs (purified) Traceback (most recent call last): File "scripts/find_enrichment.py", line 44, in main() File "scripts/find_enrichment.py", line 31, in main obj = GoeaCliFnc(GoeaCliArgs().args) File "/home/tarek/.local/lib/python2.7/site-packages/goatools/cli/find_enrichment.py", line 233, in init self.results_all = self.objgoeans.run_study(_study) File "/home/tarek/.local/lib/python2.7/site-packages/goatools/goea/go_enrichment_ns.py", line 20, in run_study ns2results = {ns:o.run_study(study_ids) for ns, o in sorted(self.ns2objgoea.items())} File "/home/tarek/.local/lib/python2.7/site-packages/goatools/goea/go_enrichment_ns.py", line 20, in ns2results = {ns:o.run_study(study_ids) for ns, o in sorted(self.ns2objgoea.items())} File "/home/tarek/.local/lib/python2.7/site-packages/goatools/go_enrichment.py", line 312, in run_study self._run_multitest_corr(results, methods, alpha, study, log) File "/home/tarek/.local/lib/python2.7/site-packages/goatools/go_enrichment.py", line 395, in _run_multitest_corr self._run_multitestnt_method.source File "/home/tarek/.local/lib/python2.7/site-packages/goatools/go_enrichment.py", line 427, in _run_multitest_statsmodels multipletests = self.methods.get_statsmodels_multipletests() File "/home/tarek/.local/lib/python2.7/site-packages/goatools/multiple_testing.py", line 142, in get_statsmodels_multipletests from statsmodels.sandbox.stats.multicomp import multipletests File "/home/tarek/.local/lib/python2.7/site-packages/statsmodels/sandbox/init.py", line 4, in from statsmodels.tools._testing import PytestTester File "/home/tarek/.local/lib/python2.7/site-packages/statsmodels/tools/init.py", line 1, in from .tools import add_constant, categorical File "/home/tarek/.local/lib/python2.7/site-packages/statsmodels/tools/tools.py", line 8, in from statsmodels.compat.python import lzip, lmap File "/home/tarek/.local/lib/python2.7/site-packages/statsmodels/compat/init.py", line 1, in from statsmodels.tools._testing import PytestTester File "/home/tarek/.local/lib/python2.7/site-packages/statsmodels/tools/_testing.py", line 11, in from statsmodels.compat.pandas import assert_equal File "/home/tarek/.local/lib/python2.7/site-packages/statsmodels/compat/pandas.py", line 4, in import numpy as np File "/home/tarek/.local/lib/python2.7/site-packages/statsmodels/compat/numpy.py", line 46, in NP_LT_114 = LooseVersion(np.version) < LooseVersion('1.14') AttributeError: 'module' object has no attribute 'version'

Could help me solve this problem. Thank you

dvklopfenstein commented 4 years ago

Hello,

Thank you for your interest in GOATOOLS and taking the time to write us.

Could you give Python3 a try?

python3 scripts/find_enrichment.py --pval=0.05 --indent data/study.txt data/population.txt data/association.txt --outfile=goea_results.tsv

What operating system are you using?

uname -a

What version of Python are you using?

$ python --version
Python 3.6.9

What is the version of some of the Python packages that you are using?

$ python3
Python 3.6.9 (default, Jul 21 2019, 14:33:59)
[GCC 7.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> print(numpy.version.version)
1.16.2
>>> import statsmodels
>>> print(statsmodels.version.version)
0.9.0
>>> import pandas
>>> print(pandas.version.version)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pandas' has no attribute 'version'
>>> print(pandas.__version__)
0.22.0
>>> import goatools
>>> print(goatools.version.version)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'goatools' has no attribute 'version'
>>> print(goatools.__version__)
v0.9.9+80.gf08732d
gosalone commented 4 years ago

Hi @dvklopfenstein Below the requested information:

Could you give Python3 a try?

``python3 scripts/find_enrichment.py --pval=0.05 --indent data/study.txt data/population.txt data/association.txt --outfile=goea_results.tsv Traceback (most recent call last): File "scripts/find_enrichment.py", line 22, in from goatools.cli.find_enrichment import GoeaCliArgs ModuleNotFoundError: No module named 'goatools'

What operating system are you using? ``Linux HP-Z800-Workstation 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

What version of Python are you using? ``Python 2.7.15+

What is the version of some of the Python packages that you are using? `Python 3.8.0 (default, Oct 23 2019, 13:02:33) [GCC 7.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import numpy Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy' import statsmodels Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'statsmodels' import pandas Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'pandas' import goatools print(goatools.version.version) Traceback (most recent call last): File "", line 1, in AttributeError: module 'goatools' has no attribute 'version' print(goatools.version) v1.0.2+8.gf08732d.dirty`

for these numpy, pandas packages .... have been installed with python2.  

gosalone commented 4 years ago

I solved the problem. I installed python 3.6 then I imported the necessary modules (numpy, pandas, goatools ..) with this version of python. So the tool is well executed.

By cons I used my data and I got an error of:

only 0.6442274154168119 fraction of genes / proteins in study are found in the population background.

I will open a new issue to resolve this error

dvklopfenstein commented 4 years ago

@gosalone ,

Great. Happy to hear you have gotten past the numpy version error.

Please do open a new issue for the fraction of gene/proteins message if needed.