Skip to content

Instantly share code, notes, and snippets.

Avatar

André F. Rendeiro afrendeiro

View GitHub Profile
@afrendeiro
afrendeiro / figure_convert_NPG2CellPress.sh
Last active Dec 12, 2018
Convert SVG figures from Nature Publishing Group to CellPress style, generate high quality raster and aggregated pdfs
View figure_convert_NPG2CellPress.sh
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
@afrendeiro
afrendeiro / figure_convert_CellPress2NPG.sh
Last active Dec 12, 2018
Convert SVG figures from CellPress style to Nature Publishing Group style, generate high quality raster and aggregated pdfs
View figure_convert_CellPress2NPG.sh
# 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
@afrendeiro
afrendeiro / process_csv.py
Last active Mar 26, 2018
Parse raw data out of CSV files exported from a Thrombin Generation Assay (TGA)
View process_csv.py
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."
)
@afrendeiro
afrendeiro / ensembl_reg_build.py
Created Dec 28, 2017
Get Ensembl regulatory build annotations into bed format
View ensembl_reg_build.py
import os
import pandas as pd
# Human
# hg38
ensembl_release = 91
date = "20161111"
organisms = {
"homo_sapiens": "GRCh38",
@afrendeiro
afrendeiro / rasterized_svg.py
Last active May 28, 2017
Mixing vector and rasterized elements in svg produced with matplotlib
View rasterized_svg.py
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),
@afrendeiro
afrendeiro / series_matrix2csv.py
Created May 26, 2017
GEO Series matrix to project and sample annotations
View series_matrix2csv.py
def series_matrix2csv(matrix_url, prefix=None):
"""
matrix_url: gziped URL with GEO series matrix.
"""
import gzip
import pandas as pd
os.system("wget {}".format(matrix_url))
filename = matrix_url.split("/")[-1]
@afrendeiro
afrendeiro / make_tracks.py
Last active Mar 2, 2017
Make a UCSC trackHub from a looper.Project
View make_tracks.py
from looper.models import Project
import argparse
import os
import pandas as pd
import re
import string
import textwrap
def get_colors(level, pallete="gist_rainbow", nan_color=[0.5, 0.5, 0.5]):
@afrendeiro
afrendeiro / merry_xmas.py
Created Dec 23, 2016
Merry Xmas by Jörg Mensche
View merry_xmas.py
# By Jörg Mensche
import matplotlib.pyplot as plt # basic plot functionalities
import seaborn as sns
# more advanced plotting
import scipy.stats as sc
# random number generator
# generate the x-mas tree:
all_branches = []
balls_x = []
View quantile_tracks.py
from pipelines.models import Project
import os
import pandas as pd
import pysam
# Start project
prj = Project("metadata/project_config.yaml")
prj.add_sample_sheet()
@afrendeiro
afrendeiro / enrichr.py
Created Aug 9, 2016
Use Enrichr's API to get enrichments of a gene set
View enrichr.py
#! /usr/bin/env python
import argparse
import pandas as pd
import json
import requests
default_gene_set_libraries = [
'GO_Biological_Process_2015',