https://github.com/brianhie/geosketch

Geometry-preserving random sampling

https://github.com/brianhie/geosketch

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    3 of 4 committers (75.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Geometry-preserving random sampling

Basic Info
Statistics
  • Stars: 87
  • Watchers: 3
  • Forks: 11
  • Open Issues: 0
  • Releases: 0
Created over 7 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.md

Geometric sketching

Overview

geosketch is a Python package that implements the geometric sketching algorithm described by Brian Hie, Hyunghoon Cho, Benjamin DeMeo, Bryan Bryson, and Bonnie Berger in "Geometric sketching compactly summarizes the single-cell transcriptomic landscape", Cell Systems (2019). This repository contains an example implementation of the algorithm as well as scripts necessary for reproducing the experiments in the paper.

Installation

You should be able to install from PyPI: pip install geosketch

API example usage

Parameter documentation for the geometric sketching gs() function is in the source code at the top of geosketch/sketch.py.

For an example of usage of geosketch in R using the reticulate library, see example.R. WARNING: The indices returned by geosketch are 0-indexed, but R uses 1-indexing, so the one_indexed parameter should be set to TRUE when called from R.

Here is example usage of geosketch in Python. First, put your data set into a matrix: X = [ sparse or dense matrix, samples in rows, features in columns ]

Then, compute the top PCs: ```Python

Compute PCs.

from fbpca import pca U, s, Vt = pca(X, k=100) # E.g., 100 PCs. X_dimred = U[:, :100] * s[:100] ```

Now, you are ready to sketch! ```Python

Sketch.

from geosketch import gs N = 20000 # Number of samples to obtain from the data set. sketchindex = gs(Xdimred, N, replace=False)

Xsketch = Xdimred[sketch_index] ```

Examples

Data set download

All of the data used in our study can be downloaded from http://cb.csail.mit.edu/cb/geosketch/data.tar.gz. Download and unpack this data with the command:

wget http://cb.csail.mit.edu/cb/geosketch/data.tar.gz tar xvf data.tar.gz

Visualizing sketches of a mouse brain data set

We can visualize a large data set of cells from different regions of the mouse brain collected by Saunders et al. (2018).

To visualize the sketches obtained by geometric sketching and other baseline algorithms, download the data using the commands above and then run: python bin/mouse_brain_visualize.py This will output PNG files to the top level directory visualizing different sketches produced by different algorithms, including geometric sketching.

Algorithm implementation

For those interested, the algorithm implementation is available in the file geosketch/sketch.py.

Questions

For questions, please use the GitHub Discussions forum. For bugs or other problems, please file an issue.

Owner

  • Name: Brian Hie
  • Login: brianhie
  • Kind: user
  • Location: San Francisco

GitHub Events

Total
  • Issues event: 3
  • Watch event: 12
  • Issue comment event: 1
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 1
Last Year
  • Issues event: 3
  • Watch event: 12
  • Issue comment event: 1
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 1

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 102
  • Total Committers: 4
  • Avg Commits per committer: 25.5
  • Development Distribution Score (DDS): 0.147
Top Committers
Name Email Commits
Brian Hie b****e@m****u 87
brianhie b****1@g****m 11
prete m****e@s****k 3
Hoon Cho h****o@m****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 12
  • Total pull requests: 4
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 9
  • Total pull request authors: 4
  • Average comments per issue: 1.75
  • Average comments per pull request: 0.25
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 1
  • Average time to close issues: 23 days
  • Average time to close pull requests: about 1 hour
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • wsnoble (3)
  • dburkhardt (2)
  • gdagstn (1)
  • IMJoeyZhu (1)
  • danieled-csail (1)
  • adamov-artem (1)
  • jcyang34 (1)
  • alexandregrimaldi (1)
  • esehovic (1)
Pull Request Authors
  • anaischossegros (2)
  • brianhie (1)
  • prete (1)
  • hhcho (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 7,485 last-month
  • Total docker downloads: 4,360
  • Total dependent packages: 5
    (may contain duplicates)
  • Total dependent repositories: 19
    (may contain duplicates)
  • Total versions: 8
  • Total maintainers: 1
pypi.org: geosketch

Geometry-preserving random sampling

  • Versions: 7
  • Dependent Packages: 5
  • Dependent Repositories: 19
  • Downloads: 7,485 Last month
  • Docker Downloads: 4,360
Rankings
Docker downloads count: 2.2%
Dependent packages count: 2.3%
Dependent repos count: 3.3%
Downloads: 4.7%
Average: 5.3%
Stargazers count: 8.5%
Forks count: 10.9%
Maintainers (1)
Last synced: 12 months ago
proxy.golang.org: github.com/brianhie/geosketch
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 11 months ago

Dependencies

setup.py pypi
  • fbpca >=1.0
  • numpy >=1.12.0
  • scikit-learn >=0.24