cmap / cmapPy

Assorted tools for interacting with .gct, .gctx files and other Connectivity Map (Broad Institute) data/tools
https://clue.io/cmapPy/index.html
BSD 3-Clause "New" or "Revised" License
126 stars 76 forks source link

Exception while parsing gct files #43

Closed Naghipourfar closed 6 years ago

Naghipourfar commented 6 years ago

Hi, I wanted to parse a sample gct file but there is a bug in the source code which causes an exception while parsing the file. The function read_version_and_dims() in parse_gct.py, there is a problem in its implementation. It opens the file in binary mode, so the version = f.readline().strip().lstrip("#") will make error. I reckon that if you open the file in non-binary mode, it will be solved. The exception is : TypeError: a bytes-like object is required, not 'str' when writing to a file

oena commented 6 years ago

Hi @Naghipourfar, thanks for getting in touch about your issue. So that I can best help you, can you please provide information on:

Naghipourfar commented 6 years ago

I'm using python 3.6, conda 4.5.0. The data is from here (read count).

oena commented 6 years ago

Aha; cmapPy doesn't have Python 3 compatibility yet, so I'm pretty sure that's actually what's causing your issue. I'd install Python 2.7.11 in your conda environment, that should fix your issue. Additional information on the recommended conda environment can be found here.

Naghipourfar commented 6 years ago

Yes, that is the problem. Thanks for your help. I was wondering about the time that cmapPy will be compatible with Python 3. Is it soon?

oena commented 6 years ago

No problem! Glad that fixed it.

And I'd like for Python 3 compatibility to be added soon but unfortunately can't give you a specific timeline at the moment. You're welcome to contribute though :)