Mercurial > repos > ucsb-phylogenetics > osiris_phylogenetics
comparison phylostatistics/ses-mpd-galaxy.r @ 0:5b9a38ec4a39 draft default tip
First commit of old repositories
author | osiris_phylogenetics <ucsb_phylogenetics@lifesci.ucsb.edu> |
---|---|
date | Tue, 11 Mar 2014 12:19:13 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:5b9a38ec4a39 |
---|---|
1 #!/sw/math/R-2.15.3-shlib/bin/Rscript | |
2 | |
3 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
4 # NOTE: since picante is licensed under the GPL, and this program relies on | |
5 # picante, the program is licensed under the GPL regardless | |
6 # | |
7 # See: http://cran.r-project.org/web/packages/picante/picante.pdf, | |
8 # http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#IfLibraryIsGPL | |
9 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
10 | |
11 library('picante') | |
12 | |
13 args <- commandArgs(trailingOnly = TRUE) | |
14 | |
15 sample <- read.table(file = args[1]) | |
16 tree <- read.tree(file = args[2]) | |
17 | |
18 # get community data matrix of sample | |
19 comm <- sample2matrix(sample) | |
20 # get phylogenetic distance matrix of tree | |
21 phydist <- cophenetic(tree) | |
22 | |
23 # finally, run the processed info through ses.mpd to get the result we want | |
24 result <- ses.mpd(comm, phydist) | |
25 | |
26 # capture result and output to file | |
27 out <- capture.output(result) | |
28 cat(out, file = args[3], sep = "\n") |