Skip to content

Instantly share code, notes, and snippets.

@gpratt
gpratt / gist:6692981
Created September 24, 2013 23:50
rainbow colors
def calculate_on_target(barcodes, barcode_map, expected):
figsize(4,4)
total = 0
on_target = 0
off_target = 0
no_target = 0
expected_counts = []
off_target_counts = []
expected_names = []
@gpratt
gpratt / example.py
Created December 14, 2013 22:18
groupyby example
from itertools import groupby
lst = ['DEAA IP',
'DEAA Input',
'FLAG IP',
'FLAG Input',
'K498A IP',
'K498A Input',
'Wild Type IP',
'Wild Type Input']
foo
@gpratt
gpratt / gist:9817624
Created March 27, 2014 20:20
public_clip_list_access
cisbp_db = pd.read_csv("/nas3/gpratt/projects/cisbp/analysis/RBP_Information.txt", sep="\t")
public_clip_list = pd.read_csv("/nas3/gpratt/projects/public_clip/v1/public_clip_list.csv", index_col=0)
public_clip_list= public_clip_list[public_clip_list['CLIP-seq?'] == "Yes"]
public_clip_list['ensembl'] = public_clip_list.Ensemblid.astype(str).apply(lambda x: x.split(".")[0])
@gpratt
gpratt / gist:9817854
Last active August 29, 2015 13:57
cluster_loading.py
analysis_dir = "/nas3/gpratt/projects/public_clip/analysis/v5"
experiment_mapping = {
"peaks" : "clipper",
"ripseeker" : "ripseeker",
"pyicoclip" : "pyicoclip",
"piranha" : "piranha",
"bed_notrim_ingenes_clusters_hg1950" : "kasey",
"bed_notrim_ingenes_clusters_mm950" : "kasey",
}
@gpratt
gpratt / barcode_collapse.py
Created April 8, 2014 17:25
iclip analysis tools
""""
barcode_collapse.py read in a .bam file where the
first 9 nt of the read name
are the barcode and merge reads mapped to the same position that have the same barcode
"""
from collections import Counter, OrderedDict
@gpratt
gpratt / rbpdb.py
Created April 29, 2014 18:51
rbpdb access
cisbp_db = pd.read_csv("/nas3/gpratt/projects/cisbp/analysis/RBP_Information.txt", sep="\t")
pwm_locations = "/nas3/gpratt/projects/cisbp/analysis/pwm_locations/"
#where %s is the motif id found in cisbp_db
motif_ids = "%s.txt/fimo_reformated.txt"
@gpratt
gpratt / rpkm_table_maker.py
Last active August 29, 2015 14:02
makes an rpkm table in python
import glob
import pandas as pd
datasets = glob.glob("/nas/nas0/gpratt/projects/upf1/analysis/v3/*.RPKM")
datasets = {os.path.basename(dataset).split(".")[0] : pd.read_csv(dataset, index_col=0, sep="\t").RPKM for dataset in datasets}
clipseq_rpkm_df = pd.concat(datasets, join="outer")
clip_count_df.unstack()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gpratt
gpratt / plot_denovo_motifs.py
Last active August 29, 2015 14:08
plot_denovo_motifs
from clipper.src import CLIP_analysis
import os
viz = CLIP_analysis_display.ClipVisualization()
def plot_denovo_motifs(bedtool, fig=None):
root = "/Users/gpratt/bioinformatics/yeolab/iPython_Notebook/fox2/"
out_dir = os.path.join(root, "assigned/")
fasta_dir = os.path.join(root, "fasta/")
cluster_name = os.path.basename(bedtool.fn)