Comments (19)
Thank you for your interest in GOATOOLS and taking the time to contact us.
In an old version of GOATOOLS, this issue could show up. Did you download GOATOOLS using 'pip install' or did you clone from the repo?
What version of GOATOOLS are you using? Do this to see the version:
$ python
Python 2.7.13 (default, Mar 13 2017, 20:56:15)
>>> import goatools
>>> print goatools.__version__
0.6.10
Also, try running this GOATOOLS test on your machine and let us know what you see:
$ cd <GOATOOLS_REPO>
$ python tests/test_go_print.py
from goatools.
It looks like you may not be reading a go-basic.obo file. Try this code. You will need to have an "go-basic.obo" file downloaded from http://geneontology.org/ontology/go-basic.obo:
reader = OBOReader("go-basic.obo")
for rec in reader: print(rec)
from goatools.
When I opened the issue I was using the latest version 0.6.10 cloned from the Git repo with Python 3.6.0. I have also tried installing with pip, but that produces the same error. I also have the latest GO downloaded.
Running test_go_print.py
outputs:
$ python tests/test_go_print.py
EXISTS: go-basic.obo
<goatools.obo_parser.OBOReader object at 0x11050a908>
Traceback (most recent call last):
File "tests/test_go_print.py", line 19, in <module>
test_go_print()
File "tests/test_go_print.py", line 14, in test_go_print
prt.write("First GO Record: {REC}\n".format(REC=go_terms[0]))
File "/Users/harry/anaconda/lib/python3.6/site-packages/goatools/obo_parser.py", line 260, in __str__
NAME=self.name, NS=self.namespace, OLD=obsolete)
TypeError: unsupported format string passed to NoneType.__format__
Does this help in any way?
from goatools.
Please do a pull request and re-run the test_go_print.py again. I added some more prints so that we may obtain more information. Please copy everything you see into your reply. Also, when you 'ls' on the obo file, what do you see. I see this:
$ ls -lrt go-basic.obo
-rw-r--r--+ 1 note2 note2 33520340 May 30 16:02 go-basic.obo
from goatools.
After pulling the new master and downloading the latest GO:
$ ls -l go-basic.obo
-rw-r--r-- 1 harry staff 33520340 May 29 14:33 go-basic.obo
Running test_go_print.py
fails when iterating over the go_terms
object:
$ python tests/test_go_print.py
EXISTS: go-basic.obo
OBOReader: <goatools.obo_parser.OBOReader object at 0x10be4d470>
format-version: 1.2
data-version: releases/2017-05-28
Found 46645 GO Records:
Traceback (most recent call last):
File "tests/test_go_print.py", line 21, in <module>
test_go_print()
File "tests/test_go_print.py", line 18, in test_go_print
prt.write("{I:>7,} {RECORD}\n".format(I=idx, RECORD=go_rec))
File "/Users/harry/anaconda/lib/python3.6/site-packages/goatools-0.6.10-py3.6.egg/goatools/obo_parser.py", line 260, in __str__
TypeError: unsupported format string passed to NoneType.__format__
from goatools.
Okay thanks. Let me look into it...
from goatools.
Please do a pull and re-run the test again. I changed the code so if the level and depth have not been initialized level and depth will not print.
from goatools.
Pulled and re-run, but it's still trying to format None
into strings:
$ python tests/test_go_print.py
EXISTS: go-basic.obo
Python Version: 3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
OBOReader: <goatools.obo_parser.OBOReader object at 0x1058fd438>
format-version: 1.2
data-version: releases/2017-05-28
Found 46645 GO Records:
Traceback (most recent call last):
File "tests/test_go_print.py", line 22, in <module>
test_go_print()
File "tests/test_go_print.py", line 19, in test_go_print
prt.write("{I:>7,} {RECORD}\n".format(I=idx, RECORD=go_rec))
File "/Users/harry/anaconda/lib/python3.6/site-packages/goatools-0.6.10-py3.6.egg/goatools/obo_parser.py", line 260, in __str__
TypeError: unsupported format string passed to NoneType.__format__
Do you see this error as well?
from goatools.
Thanks for re-running it. I am not seeing this error, but my daily work is done with Python 2.7. I see that you are using Python 3.6. I will try that version of Python to re-create what you are seeing.
from goatools.
I am still working on it and will get back to you soon.
from goatools.
I am taking a look at this issue now. Thank you for your patience. I had a work deadline, which took me away from your issue.
from goatools.
I just ran the script using python3 and was not able to replicate the error you are seeing. This is what I did:
$ python3 tests/test_go_print.py
from goatools.
@tanghaibao , can you please create a new PyPI version of goatools?
goatools-0.6.10.tar.gz (md5) available from https://pypi.python.org/pypi/goatools was uploaded on 2016-10-06. There have been many updates since then. It would likely be helpful to create a new snapshot for PyPI.
Issue #61 was corrected May19, 2016, so this may not be it. But there have been significant updates to GOATOOLS since 2016-10-06.
from goatools.
@harryscholes , Can you try setting your PYTHONPATH such that your cloned copy of the goatools repo is near the beginning? It might look like this:
export PYTHONPATH=.:/Users/harry/git/goatools
And then re-run?:
python3 tests/test_go_print.py
from goatools.
Hi,
I just created a clean conda env to test all this:
What works:
- Cloning the git repo + adding the repo path to
$PYTHONPATH
conda create -n goatest python=3
source activate goatest
cd ~/git
git clone [email protected]:tanghaibao/goatools.git
export PYTHONPATH=.:/Users/harry/git/goatools
python goatools/tests/test_go_print.py
- pip installing the git repo
conda create -n goatest python=3
source activate goatest
pip install git+https://github.com/tanghaibao/goatools
python goatools/tests/test_go_print.py
What doesn't work:
- pip installing the PyPI version
conda create -n goatest python=3
source activate goatest
pip install goatools
python goatools/tests/test_go_print.py # produces same error as before
EXISTS: go-basic.obo
Python Version: 3.6.1 |Continuum Analytics, Inc.| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
OBOReader: <goatools.obo_parser.OBOReader object at 0x10ad029e8>
format-version: 1.2
data-version: releases/2017-06-14
Found 46825 GO Records:
Traceback (most recent call last):
File "tests/test_go_print.py", line 22, in <module>
test_go_print()
File "tests/test_go_print.py", line 19, in test_go_print
prt.write("{I:>7,} {RECORD}\n".format(I=idx, RECORD=go_rec))
File "/Users/harry/anaconda3/envs/goa/lib/python3.6/site-packages/goatools/obo_parser.py", line 260, in __str__
NAME=self.name, NS=self.namespace, OLD=obsolete)
TypeError: unsupported format string passed to NoneType.__format__
Looks like we're getting somewhere 👍
from goatools.
Thank you for trying all those options and reporting back.
We just released a new version for PyPI this week. The new version is goatools-0.7.9
Please let us know if this new version works for you when you get a chance. Thank you for your interest in GOATOOLS and taking the time to report this issue.
from goatools.
Latest PyPI and git GOATOOLS:
conda create -n goatest python=3
source activate goatest
pip install goatools
cd git
git clone [email protected]:tanghaibao/goatools.git
python goatools/tests/test_go_print.py
Traceback (most recent call last):
File "goatools/tests/test_go_print.py", line 34, in <module>
test_go_print()
File "goatools/tests/test_go_print.py", line 11, in test_go_print
prt_pypath(prt)
File "goatools/tests/test_go_print.py", line 25, in prt_pypath
pypathes = os.environ['PYTHONPATH']
File "/Users/harry/anaconda3/envs/goatest/lib/python3.6/os.py", line 669, in __getitem__
raise KeyError(key) from None
KeyError: 'PYTHONPATH'
NB this method does not create a $PYTHONPATH
. If I comment out line 11 in test_go_print.py
: # prt_pypath(prt)
then all works well.
from goatools.
Thank you for checking that out. I am so glad that it works for you. I've updated the test to fix the issue you mention in your last comment regarding PYTHONPATH.
Thank you for your interest in GOATOOLS and taking the time to report the issue.
I am closing this issue now. Please contact us if needed in the future.
from goatools.
Great! Keep up the good work with GOATOOLS 😄
from goatools.
Related Issues (20)
- Best practices for background gene sets HOT 3
- regarding obsolete terms
- Information content of a custom GO annotation. HOT 1
- What's the point of removing genes with identical identifiers?
- Optimising go term tests
- Issues with find.enrichment.py when I use the same IDs for study.txt and population.txt HOT 1
- Error in making result file HOT 3
- AttributeError In godag/gp_taks.py file HOT 3
- Potential bug: "WARNING: GO:0006379 NOT FOUND IN DAG" HOT 7
- Issue with goea_nbt3102.ipynb HOT 1
- HolmBonferroni correction generates error with certain p-value lists HOT 3
- Do anyone know the differences between the enriched results and the purifed results after the GOEA analysis of the GOATOOLS? HOT 2
- Text in GO term box - plotting
- goatools v1.3.11 seems cannot handle the header of GAF2.2
- Left to right plot in go_plot.py? HOT 1
- Question about map_to_slim
- Keeping terms not in DAG HOT 2
- [Question] How to parse .json, .obo, or .owl to get dictionary of enzymes {id_go:{ec_1, ec_2, ..., ec_n}} HOT 1
- Error: Unicode Decode Error HOT 2
- setuptools required HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goatools.