Skip to content

Instantly share code, notes, and snippets.

View DefaultDict.js
var DefaultDict = (initValue) => new Proxy({}, {
get: (target, name) => name in target ? target[name] :
(target[name] = (typeof initValue === 'function' ? initValue() : initValue))
});
statistics = DefaultDict(() => DefaultDict(() => DefaultDict(0)));
// Thanks @jonathanzong!
View GOrilla.js
var form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('action', 'http://cbl-gorilla.cs.technion.ac.il/servlet/GOrilla');
form.setAttribute('target', '_blank');
form.setAttribute('enctype', 'multipart/form-data');
var application_field = document.createElement('input');
application_field.setAttribute("type", "hidden");
application_field.setAttribute("name", "application");
application_field.setAttribute("value", "gorilla");
View pickle_functions.py
def save_as_pickled_object(obj, output_dir, filename):
"""
This is a defensive way to write pickle.write, allowing for very large files on all platforms
"""
filepath = os.path.join(output_dir, filename)
max_bytes = 2**31 - 1
bytes_out = pickle.dumps(obj)
n_bytes = sys.getsizeof(bytes_out)
with open(filepath, 'wb') as f_out:
for idx in range(0, n_bytes, max_bytes):
View analyze_gene_clusters_enrichr.py
import pdb
import pandas as pd
import os
import json
import requests
from argparse import ArgumentParser
ENRICHR_ADDLIST = 'http://amp.pharm.mssm.edu/Enrichr/addList'
ENRICHR_EXPORT = 'http://amp.pharm.mssm.edu/Enrichr/export'
DATABASES =['KEGG_2016', 'Reactome_2016', 'BioCarta_2016']