Skip to content

Instantly share code, notes, and snippets.

View jeetsukumaran's full-sized avatar

Jeet Sukumaran jeetsukumaran

View GitHub Profile
@jeetsukumaran
jeetsukumaran / phylodynamaster-generate.py
Last active August 29, 2015 13:56
Generate configuration files for Vaughn's MASTER to generate viral phylogenies under different phylodynamic regimes
#! /usr/bin/env python
__version__ = "1.0.0"
from time import strftime
import random
import sys
import os
import argparse
#! /bin/bash
cd venvs
virtualenv -p /opt/python/Python-2.7.6/bin/python2 dendropy4-python2.7 && cd ../dendropy && . ../venvs/dendropy4-python2.7/bin/activate && python setup.py develop && deactivate && cd -
virtualenv -p /opt/python/Python-3.2.5/bin/python3 dendropy4-python3.2 && cd ../dendropy && . ../venvs/dendropy4-python3.2/bin/activate && python setup.py develop && deactivate && cd -
virtualenv -p /opt/python/Python-3.3.4/bin/python3 dendropy4-python3.3 && cd ../dendropy && . ../venvs/dendropy4-python3.3/bin/activate && python setup.py develop && deactivate && cd -
virtualenv -p /opt/python/Python-3.4.0/bin/python3 dendropy4-python3.4 && cd ../dendropy && . ../venvs/dendropy4-python3.4/bin/activate && python setup.py develop && deactivate && cd -
virtualenv -p /opt/python/Python-2.6.9/bin/python2 dendropy3-python2.6 && cd ../dendropy3 && . ../venvs/dendropy4-python2.6/bin/activate && python setup.py develop && deactivate && cd -
@jeetsukumaran
jeetsukumaran / smartcase-dict-complete.vim
Last active August 29, 2015 13:58
Smart (`infercase`) Dictionary Completions in Vim Without Otherwise Messing with Your `ignorecase` Settings
function! s:_setup_cidictcompletion()
let g:_old_ignorecase_state=&ignorecase
inoremap <C-X><C-K> <ESC>:let g:_old_ignorecase_state=&ignorecase<CR>:set ignorecase<CR>:set infercase<CR>a<C-X><C-K>
" inoremap <expr> <CR> pumvisible() ? "\<C-y><ESC>:set noignorecase<CR>a" : "\<C-g>u\<CR>"
" inoremap <expr> <C-J> pumvisible() ? "\<C-y><ESC>:set noignorecase<CR>a" : "\<C-g>u\<C-J>"
let restore=' pumvisible() ? "\<C-y><ESC>:let &ignorecase=g:_old_ignorecase_state<CR>'
for key in ["<CR>", "<C-J>", "<C-Y>"]
execute "inoremap <expr> " . key . restore . 'a" : "\<C-g>u\<CR>"'
endfor
for key in ["<ESC>", "<C-C>"]
@jeetsukumaran
jeetsukumaran / Python_Golf_2015-03-01.py
Last active August 29, 2015 14:16
Exactly One Matching Element
#! /usr/bin/env python
"""
Python Golf
An expression that takes predicate function object and an iterable,
and returns True if the predicate function evaluates True once and exactly once
when applied to all the elements in the iterable.
Expression with the minimum number of non-whitespace characters wins.
#! /usr/bin/env python
import dendropy
from dendropy.calculate import popgenstat
d = dendropy.DnaCharacterMatrix.get_from_path(
"data/primates.chars.nexus", "nexus")
print("num_segregating_sites = {}".format(popgenstat.num_segregating_sites(d, True)))
print("num_segregating_sites = {}".format(popgenstat.num_segregating_sites(d, False)))
@jeetsukumaran
jeetsukumaran / raxml_multi_sge.rst
Created January 21, 2010 06:26
Phylogenetic Analysis: Multi-Processor RAxML Partitioned Maximum Likelihood Under SGE

Phylogenetic Analysis: Multi-Processor RAxML Partitioned Maximum Likelihood Under SGE

Model File (model.txt)

DNA, cr = 1-732
@jeetsukumaran
jeetsukumaran / mrbayes_sge.rst
Created January 21, 2010 05:55
Phylogenetic Analysis: Parallel Mr. Bayes on a Cluster under SGE

Phylogenetic Analysis: Parallel Mr. Bayes on a Cluster under SGE

Mr. Bayes Block

begin mrbayes;
@jeetsukumaran
jeetsukumaran / raxml_single.rst
Created January 21, 2010 06:18
Phylogenetic Analysis: Single-Processor RAxML Partitioned Maximum Likelihood

Phylogenetic Analysis: Single-Processor RAxML Partitioned Maximum Likelihood

Model File (model.txt)

DNA, cr = 1-732
@jeetsukumaran
jeetsukumaran / raxml_multi_boot_sge.rst
Created January 21, 2010 07:02
Phylogenetic Analysis: Multi-Processor RAxML Non-Parametric Bootstraps Under SGE

Phylogenetic Analysis: Multi-Processor RAxML Non-Parametric Bootstraps Under SGE

Model File (model.txt)

DNA, cr = 1-732
@jeetsukumaran
jeetsukumaran / pbs_job.sh
Created February 15, 2010 07:52
Phylogenetic Analysis: Parallel Mr. Bayes on a Cluster under Torque (PBS) and OpenMPI
# Phylogenetic Analysis: Parallel Mr. Bayes on a Cluster under Torque (PBS) and OpenMP
# Selects 3 machines, and 4 cpu's on each machine
#PBS -N mrbayes
#PBS -W group_list="max_ittc"
#PBS -q max_ittc
#PBS -l nodes=3:ncpus=4
cd $PBS_O_WORKDIR
mpirun -np 12 /share/apps/bin/mb-multi-cvs-3.2 pythonidae.mb