Skip to content

Instantly share code, notes, and snippets.

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']
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):
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");
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!
matrix = {
values: [[1, 2], [3, 4]], // sorted row-wise by default
rows_iter: function () { return this.values },
columns_iter: function () { return iterator_over_the_transpose_of(this.values) },
flat_rows_iter: function () { return iterator_over_flattened(this.values) },
flat_columns_iter: function () { return iterator_over_the_flattened_transpose_of(this.values) },
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.