Skip to content

Commit c297f30

Browse files
committed
delete accessors
1 parent b9b2fc0 commit c297f30

File tree

3 files changed

+10
-748
lines changed

3 files changed

+10
-748
lines changed

R/helpers.R

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -62,89 +62,6 @@ returnNumMat <- function(object) {
6262
return(objectUpdated)
6363
}
6464

65-
#' Check if `barbieQ` object is in right format
66-
#'
67-
#' `checkBarbieQDimensions()` ensures that the `proportion`, `CPM`, `occurrence`,
68-
#' and `rank` components of `barbieQ` have the same number of samples and
69-
#' Barcodes as `assay`.
70-
#'
71-
#' @param barbieQ A `barbieQ` object created by the [createBarbieQ] function.
72-
#'
73-
#' @return a logical value
74-
#' * Returns TRUE if components in the `barbieQ` object are correctly formatted.
75-
#' * Otherwise, the function throws an error with specific a reason.
76-
#'
77-
#' @noRd
78-
#'
79-
#' @examples \donttest{
80-
#' Treat <- factor(rep(seq_len(2), each = 6))
81-
#' Time <- rep(rep(seq_len(2), each = 3), 2)
82-
#' nbarcodes <- 50
83-
#' nsamples <- 12
84-
#' count <- abs(matrix(rnorm(nbarcodes * nsamples), nbarcodes, nsamples))
85-
#' rownames(count) <- paste0('Barcode', seq_len(nbarcodes))
86-
#' barbieQ <- createBarbieQ(count, data.frame(Treat = Treat, Time = Time))
87-
#' barbieQ:::checkBarbieQDimensions(barbieQ)
88-
#' }
89-
checkBarbieQDimensions <- function(barbieQ) {
90-
## check barbieQ$assay's format
91-
if (is.data.frame(barbieQ$assay) || is.matrix(barbieQ$assay)) {
92-
NumDim <- dim(barbieQ$assay)
93-
} else {
94-
stop("barbieQ$assay wrong format.
95-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
96-
}
97-
## check barbieQ$metadata's format and dimension
98-
if (is.data.frame(barbieQ$metadata) || is.matrix(barbieQ$metadata)) {
99-
if (nrow(barbieQ$metadata) != NumDim[2]) {
100-
stop("row dimension of barbieQ$metadata doesn't match column dimention of barbieQ$assay.
101-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
102-
}
103-
} else {
104-
stop("BarbieQ$assay wrong format.
105-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
106-
}
107-
## check other components' format dimensions
108-
elements <- c("proportion", "CPM", "occurrence", "rank")
109-
for (elem in elements) {
110-
if (is.data.frame(barbieQ[[elem]]) || is.matrix(barbieQ[[elem]])) {
111-
elemDim <- dim(barbieQ[[elem]])
112-
if (any(elemDim != NumDim)) {
113-
stop("dimensions of barbieQ component-", elem, "don't match dimentions of barbieQ$assay.
114-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
115-
}
116-
} else {
117-
stop("barbieQ component-", elem, " isn't in right format.
118-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
119-
}
120-
}
121-
## check barbieQ$isTop format and dimensions
122-
if (!is.null(barbieQ$isTop$vec)) {
123-
if (is.vector(barbieQ$isTop$vec)) {
124-
if (length(barbieQ$isTop$vec) != NumDim[1]) {
125-
stop("length of barbieQ$isTop$vec doesn't match row dimention of barbieQ$assay.
126-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
127-
}
128-
} else {
129-
stop("BarbieQ$isTop$vec isn't in right format.
130-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
131-
}
132-
}
133-
if (!is.null(barbieQ$isTop$mat)) {
134-
if (is.matrix(barbieQ$isTop$mat) || is.data.frame(barbieQ$isTop$mat)) {
135-
if (nrow(barbieQ$isTop$mat) != NumDim[1]) {
136-
stop("row dimension barbieQ$isTop$mat doesn't match row dimention of barbieQ$assay.
137-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand.")
138-
}
139-
} else {
140-
stop("barbieQ$isTop$mat isn't in right format.
141-
call createBarbieQ() to generate proper `barbieQ` object - don't modify by hand..")
142-
}
143-
}
144-
145-
return(TRUE)
146-
}
147-
14865
#' Extract sampleMetadata and primary factor
14966
#'
15067
#' `extractSampleMetadataAndPrimaryFactor()` extracts sampleMetadata `data.frame` from the

0 commit comments

Comments
 (0)