Skip to content

Commit

Permalink
Merge pull request #94 from acidgenomics/master
Browse files Browse the repository at this point in the history
v0.4.11
  • Loading branch information
mjsteinbaugh authored May 12, 2020
2 parents 2912eab + 6634c00 commit c8dce2f
Show file tree
Hide file tree
Showing 38 changed files with 1,122 additions and 722 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ jobs:
include:
- stage: test
name: "bioc-release"
script: image="acidgenomics/bcbiosinglecell" tag="bioc-release" ./.Rcheck/docker
script: image="acidgenomics/r-bcbiosinglecell" tag="bioc-release" ./.Rcheck/docker
- stage: test
name: "bioc-oldrel"
script: image="acidgenomics/r-bcbiosinglecell" tag="bioc-oldrel" ./.Rcheck/docker
- stage: test
name: "bioc-devel"
script: image="acidgenomics/bcbiosinglecell" tag="bioc-devel" ./.Rcheck/docker
script: image="acidgenomics/r-bcbiosinglecell" tag="bioc-devel" ./.Rcheck/docker
allow_failures:
- name: "bioc-devel"
fast_finish: true
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: bcbioSingleCell
Title: bcbio Single-Cell RNA-Seq
Description: R package for bcbio single-cell RNA-seq analysis.
Version: 0.4.10
Date: 2020-02-24
Version: 0.4.11
Date: 2020-05-11
Authors@R: c(
person(
given = "Michael",
Expand Down Expand Up @@ -98,4 +98,4 @@ biocViews:
RNASeq,
SingleCell
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.0.2
RoxygenNote: 7.1.0
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## bcbioSingleCell 0.4.11 (2020-05-11)

### Minor changes

- `updateObject`: Bug fix release for breaking changes introduced by `colData<-`
assignment on `SingleCellExperiment` / `SummarizedExperiment` expecting
`check = FALSE` support for downstream `updateObject` call. Added `...`
passthrough that prevents this error in method support for `bcbioSingleCell`
class. This should now be fully compliant with R 4.0 / Bioconductor 3.11
release.
- `updateObject`: Added `verbose` argument support, defaulting now to `FALSE`.

## bcbioSingleCell 0.4.10 (2020-02-24)

### Minor changes
Expand Down
135 changes: 93 additions & 42 deletions R/updateObject-methods.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @name updateObject
#' @author Michael Steinbaugh
#' @note Updated 2020-02-24.
#' @note Updated 2020-05-11.
#'
#' @inherit BiocGenerics::updateObject
#' @inheritParams acidroxygen::params
Expand All @@ -22,32 +22,43 @@ NULL



## Updated 2020-01-20.
## Updated 2020-05-11.
`updateObject,bcbioSingleCell` <- # nolint
function(object) {
cli_h1("Update object")
function(object, ..., verbose = FALSE) {
assert(isFlag(verbose))
if (isTRUE(verbose)) {
cli_h1("Update object")
}
sce <- as(object, "SingleCellExperiment")
cells <- colnames(sce)
assays <- assays(sce)
colData <- colData(sce)
metadata <- metadata(sce)
version <- metadata[["version"]]
assert(is(version, c("package_version", "numeric_version")))
cli_text(sprintf(
fmt = "Upgrading {.var bcbioSingleCell} from version %s to %s.",
as.character(version),
as.character(.version)
))
if (isTRUE(verbose)) {
cli_text(sprintf(
fmt = "Upgrading {.var bcbioSingleCell} from version %s to %s.",
as.character(version),
as.character(.version)
))
}

## Assays --------------------------------------------------------------
cli_h2("Assays")
if (isTRUE(verbose)) {
cli_h2("Assays")
}
## Ensure raw counts are always named "counts".
if ("assay" %in% names(assays)) {
## Versions < 0.1 (e.g. 0.0.21).
cli_alert("Renaming {.var assay} to {.var counts}.")
if (isTRUE(verbose)) {
cli_alert("Renaming {.var assay} to {.var counts}.")
}
names(assays)[names(assays) == "assay"] <- "counts"
} else if ("raw" %in% names(assays)) {
cli_alert("Renaming {.var raw} assay to {.var counts}.")
if (isTRUE(verbose)) {
cli_alert("Renaming {.var raw} assay to {.var counts}.")
}
names(assays)[names(assays) == "raw"] <- "counts"
}
assays <- Filter(Negate(is.null), assays)
Expand All @@ -56,21 +67,31 @@ NULL
assert(isSubset(requiredAssays, names(assays)))

## Column data metrics -------------------------------------------------
cli_h2("Column data")
if (isTRUE(verbose)) {
cli_h2("Column data")
}
## Update legacy column names.
if (isSubset(c("nCount", "nUMI"), colnames(colData))) {
cli_alert("Renaming {.var nCount} to {.var nRead}.")
if (isTRUE(verbose)) {
cli_alert("Renaming {.var nCount} to {.var nRead}.")
}
colnames(colData)[colnames(colData) == "nCount"] <- "nRead"
cli_alert("Renaming {.var nUMI} to {.var nCount}.")
if (isTRUE(verbose)) {
cli_alert("Renaming {.var nUMI} to {.var nCount}.")
}
colnames(colData)[colnames(colData) == "nUMI"] <- "nCount"
}
if (isSubset("nGene", colnames(colData))) {
cli_alert("Renaming {.var nGene} to {.var nFeature}.")
if (isTRUE(verbose)) {
cli_alert("Renaming {.var nGene} to {.var nFeature}.")
}
colnames(colData)[colnames(colData) == "nGene"] <- "nFeature"
cli_alert(paste(
"Renaming {.var log10GenesPerUMI} to",
"{.var log10FeaturesPerCount}."
))
if (isTRUE(verbose)) {
cli_alert(paste(
"Renaming {.var log10GenesPerUMI} to",
"{.var log10FeaturesPerCount}."
))
}
colnames(colData)[colnames(colData) == "log10GenesPerUMI"] <-
"log10FeaturesPerCount"
}
Expand All @@ -84,10 +105,12 @@ NULL
sampleData <- NULL
}
if (!is.null(sampleData)) {
cli_alert(paste(
"Moving {.var sampleData} from {.fun metadata} into",
"{.fun colData}."
))
if (isTRUE(verbose)) {
cli_alert(paste(
"Moving {.var sampleData} from {.fun metadata} into",
"{.fun colData}."
))
}
assert(isSubset("sampleID", colnames(sampleData)))
## Starting using `DataFrame` in place of `data.frame` in v0.1.7.
sampleData <- as(sampleData, "DataFrame")
Expand All @@ -96,7 +119,9 @@ NULL
setdiff(colnames(colData), colnames(sampleData)),
drop = FALSE
]
cli_alert("Mapping cells to samples.")
if (isTRUE(verbose)) {
cli_alert("Mapping cells to samples.")
}
cell2sample <- mapCellsToSamples(
cells = cells,
samples = as.character(sampleData[["sampleID"]])
Expand All @@ -114,26 +139,34 @@ NULL
}

## Metadata ------------------------------------------------------------
cli_h2("Metadata")
if (isTRUE(verbose)) {
cli_h2("Metadata")
}
## dataVersions
dataVersions <- metadata[["dataVersions"]]
if (is(dataVersions, "data.frame")) {
cli_alert("Setting {.var dataVersions} as {.var DataFrame}.")
if (isTRUE(verbose)) {
cli_alert("Setting {.var dataVersions} as {.var DataFrame}.")
}
metadata[["dataVersions"]] <- as(dataVersions, "DataFrame")
}
## ensemblRelease
if ("ensemblVersion" %in% names(metadata)) {
cli_alert(
"Renaming {.var ensemblVersion} to {.var ensemblRelease}."
)
if (isTRUE(verbose)) {
cli_alert(
"Renaming {.var ensemblVersion} to {.var ensemblRelease}."
)
}
names(metadata)[
names(metadata) == "ensemblVersion"] <- "ensemblRelease"
}
if (
is.numeric(metadata[["ensemblRelease"]]) &&
!is.integer(metadata[["ensemblRelease"]])
) {
cli_alert("Setting {.var ensemblRelease} as integer.")
if (isTRUE(verbose)) {
cli_alert("Setting {.var ensemblRelease} as integer.")
}
metadata[["ensemblRelease"]] <-
as.integer(metadata[["ensemblRelease"]])
}
Expand All @@ -144,27 +177,37 @@ NULL
}
## gffFile
if ("gtfFile" %in% names(metadata)) {
cli_alert("Renaming {.var gtfFile} to {.var gffFile}.")
if (isTRUE(verbose)) {
cli_alert("Renaming {.var gtfFile} to {.var gffFile}.")
}
names(metadata)[names(metadata) == "gtfFile"] <- "gffFile"
}
if (!"gffFile" %in% names(metadata)) {
cli_alert("Setting {.var gffFile} as empty character.")
if (isTRUE(verbose)) {
cli_alert("Setting {.var gffFile} as empty character.")
}
metadata[["gffFile"]] <- character()
}
## lanes
if (!is.integer(metadata[["lanes"]])) {
cli_alert("Setting {.var lanes} as integer.")
if (isTRUE(verbose)) {
cli_alert("Setting {.var lanes} as integer.")
}
metadata[["lanes"]] <- as.integer(metadata[["lanes"]])
}
## level
if (!"level" %in% names(metadata)) {
cli_alert("Setting {.var level} as genes.")
if (isTRUE(verbose)) {
cli_alert("Setting {.var level} as genes.")
}
metadata[["level"]] <- "genes"
}
## programVersions
if (!"programVersions" %in% names(metadata) &&
"programs" %in% names(metadata)) {
cli_alert("Renaming {.var programs} to {.var programVersions}.")
if (isTRUE(verbose)) {
cli_alert("Renaming {.var programs} to {.var programVersions}.")
}
names(metadata)[names(metadata) == "programs"] <- "programVersions"
}
programVersions <- metadata[["programVersions"]]
Expand All @@ -173,14 +216,20 @@ NULL
}
## sampleMetadataFile
if (!is.character(metadata[["sampleMetadataFile"]])) {
cli_alert("Setting {.var sampleMetadataFile} as empty character.")
if (isTRUE(verbose)) {
cli_alert(
"Setting {.var sampleMetadataFile} as empty character."
)
}
metadata[["sampleMetadataFile"]] <- character()
}
## sessionInfo
## Support for legacy devtoolsSessionInfo stash.
## Previously, we stashed both devtools* and utils* variants.
if ("devtoolsSessionInfo" %in% names(metadata)) {
cli_alert("Simplifying stashed {.var sessionInfo}.")
if (isTRUE(verbose)) {
cli_alert("Simplifying stashed {.var sessionInfo}.")
}
names(metadata)[
names(metadata) == "devtoolsSessionInfo"] <- "sessionInfo"
metadata[["utilsSessionInfo"]] <- NULL
Expand All @@ -198,10 +247,12 @@ NULL
metadata(sce) <- metadata
bcb <- new(Class = "bcbioSingleCell", sce)
validObject(bcb)
cat_line()
cli_alert_success(
"Update of {.var bcbioSingleCell} object was successful."
)
if (isTRUE(verbose)) {
cat_line()
cli_alert_success(
"Update of {.var bcbioSingleCell} object was successful."
)
}
bcb
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Repo status: active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Travis CI build status](https://travis-ci.org/hbc/bcbioSingleCell.svg?branch=master)](https://travis-ci.org/hbc/bcbioSingleCell)
[![AppVeyor CI build status](https://ci.appveyor.com/api/projects/status/npy0mhfjn9saqv4g/branch/master?svg=true)](https://ci.appveyor.com/project/mjsteinbaugh/bcbiosinglecell/branch/master)
[![Anaconda version](https://anaconda.org/bioconda/r-bcbiosinglecell/badges/version.svg) ![Anaconda latest release date](https://anaconda.org/bioconda/r-bcbiosinglecell/badges/latest_release_date.svg) ![Anaconda downloads](https://anaconda.org/bioconda/r-bcbiosinglecell/badges/downloads.svg)](https://anaconda.org/bioconda/r-bcbiosinglecell)
[![Install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/r-bcbiosinglecell/README.html)

[R][] package for [bcbio][] single-cell RNA-seq analysis.

Expand Down
34 changes: 22 additions & 12 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c8dce2f

Please sign in to comment.