Mercurial > repos > proteore > proteore_goprofiles
changeset 4:715002a394ec draft
planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
author | proteore |
---|---|
date | Fri, 23 Mar 2018 10:47:17 -0400 |
parents | ed226f0e5625 |
children | 781072a65600 |
files | goprofiles.R goprofiles.xml |
diffstat | 2 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/goprofiles.R Wed Mar 14 12:51:53 2018 -0400 +++ b/goprofiles.R Fri Mar 23 10:47:17 2018 -0400 @@ -2,20 +2,22 @@ library(org.Hs.eg.db) library(goProfiles) -# Read file and return file content as data.frame? +# Read file and return file content as data.frame readfile = function(filename, header) { if (header == "true") { - # Read only the first line of the files as data (without headers): - headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE) - #Read the data of the files (skipping the first row): - file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE) + # Read only first line of the file as header: + headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") + #Read the data of the files (skipping the first row) + file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") # Remove empty rows - file <- file[!apply(is.na(file) | file == "", 1, all),] - #And assign the headers of step two to the data: + file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE] + #And assign the header to the data names(file) <- headers } else { - file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE) + file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") + # Remove empty rows + file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE] } return(file) } @@ -175,7 +177,7 @@ input_type = args$input_type if (input_type == "text") { - input = strsplit(args$input, " ")[[1]] + input = strsplit(args$input, "[ \t\n]+")[[1]] } else if (input_type == "file") { filename = args$input
--- a/goprofiles.xml Wed Mar 14 12:51:53 2018 -0400 +++ b/goprofiles.xml Fri Mar 23 10:47:17 2018 -0400 @@ -44,7 +44,7 @@ <conditional name="input" > <param name="ids" type="select" label="Enter your ID list (only Entrez Gene ID or UniProt accession number allowed" help="Copy/paste or ID list from a file (e.g. table)" > <option value="text">Copy/paste your identifiers</option> - <option value="file">Input file containing your identifiers</option> + <option value="file" selected="true">Input file containing your identifiers</option> </param> <when value="text" > <param name="text" type="text" label="Copy/paste your identifiers" help='IDs must be separated by spaces into the form field, for example: P31946 P62258' >