Skip to content

Instantly share code, notes, and snippets.

View vals's full-sized avatar

Valentine Svensson vals

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vals
vals / measles.ipynb
Created April 13, 2015 14:57
Time series plot for measles incidence
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vals
vals / gist:fa2aa17c1fc349598527
Created March 24, 2015 09:19
Reproducing Cicular Coordinates
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
@vals
vals / Clusters from dendrograms.ipynb
Created June 28, 2014 23:37
IPython notebook illustrating how to extract cluster elements in Python Dendrograms
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vals
vals / stacked by factor.ipynb
Last active August 29, 2015 14:02
Stacked by factor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vals
vals / estimate_size_factors.py
Last active August 29, 2015 13:57
NumPy implementation of estimateSizeFactorsForMatrix from DESeq
def estimate_size_factor(counts):
#COUNTS = GENES (rows) x CELLS (columns)
genes = counts[:, 0]
#ONLY COUNTS WITHOUT HEADER NOR GENES
counts = numpy.array(counts[1:, 1:], dtype = int)
#DONT REMOVE INFITE VALUES AS IT CAUSES PROBLEMS
log_counts = numpy.log(counts)
# Copyright: Luis Pedro Coelho <luis@luispedro.org>, 2012
# License: MIT
import numpy as np
def read_roi(fileobj):
"""
points = read_roi(fileobj)
Read ImageJ's ROI format
@vals
vals / dev_null.ipynb
Created April 3, 2013 11:21
Escape from /dev/null IPython Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vals
vals / number1.py
Created March 27, 2013 19:08
Making nicer looking pie charts with matplotlib
from random import shuffle
slices = [1,2,3] * 4 + [20, 25, 30] * 2
shuffle(slices)
fig = plt.figure(figsize=[10, 10])
ax = fig.add_subplot(111)
cmap = plt.cm.prism
colors = cmap(np.linspace(0., 1., len(slices)))
{
"metadata": {
"name": "Lab 1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{