This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scanpy.api as sc | |
import numpy as np | |
def add_tracker(field_name="tracker"): | |
from inspect import getcallargs | |
from functools import wraps | |
def tracker(f): | |
@wraps(f) | |
def wrapper(*args, **kwds): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sklearn.preprocessing import StandardScaler | |
# get list of genes of interest (e.g. from diff exp, or a known signature) | |
diff = pd.Index(['geneX', 'geneY']) | |
# X is our numeric matrix, shape (n_features, n_samples) | |
X = pd.DataFrame(index=['geneA', 'geneZ'], columns=['stimul_1', 'stimul_2'] + ['unstimul_1', 'unstimul_2']) | |
# Standardize and center |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>chr1 | |
ATGCATGCATGCATGCATGCATGCATGCATGCATGCATGC | |
ATGCATGCATGCATGCATGCATGCATGCATGCATGCATGC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_differential_enrichment( | |
enrichment_table, | |
enrichment_type, | |
data_type="ATAC-seq", | |
direction_dependent=True, | |
output_dir="results/differential_analysis_{data_type}/enrichments", | |
comp_variable="comparison_name", | |
output_prefix="differential_analysis", | |
rasterized=True, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Dependencies: | |
# 1. inkscape | |
# 2. pdfunite | |
# 3. (optinal) minify (https://github.com/tdewolff/minify/tree/master/cmd/minify) | |
# `sudo apt install minify` | |
# Assumptions: | |
# 1. figures are made in SVG format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CURRENT_DATE=20181212 | |
NUMBER_MAIN_FIGURES=5 | |
NUMBER_SUPP_FIGURES=11 | |
ROOT_DIR=/home/path/to/paper/figures | |
cd $ROOT_DIR | |
mkdir -p cropped_unlabeled_pngs | |
# Cell Press format convertion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change this | |
CURRENT_DATE=20181212 | |
NUMBER_MAIN_FIGURES=5 | |
NUMBER_SUPP_FIGURES=11 | |
ROOT_DIR=/home/path/to/paper/figures | |
# Don't change this | |
cd $ROOT_DIR | |
mkdir -p cropped_unlabeled_pngs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pandas as pd | |
from argparse import ArgumentParser | |
# Parse command-line arguments | |
parser = ArgumentParser( | |
prog="CSV parser", | |
description="Gets some column out of CSVs." | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pandas as pd | |
# Human | |
# hg38 | |
ensembl_release = 91 | |
date = "20161111" | |
organisms = { | |
"homo_sapiens": "GRCh38", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set_style("white") | |
fig, axis = plt.subplots(1) | |
# all genes | |
axis.scatter( | |
np.arange(0, 8, 8./10000) + np.random.normal(0, 0.1, size=10000), |