Giter Site home page Giter Site logo

camaralab / sctda Goto Github PK

View Code? Open in Web Editor NEW
49.0 8.0 21.0 3.55 MB

An object oriented python library for topological data analysis of high-throughput single-cell RNA-seq data

License: GNU General Public License v3.0

Python 100.00%
single-cell-rna-seq topological-data-analysis

sctda's Introduction

scTDA

scTDA is an object oriented python library for topological data analysis of high-throughput single-cell RNA-seq data. It includes tools for the preprocessing, analysis, and exploration of single-cell RNA-seq data based on topological representations.

Installation

To install scTDA run:

pip install scTDA

Alternatively, to install the most updated version you can download the source code and run:

python setup.py install

For optimal visualization results it is strongly recommended to have Graphviz tools and PyGraphviz installed.

Docker

A Docker container with a fully configured jupyter notebook environment and scTDA can be obtained running:

docker pull pcamara/sctda

To start the image use:

docker run -it -v /path/to/your/working/directory:/home/jovyan/work --rm -p 8888:8888 pcamara/sctda

where /path/to/your/working/directory is the folder containing the data you want to analyze. In some systems it may be required replacing /home/jovyan/work with //home/jovyan/work in the above command.

Using scTDA

scTDA can be imported using the command:

import scTDA

A tutorial illustrating the basic scTDA workflow can be found in doc/scTDA Tutorial.html. The source notebook and data files for the tutorial can be downloaded here. For optimal visualization when working with notebooks, we recommend using %matplotlib notebook.

More details on the scTDA algorithm can be found in:

Rizvi, A. H.*, Camara, P. G.*, Kandror, E. K., Roberts, T. J., Scheiren, I., Maniatis, T., and Rabadan, R., "Single-Cell Topological RNA-Seq Analysis Reveals Insights Into Cellular Differentiation and Development", Nat. Biotechnol. (2017) 35: 551-560. [* These authors contributed equally to this work.]

sctda's People

Contributors

doerlbh avatar fbrundu avatar pcamara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sctda's Issues

Unable to draw more than one gene in the same plot

Hi,
I receive the following error while trying to draw a list of genes, probably due to changes in the underlying matplotlib API:

c.draw(['GRIA1', 'SLC1A3']);

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-36-4449e82bda2b> in <module>()
----> 1 c.draw(['GRIA1','SLC1A3']);

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/scTDA/main.pyc in draw(self, color, connected, labels, ccmap, weight, save, ignore_log, table, axis, a)
   1230             values = [(1.0-colorb[node]/bmax, max(1.0-(colorr[node]/rmax+colorb[node]/bmax), 0.0),
   1231                        1.0-colorr[node]/rmax) for node in pg.nodes()]
-> 1232             networkx.draw_networkx_nodes(pg, pos, node_color=values, node_size=sizes)
   1233             polca = [(colorr[node], colorb[node]) for node in pg.nodes()]
   1234         elif type(color) == list and len(color) == 3:

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/networkx/drawing/nx_pylab.pyc in draw_networkx_nodes(G, pos, nodelist, node_size, node_color, node_shape, alpha, cmap, vmin, vmax, ax, linewidths, edgecolors, label, **kwds)
    412                                  linewidths=linewidths,
    413                                  edgecolors=edgecolors,
--> 414                                  label=label)
    415 
    416     node_collection.set_zorder(2)

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
   1853                         "the Matplotlib list!)" % (label_namer, func.__name__),
   1854                         RuntimeWarning, stacklevel=2)
-> 1855             return func(ax, *args, **kwargs)
   1856 
   1857         inner.__doc__ = _add_data_doc(inner.__doc__,

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
   4277                 raise ValueError("c of shape {} not acceptable as a color "
   4278                                  "sequence for x with size {}, y with size {}"
-> 4279                                  .format(c.shape, x.size, y.size))
   4280         else:
   4281             colors = None  # use cmap, norm after collection is created

AttributeError: 'list' object has no attribute 'shape'

c is an UnrootedGraph initialized through Ayasdi.

Versions

scTDA==0.97
matplotlib==2.2.2
networkx==2.1


Francesco

Planned enhancements

Some planned enhancements in scTDA (in random order):

  • Compatibility with Python 3 (through six)
  • Improve performance of connectivity_pvalue (through parallelization)
  • Implement gene ontologies
  • Implement relative subsampling
  • Implement histogram of edge contributions to gene connectivity
  • Improve open-source Mapper implementation (through better lens implementation)
  • Force usage of graphviz layouts
  • PEP8

How should I proceed to rootGraph without a Ayasdi account

After playing with the tutorial, I tried to run the whole thing with my own data. But I got stuck at the rootgraph. Since I don't have a Ayasdi account, I cannot generate those Embryo_mds.gexf and .json files, which are used in rooted graph.
Then I tried to just use Embryo_pcaa_25_0.40.gexf and .json file generated previously by calling TopologicalRepresentation.save() as input for rootgraph. Then I got this error and I don't know what to do next. Could you help me out here?
Traceback (most recent call last): File "/Users/dingqituo/untitled3/scTDA Tutorial/embryo.py", line 4, in <module> c = scTDA.RootedGraph('Embryo_pca_25_0.40', 'Embryo.no_subsampling.tsv', groups=False) File "/Users/dingqituo/untitled3/scTDA Tutorial/scTDA.py", line 1539, in __init__ self.g3, self.dicdend = self.dendritic_graph() File "/Users/dingqituo/untitled3/scTDA Tutorial/scTDA.py", line 1511, in dendritic_graph dil = networkx.shortest_path_length(self.gl, self.root, k) File "/Users/dingqituo/anaconda/envs/python2/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/generic.py", line 245, in shortest_path_length p=nx.bidirectional_shortest_path(G,source,target) File "/Users/dingqituo/anaconda/envs/python2/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/unweighted.py", line 136, in bidirectional_shortest_path results=_bidirectional_pred_succ(G,source,target) File "/Users/dingqituo/anaconda/envs/python2/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/unweighted.py", line 186, in _bidirectional_pred_succ for w in Gsucc(v): File "/Users/dingqituo/anaconda/envs/python2/lib/python2.7/site-packages/networkx/classes/graph.py", line 1084, in neighbors_iter raise NetworkXError("The node %s is not in the graph." % (n,)) networkx.exception.NetworkXError: The node 0 is not in the graph.

Data input

Hi pcamara,
I am new to bioinformatics, I came across your nature biotech paper and found the scTDA seemed to be very useful for single-cell analysis, at least the topological stuff makes more sense than current packages. Just wonder, if all I have is a gene expression matrix in which rows correspond to genes and columns correspond to cells, with first row of cell ids and first column for gene ids. How can I input the matrix to scTDA pre-process function?

Best!
Gary

scTDA implementation with our own data

Hi @pcamara , I read your paper and you did an amazing tool, and now we want to use it in the lab.
We tried to use our own data following the previous comments in the 'Data Input' issue, and the network looks like we expected but we're having some issues, since we are not seeing the patterns we were expecting (when coloring by regulon or by timepoints).
When using your data everything works well but we wonder why is it that ours doesn't work, as far as we are aware of, our name.all.tsv has the same format as the one in the tutorial.
Any idea of what can we be doing wrong?
I can provide more details about the issue.
Thanks!

scTDA tutorial link not working

Hi Pablo,

Congrats on the publication of your nice work on scTDA. I am interested in analyze some of my data with it. When I look through your tutorial, I found, however, the link to the source notebook and data files is no longer existed. Could you please update it?

Also, does your software has to have a Ayasdi account? Do you have a tutorial to run your motor neuron data with the free available mapper?

Thanks

scTDA.RootedGraph With groups=FALSE not working

Dear Pablo,
Hope you are doing fine. I am trying to run scTDA on one of our datasets and I am facing this error:
total of 616 patches required clustering
this implies 1693 nodes in the mapper graph
Traceback (most recent call last):
File "scTDA_Tutorial.py", line 161, in
c = scTDA.RootedGraph('Embryo_pca_25_0.40', 'Embryo.no_subsampling.tsv', groups=False)
File "/Users/pra7mx/anaconda/lib/python2.7/site-packages/scTDA/main.py", line 1531, in init
self.g3, self.dicdend = self.dendritic_graph()
File "/Users/pra7mx/anaconda/lib/python2.7/site-packages/scTDA/main.py", line 1503, in dendritic_graph
dil = networkx.shortest_path_length(self.gl, self.root, k)
File "/Users/pra7mx/anaconda/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/generic.py", line 245, in shortest_path_length
p=nx.bidirectional_shortest_path(G,source,target)
File "/Users/pra7mx/anaconda/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/unweighted.py", line 136, in bidirectional_shortest_path
results=_bidirectional_pred_succ(G,source,target)
File "/Users/pra7mx/anaconda/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/unweighted.py", line 186, in _bidirectional_pred_succ
for w in Gsucc(v):
File "/Users/pra7mx/anaconda/lib/python2.7/site-packages/networkx/classes/graph.py", line 1084, in neighbors_iter
raise NetworkXError("The node %s is not in the graph." % (n,))
networkx.exception.NetworkXError: The node 0 is not in the graph.

Can you please help me with this.

Thanks,

Cheers !!

Praneet

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.