Skip to content

Commit

Permalink
Ran github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
smped committed Feb 8, 2024
1 parent ecb60fa commit f013846
Show file tree
Hide file tree
Showing 31 changed files with 6,600 additions and 6,373 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
config:
- { os: ubuntu-latest, r: 'next', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
## Dockers for macOS and Windows can't handle r: 'next' at this stage
- { os: macOS-latest, r: 'next', bioc: 'devel'}
- { os: windows-latest, r: 'next', bioc: 'devel'}
- { os: macOS-latest, r: '4.3', bioc: '3.18'}
- { os: windows-latest, r: '4.3', bioc: '3.18'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Description: This package provides methods and object classes for parsing
objects.
URL: https://github.com/smped/ngsReports
BugReports: https://github.com/smped/ngsReports/issues
License: file LICENSE
License: LGPL-3
Encoding: UTF-8
Depends:
R (>= 4.2.0),
Expand All @@ -40,7 +40,6 @@ Imports:
lubridate,
methods,
plotly (>= 4.9.4),
readr,
reshape2,
rlang,
rmarkdown,
Expand Down Expand Up @@ -111,6 +110,7 @@ Suggests:
DT,
knitr,
pander,
readr,
testthat,
truncnorm
biocViews: QualityControl, ReportWriting
Expand Down
66 changes: 34 additions & 32 deletions R/FastpData.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
#' @rdname FastpData
#' @aliases FastpData-class
setClass(
"FastpData",
slots = c(
Summary = "list",
Adapters = "data.frame",
Duplication = "data.frame",
Insert_size = "data.frame",
Before_filtering = "list",
After_filtering = "list",
paired = "logical",
command = "character",
version = "character",
path = "character"
)
"FastpData",
slots = c(
Summary = "list",
Adapters = "data.frame",
Duplication = "data.frame",
Insert_size = "data.frame",
Before_filtering = "list",
After_filtering = "list",
paired = "logical",
command = "character",
version = "character",
path = "character"
)
)
setValidity("FastpData", .isValidFastpData)

Expand All @@ -57,28 +57,30 @@ setValidity("FastpData", .isValidFastpData)
#' @rdname FastpData
#' @export
FastpData <- function(x){
stopifnot(!is.null(x))
fl <- .FastpFile(x)
as(fl, "FastpData")
stopifnot(!is.null(x))
fl <- .FastpFile(x)
as(fl, "FastpData")
}

## The show method doesn't need exporting
setMethod(
"show",
"FastpData",
function(object){
isPaired <- object@paired
reads <- object@Summary$Before_filtering$total_reads
cat("Source Fastp file is located in", object@path)
cat(
"\nSource Fastq file(s) contains",
ifelse(
isPaired,
paste(c(scales::comma(reads/2, 1), "paired-end"), collapse = " "),
paste(c(scales::comma(reads, 1), "single-end"), collapse = " ")
),
"reads.\n"
)
}
"show",
"FastpData",
function(object){
isPaired <- object@paired
reads <- object@Summary$Before_filtering$total_reads
cat("Source Fastp file is located in", object@path)
cat(
"\nSource Fastq file(s) contains",
ifelse(
isPaired,
paste(
c(scales::comma(reads/2, 1), "paired-end"), collapse = " "
),
paste(c(scales::comma(reads, 1), "single-end"), collapse = " ")
),
"reads.\n"
)
}
)

4 changes: 3 additions & 1 deletion R/PwfCols.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#' @slot MAX A vector of length 1, defining the colour for an extreme FAIL or
#' NA in rgb format. Defaults to rgb(1, 1, 1)
#'
#' @return An S4 object of class PwfCols
#'
#' @include validationFunctions.R
#' @aliases PwfCols
setClass("PwfCols", slots = c(
Expand All @@ -30,4 +32,4 @@ setValidity("PwfCols", .isValidPwf)
# The default method for show. Doesn't need exporting
setMethod("show", "PwfCols", function(object){
cat("An object of class PwfCols.\n")
})
})
33 changes: 16 additions & 17 deletions R/estGcDistn.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#' @export
#' @rdname estGcDistn
setGeneric("estGcDistn", function(
x, n = 1e6, rl = 100, fl = 200, fragSd = 30, bins = 101, ...) {
x, n = 1e6, rl = 100, fl = 200, fragSd = 30, bins = 101, ...) {
standardGeneric("estGcDistn")
})
#' @export
Expand All @@ -53,29 +53,28 @@ setMethod("estGcDistn", "ANY", function(x, ...){
#' @export
#' @rdname estGcDistn
#' @aliases estGcDistn
setMethod("estGcDistn", "character", function(
x, n = 1e6, rl = 100, fl = 200, fragSd = 30, bins = 101, ...) {
setMethod(
"estGcDistn", "character",
function(x, n = 1e6, rl = 100, fl = 200, fragSd = 30, bins = 101, ...) {

stopifnot(file.exists(x))
errMsg <- "Supplied File not in FASTA format"
x <- tryCatch(
readDNAStringSet(x, format = "fasta"),
error = function(e) {stop(errMsg)}
)
estGcDistn(x, n, rl, fl, fragSd, bins)
})
stopifnot(file.exists(x))
errMsg <- "Supplied File not in FASTA format"
x <- tryCatch(
readDNAStringSet(x, format = "fasta"),
error = function(e) {stop(errMsg)}
)
estGcDistn(x, n, rl, fl, fragSd, bins)
})
#' @export
#' @rdname estGcDistn
#' @aliases estGcDistn
setMethod("estGcDistn", "DNAStringSet", function(
x, n = 1e6, rl = 100, fl = 200, fragSd = 30, bins = 101, ...) {
x, n = 1e6, rl = 100, fl = 200, fragSd = 30, bins = 101, ...) {

if (!requireNamespace("truncnorm", quietly = TRUE)){
if (!requireNamespace("truncnorm", quietly = TRUE)) {
stop(
paste(
"The package truncnorm is required for this function.",
"Please install it using BiocManager::install('truncnorm')"
)
"The package truncnorm is required for this function.\n",
"Please install it using BiocManager::install('truncnorm')"
)
}

Expand Down
4 changes: 1 addition & 3 deletions R/getSummary.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ setMethod("getSummary", ".FastqcFile", function(object){
## Check in case it has been deleted post-instantiation though
fl <- file.path(path, "summary.txt")
if (!file.exists(fl)) stop("'summary.txt' could not be found.")
summaryData <- suppressMessages(
readr::read_tsv(fl, col_names = FALSE)
)
summaryData <- utils::read.delim(fl, header = FALSE)
}
colnames(summaryData) <- c("Status", "Category", "Filename")
if (!any(modules %in% summaryData$Category))
Expand Down
Loading

0 comments on commit f013846

Please sign in to comment.