Skip to content

Commit

Permalink
Merge pull request #36 from michaelgruenstaeudl/testing
Browse files Browse the repository at this point in the history
Improving output plot specs
  • Loading branch information
michaelgruenstaeudl authored Feb 28, 2024
2 parents 3ccf9b0 + 06080ab commit 633365e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 37 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 31 additions & 0 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
43 changes: 7 additions & 36 deletions R/visualisationOps.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,54 +209,25 @@ 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

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:
Expand Down

0 comments on commit 633365e

Please sign in to comment.