This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def balanced_tree(n, level): | |
if level == 0: | |
return n + 1, 't%d' % n | |
n, leftsub = balanced_tree(n, level - 1) | |
n, rightsub = balanced_tree(n, level - 1) | |
return n, '(%s,%s)' % (leftsub, rightsub) | |
if __name__ == '__main__': | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import dendropy | |
if __name__ == '__main__': | |
from optparse import OptionParser | |
from optparse import OptionGroup | |
import sys, os | |
_script_name = os.path.split(sys.argv[0])[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import dendropy | |
from copy import copy | |
threshold = float(sys.argv[1]) | |
filename_list = sys.argv[2:] | |
SCRIPT_NAME = 'conflict_viz' | |
def debug(*valist): | |
msg = ' '.join([str(i) for i in valist]) | |
sys.stderr.write(SCRIPT_NAME + ': ' + msg + '\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
'''Takes a MrBayes .t file and writes (to standard out) a .p file with | |
the parameters being the edge lengths for each of the Terminal edges. | |
This .p file can be used with Tracer http://tree.bio.ed.ac.uk/software/tracer/ | |
or other MCMC diagnostics files. | |
Example invocation with redirection to a file called term_edges_myrun.p : | |
python terminal_edges_to_dot_p.py myrun.t > term_edges_myrun.p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
wget http://pypi.python.org/packages/source/D/DendroPy/DendroPy-3.11.0.tar.gz | |
tar xfvz DendroPy-3.11.0.tar.gz | |
cd DendroPy-3.11.0 | |
python setup.py install | |
cd extras/geodispersal/ | |
python geodispersal-analysis.py LiebermanEBasidechenella.nex LiebermanEBasidechenella.nex --labels=labels.txt --paup --vicariance=vic --dispersal=disp | |
cat Readme.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, math | |
v_list = [float(value) for value in sys.stdin] | |
offset = max(v_list) | |
n = len(v_list) | |
sum_exps = sum([math.exp(v - offset) for v in v_list]) | |
mean_exps = sum_exps/n | |
sys.stdout.write('Log of mean of the exp of %d values is:\n' % n) | |
sys.stdout.write('%8.7f\n' % (math.log(mean_exps) + offset)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# You might want to modify the first line to specify your own install location. | |
# In theory the rest should not need tweaking... | |
export GCC_PREFIX="$HOME/gcc4.7" | |
# Hopefully, you can tweak these as they get out of date, but the download URL's | |
# may not be stable to text substitution. | |
GMP_DOWNLOAD_VERSION=gmp-5.0.5 | |
MPFR_DOWNLOAD_VERSION=mpfr-3.1.0 | |
MPC_DOWNLOAD_VERSION=mpc-0.8.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Example of a client of the demo of the TNRS API described at: | |
http://www.evoio.org/wiki/Phylotastic/TNRS | |
Reads names (separated by newline characters) from file names passed in as | |
command-line arguments (or reads name from standard input if no arguments | |
are given). | |
Outputs tab-delimited summary of the matches for each query sorted by score of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script to use NCLconverter to convert TreeBase NEXUS files to newick | |
# Invocation: | |
# sh range_of_treebase2newick.sh 10000 10100 | |
# in a directory with filenames like S10001.nex to convert each file | |
# name like S10000.nex up to file S10100.nex to newick. | |
# you should get files like: | |
# outS####.tre newick tree for the first trees block | |
# 2outS####.tre , 3outS####.tre , etc if the file has multiple output blocks | |
# outS####.NameTranslationFile.txt is an ad hoc xml description of the name mapping |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (C) 2012 Mark T. Holder | |
// | |
// Based on example/splitsinfile/splitsinfile.cpp in NEXUS class library | |
// | |
// After NCL has been installed at ${NCL_PREFIX} | |
// | |
// g++ newick2taxalist.cpp -o newick2taxalist -I "${NCL_PREFIX}/include" -lncl -L "${NCL_PREFIX}/lib/ncl" | |
// | |
// Takes a newick file and prints out the taxa labels, one per line. | |
// |
OlderNewer