Mercurial > repos > iuc > ggplot2_barplot
annotate utils.r @ 0:41e9114cc7cd draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
| author | iuc | 
|---|---|
| date | Thu, 15 May 2025 13:01:57 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 0 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 1 # Function for the data input | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 2 load_data <- function(file_name, file_extension) { | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 3 if (file_extension == "csv") { | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 4 data_input <- read.csv(file_name, check.names = "false") | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 5 } else if (file_extension %in% c("tsv", "txt", "tabular")) { | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 6 data_input <- read.delim(file_name, sep = "\t", check.names = "false") | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 7 } else if (file_extension == "parquet") { | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 8 data_input <- arrow::read_parquet(file_name) | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 9 } else { | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 10 stop("Unsupported file format.") | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 11 } | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 12 return(data_input) | 
| 
41e9114cc7cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
 iuc parents: diff
changeset | 13 } | 
