Mercurial > repos > ecology > makeeml
annotate taxo_cov_template.R @ 5:34dcb86a9351 draft
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit 43f3c45c97ba7d09ad1ea19df9e953cfe917dde8
author | ecology |
---|---|
date | Mon, 22 Jan 2024 14:56:11 +0000 |
parents | 8a697f446051 |
children |
rev | line source |
---|---|
2
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
1 #28/11/2023 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
2 #Seguineau Pauline |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
3 #Make taxonomic coverage template |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
4 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
5 #Load packages |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
6 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
7 library(EMLassemblyline) |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
8 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
9 #Load arguments |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
10 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
11 args = commandArgs(trailingOnly=TRUE) |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
12 if(length(args)>0){ |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
13 data_taxa <- args[1] |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
14 taxa_table <- args[2] |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
15 taxa_col <- as.numeric(args[3]) |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
16 taxa_name_type <- args[4] |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
17 authority <- as.numeric(args[5]) |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
18 authority2 <- as.numeric(args[6]) |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
19 authority3 <- as.numeric(args[7]) |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
20 empty <- args[8] |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
21 } |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
22 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
23 #transfom arguments |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
24 taxatable = read.table(data_taxa,header=T,sep="\t") |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
25 taxacol = names(taxatable[taxa_col]) |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
26 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
27 if (authority2 == 0 && authority3==0){ |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
28 authority_f = authority} |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
29 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
30 if(authority2 == 0 && authority3 != 0){ |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
31 authority_f = c(authority,authority3)} |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
32 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
33 if (authority2 !=0 && authority3==0){ |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
34 authority_f = c(authority,authority2)} |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
35 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
36 if (authority3 !=0 && authority2 !=0){ |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
37 authority_f = c(authority,authority2,authority3)} |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
38 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
39 if (empty == "false"){ |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
40 empty = FALSE |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
41 }else if (empty=="true"){ |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
42 empty=TRUE} |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
43 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
44 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
45 #Make template |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
46 |
8a697f446051
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
ecology
parents:
diff
changeset
|
47 template_taxonomic_coverage(path =".", data.path = "data_files", taxa.table = taxa_table, taxa.col = taxacol, taxa.name.type = taxa_name_type , taxa.authority = authority_f, empty = empty) |