{{ message }}

Instantly share code, notes, and snippets.

# Nezar Abdennurnvictus

Last active Oct 1, 2020
Next-Reaction Method variant of the Gillespie stochastic simulation algorithm.
View gillespie_nrm.py
 from pqdict import pqdict from numpy import array, zeros, log, seterr from numpy.random import rand from collections import Counter from matplotlib import pyplot as plt seterr(divide="ignore") class Reaction(object):
Last active Aug 5, 2020
NumPy binary file parser for javascript
 // Client-side parser for .npy files // See the specification: http://docs.scipy.org/doc/numpy-dev/neps/npy-format.html var NumpyLoader = (function () { function asciiDecode(buf) { return String.fromCharCode.apply(null, new Uint8Array(buf)); } function readUint16LE(buffer) { var view = new DataView(buffer); var val = view.getUint8(0);
Last active Jun 16, 2020
motif PFM/PWM dataframe reader
 import numpy as np import pandas as pd def _probability_mat_to_information_mat(prob_df, bg_df): """ Converts a probability matrix to an information matrix. Taken from logomaker (https://github.com/jbkinney/logomaker). """
Last active Jun 13, 2020
preferred numbers
View preferred.py
 def geomprog(start, mul): """ Generate a geometric progression. Beginning with integer `start`, generate an unbounded geometric progression with ratio `mul`. """ start = int(start) yield start
Created Mar 16, 2020 — forked from GaelVaroquaux/mutual_info.py
Estimating entropy and mutual information with scikit-learn
View mutual_info.py
 ''' Non-parametric computation of entropy and mutual-information Adapted by G Varoquaux for code created by R Brette, itself from several papers (see in the code). These computations rely on nearest-neighbor statistics ''' import numpy as np
Last active Mar 12, 2020
NumPy run-length encoding / decoding
View runlength.py
 """Run Length Encoding utilities for NumPy arrays. Authors ------- - Nezar Abdennur - Anton Goloborodko """ from __future__ import division, print_function import numpy as np
Last active Jan 22, 2020 — forked from nokados/pandas_jupyter_paginator.py
Paginator for pandas.DataFrame in Jupyter Notebook
View pandas_jupyter_paginator.py
 """ Forked from: https://gist.github.com/nokados/e8f0a64b55099f2f07a50f2b090c91c7 Changes * Added slider control to scroll through pages of really large dataframes. * Reduce flicker by making events trigger widget element updates instead of clearing output and re-rendering. * Add support for dataframe CSS styling. * Register custom pandas accessor
Created Dec 24, 2019
A large palette of reasonably distinct colors
View godsnot.json
 [ "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5",
Last active Oct 25, 2019
coolR: a cooler reader for R
View cool.r
 # Notes # ----- # * Cooler's stored bin IDs are 0-based. However, for consistency with R, this API should take # 1-based indexing as input for table row and matrix range queries. # * See Ilya's implementation: https://github.com/dozmorovlab/HiCcompare/issues/9 library(hdf5r) library(dplyr) library(tibble) library(purrr) library(data.table)
Created Aug 7, 2016
Post mortem exception hook with ipdb
View post_mortem_hook.py
 def set_postmortem_hook(): import sys, traceback, ipdb def _excepthook(exc_type, value, tb): traceback.print_exception(exc_type, value, tb) print() ipdb.pm() sys.excepthook = _excepthook
You can’t perform that action at this time.