Skip to content

Instantly share code, notes, and snippets.

View rgranit's full-sized avatar
🤓
Crunching the numbers

Roy Granit, PhD rgranit

🤓
Crunching the numbers
View GitHub Profile
@rgranit
rgranit / create_AnnData.py
Last active November 7, 2022 11:54
Generate AnnData fro DF or H5AD
"""
Generate AnnData fro DF or H5AD
"""
import scanpy as sc
import anndata
ad=anndata.AnnData(X=input.X, obs=input.obs, var=input.var)
ad.var_names_make_unique()
ad
@rgranit
rgranit / jupyter_notebook_gist.py
Last active December 9, 2021 08:29
Handy Jupyter notebook gists
"""
Selection of useful jupyter notebook commands
"""
# control plot size
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = [10, 5]
# autoreload code dependencies with each run
%load_ext autoreload
@rgranit
rgranit / hypergeometric.py
Last active April 23, 2020 19:42
Hypergeometric test for gene list overlap in python
"""
The aim of this script is to test the significance of gene list overlap
"""
# load packages
import scipy.stats as stats
from decimal import Decimal as D
def overlap_sets(setA, setB):