Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ jobs:
- name: Set Matrix Bioconductor Version
id: set
run: |
MATRIX="{\"include\":[{\"bioc_version\":\"$GITHUB_REF_NAME\"}]}"
if [ "${{ github.event_name }}" = "pull_request" ]; then
bioc_version="devel"
else
bioc_version="${GITHUB_REF_NAME}"
fi
MATRIX="{\"include\":[{\"bioc_version\":\"$bioc_version\"}]}"
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT

check:
Expand All @@ -48,14 +53,14 @@ jobs:
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: /usr/local/lib/R/site-library
key: ${{ runner.os }}-r-${{ matrix.bioc_version }}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.bioc_version }}-

- name: Install GPG
if: ${{ github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
run: sudo apt-get update && sudo apt-get install -y gpg

- name: Install Dependencies
Expand Down
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Imports:
DelayedArray,
GenomicRanges,
IRanges,
MatrixGenerics,
methods,
S4Vectors,
tidyr,
Expand Down
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export(experiments)
export(exportClass)
export(getWithColData)
export(hasAssay)
export(hasRowData)
export(hasRowRanges)
export(intersectByRowData)
export(intersectColumns)
export(intersectRows)
export(listToMap)
Expand All @@ -36,6 +38,7 @@ export(subsetByAssay)
export(subsetByColData)
export(subsetByColumn)
export(subsetByRow)
export(subsetByRowData)
export(upsetSamples)
export(wideFormat)
exportClasses(ExperimentList)
Expand Down Expand Up @@ -64,7 +67,9 @@ exportMethods(dimnames)
exportMethods(drops)
exportMethods(experiments)
exportMethods(exportClass)
exportMethods(hasRowData)
exportMethods(hasRowRanges)
exportMethods(intersectByRowData)
exportMethods(isEmpty)
exportMethods(length)
exportMethods(longForm)
Expand All @@ -79,6 +84,7 @@ exportMethods(sampleMap)
exportMethods(show)
exportMethods(showReplicated)
exportMethods(splitAssays)
exportMethods(subsetByRow)
exportMethods(updateObject)
import(BiocGenerics)
import(GenomicRanges)
Expand All @@ -90,7 +96,9 @@ importFrom(BiocBaseUtils,lifeCycle)
importFrom(BiocGenerics,colnames)
importFrom(BiocGenerics,longForm)
importFrom(BiocGenerics,rownames)
importFrom(MatrixGenerics,rowRanges)
importFrom(S4Vectors,"metadata<-")
importFrom(S4Vectors,metadata)
importFrom(SummarizedExperiment,rowData)
importFrom(methods,as)
importFrom(utils,.DollarNames)
3 changes: 2 additions & 1 deletion R/MultiAssayExperiment-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ NULL
#' diverse assays on a collection of specimen. Currently, the class can handle
#' assays that are organized instances of
#' [`SummarizedExperiment`][SummarizedExperiment::SummarizedExperiment-class],
#' [ExpressionSet][Biobase::ExpressionSet], `matrix`, `RaggedExperiment`
#' \code{\link[Biobase:ExpressionSet-class]{ExpressionSet}},
#' `matrix`, `RaggedExperiment`
#' (inherits from [`GRangesList`][GenomicRanges::GRangesList-class]), and
#' `RangedVcfStack`. Create new `MultiAssayExperiment` instances with the
#' homonymous constructor, minimally with the argument [`ExperimentList`],
Expand Down
47 changes: 46 additions & 1 deletion R/MultiAssayExperiment-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ NULL
#' that have a
#' [`rowRanges`][SummarizedExperiment::RangedSummarizedExperiment-class]
#' method
#' * hasRowData: A function that identifies ExperimentList elements
#' that have a
#' [`rowData`][SummarizedExperiment::SummarizedExperiment-class]
#' method
#' * getWithColData: A convenience function for extracting an assay
#' and associated colData
#' * renamePrimary: A convenience function to rename the primary
Expand Down Expand Up @@ -363,7 +367,7 @@ setMethod("mergeReplicates", "ANY",
#' @rdname MultiAssayExperiment-helpers
#'
#' @details The `longForm` "ANY" class method, works with classes such as
#' [`ExpressionSet`][Biobase::ExpressionSet] and
#' \code{\link[Biobase:ExpressionSet-class]{ExpressionSet}} and
#' [`SummarizedExperiment`][SummarizedExperiment::SummarizedExperiment-class] as
#' well as `matrix` to provide a consistent long and skinny
#' [`DataFrame`][S4Vectors::DataFrame-class].
Expand Down Expand Up @@ -599,6 +603,7 @@ wideFormat <- function(object, colDataCols = NULL, check.names = TRUE,

# hasRowRanges section ----------------------------------------------------

#' @importFrom MatrixGenerics rowRanges
.tryRowRanges <- function(obj) {
res <- try(rowRanges(obj), silent = TRUE)
if (!is(res, "try-error"))
Expand All @@ -625,6 +630,8 @@ setGeneric("hasRowRanges", function(x) standardGeneric("hasRowRanges"))
#' @details The `hasRowRanges` method identifies assays that support
#' a [`rowRanges`][SummarizedExperiment::RangedSummarizedExperiment-class]
#' method _and_ return a [`GRanges`][GenomicRanges::GRanges-class] object.
#'
#' @exportMethod hasRowRanges
setMethod("hasRowRanges", "MultiAssayExperiment", function(x) {
hasRowRanges(experiments(x))
})
Expand All @@ -635,6 +642,44 @@ setMethod("hasRowRanges", "ExperimentList", function(x) {
vapply(x, .tryRowRanges, logical(1L))
})

# hasRowData section ------------------------------------------------------

#' @importFrom SummarizedExperiment rowData
.tryRowData <- function(obj) {
res <- try(rowData(obj), silent = TRUE)
if (!is(res, "try-error"))
is(res, "DataFrame")
else
FALSE
}

#' @rdname MultiAssayExperiment-helpers
#'
#' @aliases hasRowData
#'
#' @details The `hasRowData` method identifies assays that support a
#' [`rowData`][SummarizedExperiment::SummarizedExperiment-class] method _and_
#' return a [`DataFrame`][S4Vectors::DataFrame-class] object.
#'
#' @export
setGeneric("hasRowData", function(x) standardGeneric("hasRowData"))

#' @describeIn MultiAssayExperiment-helpers The `hasRowData` method identifies
#' experiments that have a `rowData` method via direct testing
#'
#' @exportMethod hasRowData
setMethod("hasRowData", "MultiAssayExperiment", function(x) {
hasRowData(experiments(x))
})

#' @describeIn MultiAssayExperiment-helpers The `hasRowData` method identifies
#' experiments that have a `rowData` method via direct testing
#'
#' @exportMethod hasRowData
setMethod("hasRowData", "ExperimentList", function(x) {
vapply(x, .tryRowData, logical(1L))
})

#' @rdname MultiAssayExperiment-helpers
#'
#' @param mode String indicating how `MultiAssayExperiment`
Expand Down
2 changes: 1 addition & 1 deletion R/longFormat-deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' future release. Please use the `longForm` method instead.
#'
#' @details The `longFormat` "ANY" class method, works with classes such as
#' [`ExpressionSet`][Biobase::ExpressionSet] and
#' \code{\link[Biobase:ExpressionSet-class]{ExpressionSet}} and
#' [`SummarizedExperiment`][SummarizedExperiment::SummarizedExperiment-class] as
#' well as `matrix` to provide a consistent long and skinny
#' [`DataFrame`][S4Vectors::DataFrame-class].
Expand Down
Loading
Loading