Giter VIP home page Giter VIP logo

spage2vec's Introduction

bioRxiv shield DOI

Spage2vec: Unsupervised representation of localized spatial gene expression signatures

This repository contains a collection of python notebooks for reproducing analyses and results from the original publication [1]. The notebooks folder contains code for:

  • Generate spatial gene expression network from in situ transcriptomic data and train an unsupervised graph representation model for producing a node embedding (spage2vec_*.ipynb)
  • Visualize and cluster the learned representations in subcelluar funcional domain (*_embedding.ipynb)

System requirement

The sorce code presented in this repository has been developed and tested on a Linux machine running Ubuntu 16.04 operating system with 64GB RAM, Intel(R) Core(TM) i7-5930K CPU @ 3.50GHz cpu, and nvidia TITAN X gpu.

Python Library Requirements

The following python packages are required for running the notebooks:

  • numpy==1.17.2
  • tensorflow==1.12.0
  • tensorboard==1.12.2
  • networkx==2.4
  • pandas==0.25.2
  • matplotlib==3.0.3
  • stellargraph==0.8.1
  • scipy==1.3.1
  • scikit-learn>=0.21.3
  • tqdm==4.36.1
  • umap-learn==0.3.10
  • scanpy==1.4.4
  • leidenalg==0.7.0
  • seaborn==0.9.0
  • h5py==2.10.0
  • loompy==3.0.6

Data Download

Spatial gene expression data for the analyzed assays can be downloaded at: https://doi.org/10.5281/zenodo.3897401. Please extract the content of the zipped archive in this repository local folder before running the notebooks.

Citation

[1] Partel, G., and Wählby C. Spage2vec: Unsupervised detection of spatial gene expression constellations. BioRxiv, https://doi.org/10.1101/2020.02.12.945345, (2019).

spage2vec's People

Contributors

gapartel avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

spage2vec's Issues

Error running Spage2Vec

Hello!

I ran the following command from the jupyter notebook on using spage2vec

assert len(layer_sizes) == len(num_samples)

graphsage = GraphSAGE(
    layer_sizes=layer_sizes, generator=train_gen, aggregator=AttentionalAggregator, bias=True, dropout=0.0, normalize="l2", kernel_regularizer='l1'
) 

and got the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-41-f1ae536eeb07> in <module>()
      4 
      5 graphsage = GraphSAGE(
----> 6     layer_sizes=layer_sizes, generator=train_gen, aggregator=AttentionalAggregator, bias=True, dropout=0.0, normalize="l2", kernel_regularizer='l1'
      7 )

/u/home/r/rlittman/project-rlittman/miniconda3/envs/spage2vec/lib/python3.7/site-packages/stellargraph/layer/graphsage.py in __init__(self, layer_sizes, generator, aggregator, bias, dropout, normalize, activations, **kwargs)
    814         # Get the input_dim and num_samples
    815         if generator is not None:
--> 816             self._get_sizes_from_generator(generator)
    817         else:
    818             self._get_sizes_from_keywords(kwargs)

/u/home/r/rlittman/project-rlittman/miniconda3/envs/spage2vec/lib/python3.7/site-packages/stellargraph/layer/graphsage.py in _get_sizes_from_generator(self, generator)
    867                     + errmsg
    868                 )
--> 869             raise TypeError(errmsg)
    870 
    871         self.n_samples = generator.num_samples

TypeError: Generator should be an instance of GraphSAGENodeGenerator or GraphSAGELinkGenerator
```

A problem of GraphSAGE

Hello author:
When i run:
unsupervised_samples = UnsupervisedSampler(G, nodes=nodes, length=length, number_of_walks=number_of_walks, seed=42)
graphsage = GraphSAGE(layer_sizes=layer_sizes, generator=train_gen, aggregator=AttentionalAggregator, bias=True,
dropout=0.0, normalize="l2", kernel_regularizer='l1')"
layer_sizes = [50, 50]
assert len(layer_sizes) == len(num_samples)
the error is occurring.
The error is "TypeError: Generator should be an instance of GraphSAGENodeGenerator or GraphSAGELinkGenerator"
Please,how to resolve it?

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.