-
-
Save mutolisp/5656413 to your computer and use it in GitHub Desktop.
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
setwd("/Users/easss/Desktop/RRTbatch/") | |
library(ape) | |
library(pegas) | |
# list file in current directory, where the file is end with .phy | |
filelist <- list.files(path=".", pattern=".phy$") | |
# create a container to store output data | |
out_tab <- matrix(0, nrow=length(filelist), ncol=3) | |
colnames(out_tab) <- c("dna_seq", "Chi", "Pval") | |
i = 1 | |
for ( f in filelist ) { | |
seq3 <- read.dna(f) | |
out_tab[i,1] <- f | |
out_tab[i,2] <- rr.test(x = seq3[2,], y = seq3[3, ], out = seq3[1, ])$Chi | |
out_tab[i,3] <- rr.test(x = seq3[2,], y = seq3[3, ], out = seq3[1, ])$Pval | |
i=i+1 | |
} | |
# write output table | |
write.table(out_tab, file="out_tab.csv", sep=",", row.names=F) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment