Skip to content

Instantly share code, notes, and snippets.

View jonchang's full-sized avatar
🐢
I may be slow to respond.

Jonathan Chang jonchang

🐢
I may be slow to respond.
  • Los Angeles
View GitHub Profile
@jonchang
jonchang / instructions.md
Last active August 29, 2015 14:01
diversitree OS X Mavericks install

Installing diversitree on OS X Mavericks, R 3.1.0

I installed R from the installer on CRAN

If you installed R from the installer on CRAN:

The easy way

Download my compiled package from Dropbox and install it that way:

@jonchang
jonchang / shrimp.rb
Last active December 28, 2015 17:48
Binary-only install of SHRiMP
require 'formula'
class Shrimp < Formula
homepage 'http://compbio.cs.toronto.edu/shrimp/'
url 'http://compbio.cs.toronto.edu/shrimp/releases/SHRiMP_2_2_2.macosx.x86_64.tar.gz'
sha1 'ba666ccc0aa5da0f55a8a41e6f40daabe876c3dd'
version '2.2.2'
def patches
# Change shebang of Python utilities.
@jonchang
jonchang / parse_fasta.py
Created September 7, 2013 00:53
Python utility function: Given a path tries to parse a FASTA file. Returns an iterator which yields a (name, sequence) tuple
def parse_fasta(path):
"""Given a path tries to parse a fasta file. Returns an iterator which
yields a (name, sequence) tuple"""
with open(path) as handle:
name = sequence = ""
for line in handle:
line = line.strip()
if line.startswith(">"):
if name:
yield name, sequence
@jonchang
jonchang / canonize_synonyms.py
Created April 29, 2013 21:38
canonizes synonyms and drops duplicates in alignment files
#!/usr/bin/env python
# canonize_synonyms.py -- by Jonathan Chang (March 2013)
import argparse
import os.path
import multiprocessing
import functools
import csv
import collections
@jonchang
jonchang / raxml_runner.py
Created April 29, 2013 21:31
Runs RAxML in parallel on a bunch of sequences
#!/usr/bin/env python
import argparse
import os.path
import os
import errno
import multiprocessing
import functools
import subprocess
import pdb
@jonchang
jonchang / convert_characters.py
Created March 13, 2013 10:56
Converts character data (e.g., dna) from one format to another using dendropy
#!/usr/bin/env python
# convert_characters.py -- by Jonathan Chang (March 2013)
import argparse
import os.path
import multiprocessing
import functools
import dendropy
@jonchang
jonchang / _geiger_steps.markdown
Last active October 13, 2015 14:47
installing geiger from source on mac

R typically installs libgfortran so packages can link to it, but for some reason it wasn't linked properly for me.

ln -s $(R RHOME)/lib/libgfortran.2.dylib $(R RHOME)/lib/libgfortran.dylib

Also for some reason R wasn't able to find its own shared library directory, so download geiger

curl -O https://dl.dropbox.com/u/8859543/geiger_1.4-4.666.tar.gz
@jonchang
jonchang / group_ranges.py
Created August 22, 2012 07:42
Groups consecutive number ranges together
import itertools
def group_ranges(L):
"""
Collapses a list of integers into a list of the start and end of
consecutive runs of numbers. Returns a generator of generators.
>>> [list(x) for x in group_ranges([1, 2, 3, 5, 6, 8])]
[[1, 3], [5, 6], [8]]
"""
@jonchang
jonchang / eti_keyboard_shortcuts.user.js
Last active March 4, 2018 06:14
ETI Keyboard Shortcuts
// ==UserScript==
// @name ETI Keyboard Shortcuts
// @namespace shoecream@endoftheinter.net
// @description Adds keyboard shortcuts to streamline your shitposting
// @match *://boards.endoftheinter.net/*
// @match *://endoftheinter.net/*
// @grant GM.openInTab
// @version 0.17
// ==/UserScript==