Skip to content

Instantly share code, notes, and snippets.

{
"metadata": {
"name": "",
"signature": "sha256:4632c48d2d93ec86103808ed599b94a33dfdda25ab937192359f68ab92ee1ec0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@pmagwene
pmagwene / Accent.py
Created December 6, 2012 05:42 — forked from endolith/Accent.py
Documenting the matplotlib colormaps
# https://github.com/matplotlib/matplotlib/issues/881
# Several of the ColorBrewer maps are "qualitative", meaning
# they are just a group of colors that can be used together
# for categories of data. So I remapped Accent to segments
# instead of continuous:
# Actually, these should be used with ListedColormap, and
# the number of colors should depend on the number of
# categories in the data, with colors removed from the
# list in a certain order?
@pmagwene
pmagwene / gist:2220955
Created March 27, 2012 22:21
samtools mpileup example
samtools mpileup -uf ../../yeast-genome-Feb2011/yeast-genome-Feb2011.fasta aln.sorted.bam | bcftools view -bvcg - > var.raw.bcf
bcftools view var.raw.bcf | vcfutils.pl varFilter -D400 > var.flt.vcf
@pmagwene
pmagwene / gist:2212148
Created March 27, 2012 03:09
Lato based preamble for LaTeXit
\documentclass[10pt]{article}
\usepackage[usenames]{color} %used for font color
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths\documentclass[10pt,letterpaper]{article}
%\usepackage[usenames]{color} %used for font color
\usepackage[HTML,dvipsnames,svgnames,x11names,hyperref]{xcolor}
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
@pmagwene
pmagwene / gist:2023405
Created March 12, 2012 17:09
build vim 7.3 on OS X w/non-system python and lua support

If using brew version of python

Make sure you brew as:

brew install --framework python

Configure

@pmagwene
pmagwene / gist:1991040
Created March 7, 2012 05:08
crude dotplot in matplotlib
# assumes pyplot and numpy are in namespace
import string
x = [1,4,5,9,9,11,13,14,18,20]
cats = [i for i in string.letters[:10]]
maxx = max(x)*1.10
ax = axes([0,0,1,1])
xlim(0,maxx)
ylim(0,11)
ticks = ax.yaxis.set_ticks(range(1,11))
@pmagwene
pmagwene / gist:1367153
Created November 15, 2011 14:05
Prevent TextMate from restoring files from last session
If you want to change this behavior, open Terminal.app and type
defaults write com.macromates.textmate OakDisableSessionRestore 1
This will make Textmate not remember the last session.
Change the 1 by 0 if you want the default behavior.
@pmagwene
pmagwene / gist:1298331
Created October 19, 2011 13:50
Get SNPs for gene from our Illumina data
from yeastgenome import samsnp
from yeastgenome import yeastgff as yff
from yeastgenome import yeastsnp
from yeastgenome import gff, gffsnp as gs
flist = gff.parse_GFFfeatures('./yeast-genome-Feb2011/saccharomyces_cerevisiae.gff')
gdict = gff.fasta_asdict('../yeast-genome-feb2011/saccharomyces_cerevisiae.gff')
bwa70 = samsnp.parse_samsnp('./PMY070/bwa.Feb2011/final.pileup')
@pmagwene
pmagwene / gist:1290415
Created October 16, 2011 01:55
create a numpy recarray from a matrix
nr1 = np.core.records.fromarrays(d1.transpose(), names=labels,formats=['f8']*191)
@pmagwene
pmagwene / gist:1257022
Created October 2, 2011 03:57
emacs stuff
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(LaTeX-command "latex -synctex=1")
'(TeX-view-program-selection (quote ((output-dvi "open") (output-pdf "Skim") (output-html "open"))))
'(org-agenda-files (quote ("~/synchronized/org-notes/work.org" "~/synchronized/org-notes/home.org" "~/synchronized/org-notes/teaching.org" "~/synchronized/org-notes/research.org"))))
;(custom-set-faces