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
#!/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
#! /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
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
# 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 argparse import ArgumentParser | |
import sys | |
from pypiper import NGSTk | |
import textwrap | |
global tk | |
tk = NGSTk() | |
def sra2bam(sra_acession, output_bam): | |
# Slurm header |
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
class DivideAndSlurm(object): | |
""" | |
DivideAndSlurm is a class to handle a map-reduce style submission of jobs to a Slurm cluster. | |
Add a particula task to the object (though a specific function) and it will divide the input data | |
into pools, which will be submitted (use the submit() function) in parallel to the cluster. | |
Tasks can also further process its input in parallel, taking advantage of all processors. | |
""" | |
def __init__(self, tmpDir="/fhgfs/scratch/users/user/", logDir="/home/user/logs", queue="shortq", userMail=""): | |
super(DivideAndSlurm, self).__init__() |
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), |
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", |