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
124 stars 74 forks source link

Parsing GCT files fails in python3 #53

Closed saksham219 closed 5 years ago

saksham219 commented 5 years ago

I don't know if the code has been made python3 compatible or not. I am providing the example for regenerating this issue in python3. Link to input file gct file

from cmapPy.pandasGEXpress.parse import parse parse("gct_file_path")

line 168, in read_version_and_dims version = f.readline().strip().lstrip("#") TypeError: a bytes-like object is required, not 'str'

The problem is due to the fact that my GCT file uses bytes string encoding therefore while reading I will have to lstrip(b'#') while apply it on a bytes object. I can fix this perhaps and make the parsing compatible to both byte('bytes' type in python3) and unicode('str' type in python3) strings.

oena commented 5 years ago

Hi @saksham219, the package has not been made Python 3 compatible yet; we still recommend using Python 2.7 as described in the documentation. If you'd like to contribute and add that compatibility though, you're more than welcome to!