Skip to content

Instantly share code, notes, and snippets.

View nvictus's full-sized avatar

Nezar Abdennur nvictus

  • UMass Chan Medical School
  • Greater Boston Area
View GitHub Profile
@nvictus
nvictus / load-dense-contact-matrix.ipynb
Last active July 16, 2017 19:16
load dense contact matrix
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nvictus
nvictus / .inputrc
Last active May 1, 2018 17:18
linux inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@nvictus
nvictus / cool.r
Last active August 27, 2021 15:59
coolR: a cooler reader for 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)
@nvictus
nvictus / pandas_jupyter_paginator.py
Last active January 22, 2020 11:13 — forked from nokados/pandas_jupyter_paginator.py
Paginator for pandas.DataFrame in Jupyter Notebook
"""
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
@nvictus
nvictus / godsnot.json
Created December 24, 2019 21:19
A large palette of reasonably distinct colors
[
"#000000",
"#FFFF00",
"#1CE6FF",
"#FF34FF",
"#FF4A46",
"#008941",
"#006FA6",
"#A30059",
"#FFDBE5",
@nvictus
nvictus / mutual_info.py
Created March 16, 2020 16:24 — forked from GaelVaroquaux/mutual_info.py
Estimating entropy and mutual information with scikit-learn
'''
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
@nvictus
nvictus / preferred.py
Last active June 13, 2020 21:41
preferred numbers
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
@nvictus
nvictus / read_motifs.py
Last active June 16, 2020 22:10
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).
"""
@nvictus
nvictus / ena_download.py
Last active February 6, 2024 16:31
Dump fastq-dump! Download NCBI-SRA FASTQs directly from the European Nucleotide Archive.
#!/usr/bin/env python
import hashlib
import os.path as op
import os
import re
import warnings
from contextlib import closing
from urllib.parse import urlsplit
from urllib.request import urlopen
@nvictus
nvictus / keybase.md
Created March 30, 2021 13:54
keybase.md

Keybase proof

I hereby claim:

  • I am nvictus on github.
  • I am nvictus (https://keybase.io/nvictus) on keybase.
  • I have a public key ASD5ZCiGIU56jaoWB80la1wXlnkF_bnTkhPPU21ajb-5eQo

To claim this, I am signing this object: