annotate ab_index.R @ 0:5b126f770671 draft

Uploaded
author mnhn65mo
date Fri, 03 Aug 2018 08:28:22 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
1 #!/usr/bin/env Rscript
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
2 #library("getopt")
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
3 #library(devtools)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
4 #library(RegionalGAM)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
5
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
6 args = commandArgs(trailingOnly=TRUE)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
7 source(args[1])
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
8
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
9
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
10 tryCatch({input = read.table(args[2], header=TRUE,sep=" ")},finally={input = read.table(args[2], header=TRUE,sep=",")})
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
11 pheno = read.table(args[3], header=TRUE,sep=" ")
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
12
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
13 if("TREND" %in% colnames(input)){
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
14 input <- input[input$TREND==1,c("SPECIES","SITE","YEAR","MONTH","DAY","COUNT")]
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
15 }
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
16 data.index <- abundance_index(input, pheno)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
17 write.table(data.index, file="data.index", row.names=FALSE, sep=" ")