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 random | |
import argparse | |
description = """ | |
Random permutation of FASTA file. | |
This script reads a FASTA-formatted file containing aligned sequences and | |
applies a random permutation of alignment columns (nucleotide sites), | |
writing the result to a new FASTA file. A random permutation changes the | |
order of a sequence. For example, (1,2,3,4,5) may become (4,2,1,3,5). |
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 lzma | |
import os | |
import csv | |
import subprocess | |
import tempfile | |
from mpi4py import MPI | |
comm = MPI.COMM_WORLD | |
my_rank = comm.Get_rank() |
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
# Let 25,000 be a circle of unit radius (area = pi) | |
require(ggfree) | |
png(file="~/Desktop/canada-data-sharing.png", width=5*200, height=5.25*200, res=200) | |
par(mar=c(1,1,3,1), family='Palatino', bg=rgb(.14, .12, .27), xpd=NA) | |
plot(NA, xlim=c(-1, 1), ylim=c(0, 2), | |
xaxt='n', yaxt='n', xlab=NA, ylab=NA, bty='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
require(ape) | |
#' get.intervals | |
#' | |
#' Scan through BEAST tree log line-by-line and parse each | |
#' Newick string to retrieve the coalescent intervals | |
#' | |
#' @param treefile: (character) relative or absolute path to trees log file | |
#' @return List containing objects of class coalescentIntervals (ape) keyed | |
#' by state (MCMC step number) |
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 os | |
import sys | |
import csv | |
from glob import glob | |
import argparse | |
from micall.core.parse_interop import read_errors, write_phix_csv | |
from micall.core.filter_quality import report_bad_cycles | |
from micall.core.censor_fastq import censor | |
from micall.core.prelim_map import prelim_map |
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
require(ggfree) | |
# prep lists of data | |
attach(pheno.sel) | |
l1 <- split(Oil[Exp=='IHO'], Year[Exp=='IHO']) | |
l2 <- split(Oil[Exp=='ILO'], Year[Exp=='ILO']) | |
# ILO missing data for 1985 | |
z <- which(names(l2)=='1984') | |
l2 <- c(l2[1:z], list('1985'=numeric(0)), l2[(z+1):length(l2)]) |
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
add.grid <- function(fg.col='white', bg.col='ivory2', lwd.major=3, lwd.minor=1) { | |
# call this after plot() but *before* drawing any data with points() or lines() | |
u <- par('usr') # get plot region dimensions | |
x <- par('xaxp') | |
y <- par('yaxp') | |
# fill background | |
rect(xl=u[1], yb=u[3], xr=u[2], yt=u[4], col=bg.col, border=NA) | |
x.major <- seq(x[1], x[2], length.out=x[3]+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 urllib.request as ur, random, json, webbrowser | |
aid=','.join([str(random.randint(0,4e6)) for i in range(20)]) | |
r=ur.urlopen("https://itunes.apple.com/lookup?amgAlbumId="+aid) | |
res=json.loads(r.read()) | |
album=res['results'][0]['collectionViewUrl'] | |
webbrowser.open(album) |
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
get.terminals <- function(node, tree) { | |
parents <- c(node) | |
tips <- c() | |
while (length(parents) > 0) { | |
for (parent in parents) { | |
children <- tree$edge[which(tree$edge[,1]==parent),2] | |
parents <- parents[parents!=parent] | |
if (length(children) > 0) { | |
parents <- c(parents, children) | |
} else { |
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 argparse | |
from suds.client import Client | |
import sys | |
import re | |
def iter_fasta (handle): | |
header = None | |
sequence = '' | |
for line in handle: | |
if line.startswith('$'): |
NewerOlder