Skip to content

Instantly share code, notes, and snippets.

Avatar

Nezar Abdennur nvictus

View GitHub Profile
@nvictus
nvictus / cooler-from-sparse-text.ipynb
Last active Apr 7, 2017
cooler-from-sparse-text.ipynb
View cooler-from-sparse-text.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nvictus
nvictus / doi2bib
Last active Apr 3, 2017
Fetch reference citations in BibTeX, JSON or YAML from DOI
View doi2bib
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import tempfile
import requests
import argparse
import textwrap
import sys
View higlass-in-jupyter.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nvictus
nvictus / expected.py
Last active Feb 27, 2017
cooler_expected_new.ipynb
View expected.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
from multiprocess import Pool
from functools import partial
from itertools import chain
import itertools
import argparse
import sys
View tilt_matrix_diag_utils.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nvictus
nvictus / discreternd.py
Last active Sep 5, 2016
Sample a discrete distribution (i.e. simulate a loaded die) efficiently via the "alias sampling" method
View discreternd.py
"""
Alias sampler
=============
See : <http://www.keithschwarz.com/darts-dice-coins/> by Keith Schwarz.
References
----------
+ Vose, Michael D.
@nvictus
nvictus / ucsc.py
Created Aug 26, 2016
UCSC fetcher
View ucsc.py
# -*- coding: utf-8 -*-
"""
Request snapshots from the UCSC Genome Browser.
"""
from __future__ import division, print_function, unicode_literals
from collections import OrderedDict
import sys
import re
@nvictus
nvictus / loadnpy.js
Last active Aug 5, 2020
NumPy binary file parser for javascript
View loadnpy.js
// 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);
@nvictus
nvictus / post_mortem_hook.py
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
@nvictus
nvictus / runlength.py
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
You can’t perform that action at this time.