annotate ab-index.R @ 0:58ecd15e6836 draft default tip

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
author ecology
date Thu, 20 Jun 2019 04:04:43 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
1 #!/usr/bin/env Rscript
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
2
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
3 args = commandArgs(trailingOnly=TRUE)
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
4 source(args[1])
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
5
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
6
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
7 tryCatch({input = read.table(args[2], header=TRUE,sep=" ")},finally={input = read.table(args[2], header=TRUE,sep=",")})
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
8 pheno = read.table(args[3], header=TRUE,sep=" ")
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
9
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
10 if("TREND" %in% colnames(input)){
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
11 input <- input[input$TREND==1,c("SPECIES","SITE","YEAR","MONTH","DAY","COUNT")]
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
12 }
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
13 data.index <- abundance_index(input, pheno)
58ecd15e6836 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff changeset
14 write.table(data.index, file="data.index", row.names=FALSE, sep=" ")