diff --git a/CHANGELOG.md b/CHANGELOG.md index 36dd4d9..e259e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ CHANGELOG --------- -#### Version 1.0.9 (2024.02.28) + +#### Version 1.0.9 (2024.02.29) * Improving variable and file names +* Correcting output plot specifications #### Version 1.0.8 (2024.02.28) * Handling of GenBank features with multiple qualifiers of the same name diff --git a/R/helpers.R b/R/helpers.R index 3896b67..aaf6a90 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -72,6 +72,37 @@ getPlotSpecs <- function(logScale, return(plotSpecs) } +getOutputFields <- function(output) { + outputTypes <- paste(getOutputTypes(), collapse = "|") + outputPattern <- sprintf("^(?:.+\\.)(%s)$", outputTypes) + outputMatch <- regexec(outputPattern, output, ignore.case = TRUE) + outputVec <- regmatches(output, outputMatch) + + # non-char `output` or non-match for char `output` + if ((length(outputVec) == 0) || (length(outputVec[[1]]) == 0)) { + output <- NULL + outputType <- NULL + isOutput <- FALSE + } else { + output <- outputVec[[1]][1] + outputType <- tolower(outputVec[[1]][2]) + isOutput <- TRUE + } + + outputFields <- list( + output = output, + outputType = outputType, + isOutput = isOutput + ) + return(outputFields) +} + +getOutputTypes <- function() { + outputTypes <- c("pdf", + "png") + return(outputTypes) +} + filterByType <- function(x, typeFun) { if (typeFun(x)) { return(x) diff --git a/R/visualisationOps.R b/R/visualisationOps.R index a7c106b..344878c 100644 --- a/R/visualisationOps.R +++ b/R/visualisationOps.R @@ -209,31 +209,6 @@ getLegendParams <- function(coverage, return(legendParams) } -getOutputFields <- function(output) { - outputTypes <- paste(getOutputTypes(), collapse = "|") - outputPattern <- sprintf("^(?:.+\\.)(%s)$", outputTypes) - outputMatch <- regexec(outputPattern, output, ignore.case = TRUE) - outputVec <- regmatches(output, outputMatch) - - # non-char `output` or non-match for char `output` - if ((length(outputVec) == 0) || (length(outputVec[[1]]) == 0)) { - output <- NULL - outputType <- NULL - isOutput <- FALSE - } else { - output <- outputVec[[1]][1] - outputType <- tolower(outputVec[[1]][2]) - isOutput <- TRUE - } - - outputFields <- list( - output = output, - outputType = outputType, - isOutput = isOutput - ) - return(outputFields) -} - createVizFile <- function(plotSpecs) { output <- plotSpecs$output outputType <- plotSpecs$outputType @@ -241,22 +216,18 @@ createVizFile <- function(plotSpecs) { if (outputType == "pdf") { pdf(output, width=10, - height=10) + height=10, + units="cm", + res=600) } else if (outputType == "png") { png(output, - width=480, - height=480) + width=10, + height=10, + units="cm", + res=600) } } -getOutputTypes <- function() { - outputTypes <- c("pdf", - "png") - return(outputTypes) -} - - - GenerateHistogramData <- function(region, coverage, windowSize, lastOne) { # Function to generate line data for RCircos.Line.Plot # ARGS: