Previous changeset 3:ed226f0e5625 (2018-03-14) Next changeset 5:781072a65600 (2018-09-19) |
Commit message:
planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty |
modified:
goprofiles.R goprofiles.xml |
b |
diff -r ed226f0e5625 -r 715002a394ec goprofiles.R --- 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 |
b |
diff -r ed226f0e5625 -r 715002a394ec goprofiles.xml --- a/goprofiles.xml Wed Mar 14 12:51:53 2018 -0400 +++ b/goprofiles.xml Fri Mar 23 10:47:17 2018 -0400 |
b |
@@ -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' > |