Skip to content

Instantly share code, notes, and snippets.

View jeetsukumaran's full-sized avatar

Jeet Sukumaran jeetsukumaran

View GitHub Profile
@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_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 / 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
@jeetsukumaran
jeetsukumaran / custom_iterator.cpp
Created February 18, 2010 02:33
Sample C++/STL custom iterator
// Sample custom iterator.
// By perfectly.insane (http://www.dreamincode.net/forums/index.php?showuser=76558)
// From: http://www.dreamincode.net/forums/index.php?showtopic=58468
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cassert>
@jeetsukumaran
jeetsukumaran / insert.cpp
Created February 18, 2010 03:32
Comparison of performance of std::copy() vs. insert()
#include <iostream>
#include <vector>
int main(int, char* []) {
std::vector<int> a(10000000, 10);
std::vector<int> b;
b.reserve(10000000);
b.insert(b.end(), a.begin(), a.end());
}
@jeetsukumaran
jeetsukumaran / cfgcommand.sh
Created February 18, 2010 23:00
autoconf / build tools bootstrap and configure command
#! /bin/sh
BUILD_TYPE="release"
PROGRAM_LABEL=""
for arg in $@
do
if [[ $arg = debug ]]
then
BUILD_TYPE="debug"
elif [[ $arg = profil* ]]
@jeetsukumaran
jeetsukumaran / dendropy_beast_tree.py
Created August 6, 2010 21:55
Processing BEAST Trees --- Node heights and lengths (mean, median, 95% HPD, and range)
#! /usr/bin/env python
import re
import dendropy as dpy
BEAST_NODE_INFO_PATTERN = re.compile(r'(.+?)=({.+?,.+?}|.+?)(,|$)')
BEAST_SUMMARY_TREE_NODE_FIELDS = [
'height',
'height_median',
#! /usr/bin/env python
import dendropy
from dendropy import treesplit
from dendropy.interop import paup
trees = dendropy.TreeList.get_from_path('smallwt.nex', 'nexus')
taxa = trees.taxon_set
tax_labels, bipartitions, bipartition_counts, bipartition_freqs = paup.bipartitions("weightedtrees.taxa.nex", "weightedtrees.nex", use_tree_weights=True)
split_dists_paup = paup.build_split_distribution(bipartition_counts,