Giter Site home page Giter Site logo

Comments (19)

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

harryscholes avatar harryscholes commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

harryscholes avatar harryscholes commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

Okay thanks. Let me look into it...

from goatools.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

harryscholes avatar harryscholes commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

I am still working on it and will get back to you soon.

from goatools.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

@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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

@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.

harryscholes avatar harryscholes commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

harryscholes avatar harryscholes commented on August 20, 2024

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.

dvklopfenstein avatar dvklopfenstein commented on August 20, 2024

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.

harryscholes avatar harryscholes commented on August 20, 2024

Great! Keep up the good work with GOATOOLS 😄

from goatools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.