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 / instructions.md
Last active August 29, 2015 14:05
building revbayes w/ homebrew boost

install homebrew... http://brew.sh

install dependencies

brew install cmake boost

pull down revbayes development version

@jonchang
jonchang / streaming_select_cols.py
Created December 10, 2014 00:07
select only certain columns from a tab delimited file (optionally gzipped)
#!/usr/bin/env python
from __future__ import print_function
import gzip
import argparse
from operator import itemgetter
def get_args():
parser = argparse.ArgumentParser(description="selects fields from a tab-delimited file")
@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 / _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 / 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 / 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 / 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 / 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 / unconcatenate_phylip.py
Last active November 18, 2017 22:19
Unconcatenates a RAxML-style phylip/partitions file
#!/usr/bin/env python3
# By Jonathan Chang - September 2017
import sys, argparse, logging, re, os
def get_partitions(path):
"""Given a path, returns a dictionary with partition names as keys and a list of
length 2, representing a range of characters."""