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 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] |
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
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]): |
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
# 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 = [] |
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
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() |
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 python | |
import argparse | |
import pandas as pd | |
import json | |
import requests | |
default_gene_set_libraries = [ | |
'GO_Biological_Process_2015', |
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 python | |
import csv | |
import sys | |
# usage: | |
# samtools view -h file.bam | shift_reads.py genome | samtools view -S -b - | samtools sort - file.shifted | |
def getChrSizes(chrmFile): | |
""" | |
Reads tab-delimiter file with two rows describing the chromossomes and its lengths. |
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 enrichr(dataframe, gene_set_libraries=None, kind="genes"): | |
""" | |
Use Enrichr on a list of genes (currently only genes supported through the API). | |
""" | |
import json | |
import requests | |
import pandas | |
ENRICHR_ADD = 'http://amp.pharm.mssm.edu/Enrichr/addList' |
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
# I just need to have these somewhere to remember them later | |
for F in `find . | grep -e 'CM[0-9]\{2,\}s'` | |
do | |
echo $F $(echo $F | sed 's/CM\([0-9]\{2,\}\)s/CM\1-/g') | |
mv $F $(echo $F | sed 's/CM\([0-9]\{2,\}\)s/CM\1-/g') | |
done | |
for F in `find . | grep -e '_[1-2]_' | grep -v PBMC` | |
do |
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 pandas as pd | |
class DifferentialRegions(object): | |
""" | |
Compute two-tailed empirical p-value for difference between values of two variables. | |
""" | |
def __init__(self, df, a, b, permutations=100, alpha=0.05, correct=True): | |
super(DifferentialRegions, self).__init__() |