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

No module named cmap.io.gct #38

Closed liuguangdi closed 6 years ago

liuguangdi commented 6 years ago

I'm trying to read in a .gctx file in Python and write it as a .gct file. If I follow the instructions in the GitHub readme, I run the following codes:

!/usr/bin/env python

import sys import numpy as np import cmap.io.gct as gct def main(): infile = sys.argv[1] outfile = sys.argv[2]

gctobj = gct.GCT(infile)
gctobj.read()

data = gctobj.matrix[:, :].astype('float64')

np.save(outfile, data)

if name == 'main': main()

Then, I get the following error: No module named cmap.io.gct

oena commented 6 years ago

Hi @liuguangdi, sorry you're running into difficulties. The gctx2gct method is actually a command-line method; so, in your terminal (with your cmapPy conda environment activated) you should be able to just type `gctx2gct -filename , and it will write out a .gct with the same name (you can also change the outname; see our documentation for additional details.

If you'd like to do the same behavior within a script, you would simply call the parse method to read in your GCTX file to a GCToo instance, and then write_gct.write() on the GCToo instance to write it out to a .GCT file.

levlitichev commented 6 years ago

I also have no idea what Github readme you're referring to. cmap.io.gct has been deprecated for a long time. Could you post a URL so we can take down outdated instructions?

As @oena suggested, it sounds like the methods you're looking for are under cmapPy/pandasGEXpress.