Autopad zeros

autopadZeros(object, ...)

# S4 method for character
autopadZeros(object)

# S4 method for matrix
autopadZeros(object, rownames = FALSE,
  colnames = TRUE, sort = TRUE)

# S4 method for SummarizedExperiment
autopadZeros(object, rownames = FALSE,
  colnames = TRUE, sort = TRUE)

Arguments

object

Object.

rownames

logical(1). Apply to row names.

colnames

logical(1). Apply to column names.

sort

logical(1). Resort using sort.

...

Additional arguments.

Value

character.

Note

For methods on objects supporting dim() (e.g. matrix), the object will be returned with the rows and/or columns resorted by default. This does not apply to the character method.

Updated 2019-07-28.

SummarizedExperiment sample names

If sampleName column is defined in colData(), these values will also get padded, if necessary. This improves # downstream handling in functions that rely on this feature.

Examples

data( RangedSummarizedExperiment, SingleCellExperiment, package = "acidtest" ) rse <- RangedSummarizedExperiment sce <- SingleCellExperiment ## character ==== autopadZeros(c("A1", "B10"))
#> [1] "A01" "B10"
autopadZeros(c("A1", "B10", "C100"))
#> [1] "A001" "B010" "C100"
## SummarizedExperiment ==== autopadZeros(rse, rownames = TRUE, colnames = TRUE)
#> class: RangedSummarizedExperiment #> dim: 500 12 #> metadata(3): version date interestingGroups #> assays(1): counts #> rownames(500): gene001 gene002 ... gene499 gene500 #> rowData names(8): broadClass description ... geneName seqCoordSystem #> colnames(12): sample01 sample02 ... sample11 sample12 #> colData names(1): condition
## SingleCellExperiment ==== autopadZeros(sce, rownames = TRUE, colnames = TRUE)
#> class: SingleCellExperiment #> dim: 500 100 #> metadata(1): date #> assays(1): counts #> rownames(500): gene001 gene002 ... gene499 gene500 #> rowData names(8): broadClass description ... geneName seqCoordSystem #> colnames(100): cell001 cell002 ... cell099 cell100 #> colData names(1): sampleID #> reducedDimNames(0): #> spikeNames(0):