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
library(geosphere) | |
# First, pick a starting point for one of the transects. | |
start.point.1 <- matrix(data = c(-122.54727, 47.57078), nrow=1) | |
# Set two other starting points, 1000 meters from the first, in opposite directions | |
start.point.2 <- destPoint(start.point.1, 30, 1000) | |
start.point.3 <- destPoint(start.point.1, 210, 1000) | |
# Pick the distances along each transect you want to sample |
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
# sample structure plots | |
# to suppress axis ticks, use: | |
# xaxt = "n", yaxt = "n" | |
# no borders lty=0 or border=0 | |
par(mfcol=c(4,2), mar=c(2,2,1,1), oma=c(2,4,2,2)) | |
plot(0,1,type="n", ylim=c(0,1), xlim=c(0,100), xlab=NA, ylab=NA, yaxp = c(0, 1, 2)) | |
rect(0,0,100,1, col="yellow", border=0) | |
plot(0,1,type="n", ylim=c(0,1), xlim=c(0,100), xlab=NA, ylab=NA, yaxp = c(0, 1, 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
# For any two DNA sequences, this code will generate a single sequence which represents differences among them with the IUPAC ambiguities. | |
het.cbm <- function(x1, x2){ | |
if (length(x1)!=length(x2)) stop("sequences are not the same length!") | |
oot <- paste(x1, x2, sep="") | |
# define nucleotides | |
nucleotides<-c("A", "C", "G", "T") | |
# make a matrix of all possible combinations of nucleotides | |
combos <- matrix(NA, 4,4) |