This file contains hidden or 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 | |
from dendropy import TreeList | |
NEWICK = 'newick' | |
NEXUS = 'nexus' | |
try: | |
stream = sys.argv[1] |
This file contains hidden or 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 | |
# FlickrSetDownloadr.py | |
# Downloads photos from a Flickr set | |
# Usage: python FlickrSetDownloadr.py [PHOTOSET_ID] | |
import sys | |
from collections import deque | |
try: | |
from xml.etree.cElementTree import fromstring | |
except: |
This file contains hidden or 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 | |
# SecretSnowflakeOrganizer.py | |
# Web app that automatically coordinates a Secret Snowflake Gift Exchange | |
COORDINATOR_PASSWORD = 'COORDINATOR_PASSWORD' | |
DB_HOST = 'DB_HOST' | |
DB_USER = 'DB_USER' | |
DB_PASSWORD = 'DB_PASSWORD' | |
DB_NAME = 'DB_NAME' | |
GMAIL_USER = 'EMAIL' |
This file contains hidden or 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; print '\n'.join([l.split(',')[0] + '\t' + l.split(',')[-5] for l in open(sys.argv[1])]); |
This file contains hidden or 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 python3 | |
import sys | |
from fractions import Fraction | |
mult = lambda r,f: [f * x for x in r] | |
add = lambda r1,r2: [x + y for x,y in zip(r1,r2)] | |
def print_matrix(m): | |
for r in m: print('\t'.join(str(x) for x in r)) |
This file contains hidden or 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/python | |
import smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEBase import MIMEBase | |
from email.MIMEText import MIMEText | |
from email import Encoders | |
import os | |
gmail_user = "[email protected]" |
This file contains hidden or 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
next_poisson <- function(lambdas) { | |
lambda <- sum(lambdas) | |
t <- rexp(1, rate = lambda) | |
i <- sample(length(lambdas), 1, prob = lambdas / lambda) | |
return(c(t, i)) | |
} | |
duplication <- function(s) { | |
i <- sample(length(s), 1, prob = s / sum(s)) | |
s[i] <- s[i] + 1 |
This file contains hidden or 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
\documentclass[11pt]{article} | |
\usepackage[margin=1in]{geometry} | |
\usepackage{amsmath} | |
\frenchspacing | |
\begin{document} | |
\begin{tabular}{l c l} |
This file contains hidden or 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
from string import ascii_lowercase as alphabet | |
f = lambda i: alphabet[i] if i < 26 else alphabet[i / 26 - 1] + alphabet[i % 26] |
This file contains hidden or 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
public static void main(String... args) throws IOException, Importer.ImportException { | |
final TreeModel tree = new TreeModel(new NewickImporter("(a:1,b:1);").importNextTree()); | |
final SimpleAlignment alignment = new SimpleAlignment(); | |
alignment.setDataType(Nucleotides.INSTANCE); | |
alignment.addSequence(new Sequence(new Taxon("a"), "A")); | |
alignment.addSequence(new Sequence(new Taxon("b"), "C")); | |
final PatternList patterns = new SitePatterns(alignment); | |
final SiteModel siteModel = new GammaSiteModel(new GTR(new Variable.D(1, 1), new Variable.D(1, 1), new Variable.D(1, 1), new Variable.D(1, 1), new Variable.D(1, 1), new Variable.D(1, 1), new FrequencyModel(Nucleotides.INSTANCE, new double[]{0.25, 0.25, 0.25, 0.25}))); | |
final TreeLikelihood likelihood = new TreeLikelihood(patterns, tree, siteModel, new DefaultBranchRateModel(), null, true, false, true, true, false); | |
final Variable<Double> var = tree.createNodeHeightsParameter(true, true, false |