Create a Raw object
Active bindings
X
Data matrix of shape
n_obs
×n_vars
.n_obs
Number of observations.
obs_names
Names of observations.
n_vars
Number of variables.
var
One-dimensional annotation of variables (data.frame).
var_names
Names of variables.
varm
Multi-dimensional annotation of variables (matrix).
Stores for each key a two or higher-dimensional matrix with
n_var
rows.shape
Shape of data matrix (
n_obs
,n_vars
).
Methods
Method to_adata()
Create a full AnnData object
Examples
\dontrun{
ad <- AnnData(
X = matrix(c(0, 1, 2, 3), nrow = 2),
obs = data.frame(group = c("a", "b"), row.names = c("s1", "s2")),
var = data.frame(type = c(1L, 2L), row.names = c("var1", "var2")),
layers = list(
spliced = matrix(c(4, 5, 6, 7), nrow = 2),
unspliced = matrix(c(8, 9, 10, 11), nrow = 2)
)
)
ad$raw <- ad
ad$raw$to_adata()
}
Method print()
Print Raw object
Examples
\dontrun{
ad <- AnnData(
X = matrix(c(0, 1, 2, 3), nrow = 2),
obs = data.frame(group = c("a", "b"), row.names = c("s1", "s2")),
var = data.frame(type = c(1L, 2L), row.names = c("var1", "var2")),
layers = list(
spliced = matrix(c(4, 5, 6, 7), nrow = 2),
unspliced = matrix(c(8, 9, 10, 11), nrow = 2)
),
obsm = list(
ones = matrix(rep(1L, 10), nrow = 2),
rand = matrix(rnorm(6), nrow = 2),
zeros = matrix(rep(0L, 10), nrow = 2)
),
varm = list(
ones = matrix(rep(1L, 10), nrow = 2),
rand = matrix(rnorm(6), nrow = 2),
zeros = matrix(rep(0L, 10), nrow = 2)
),
uns = list(a = 1, b = 2, c = list(c.a = 3, c.b = 4))
)
ad$raw <- ad
library(reticulate)
sc <- import("scanpy")
sc$pp$normalize_per_cell(ad)
ad[]
ad$raw[]
ad$print()
print(ad)
}
Examples
if (FALSE) { # \dontrun{
ad <- AnnData(
X = matrix(c(0, 1, 2, 3), nrow = 2),
obs = data.frame(group = c("a", "b"), row.names = c("s1", "s2")),
var = data.frame(type = c(1L, 2L), row.names = c("var1", "var2")),
layers = list(
spliced = matrix(c(4, 5, 6, 7), nrow = 2),
unspliced = matrix(c(8, 9, 10, 11), nrow = 2)
),
obsm = list(
ones = matrix(rep(1L, 10), nrow = 2),
rand = matrix(rnorm(6), nrow = 2),
zeros = matrix(rep(0L, 10), nrow = 2)
),
varm = list(
ones = matrix(rep(1L, 10), nrow = 2),
rand = matrix(rnorm(6), nrow = 2),
zeros = matrix(rep(0L, 10), nrow = 2)
),
uns = list(a = 1, b = 2, c = list(c.a = 3, c.b = 4))
)
ad$raw <- ad
library(reticulate)
sc <- import("scanpy")
sc$pp$normalize_per_cell(ad)
ad[]
ad$raw[]
} # }
## ------------------------------------------------
## Method `RawR6$copy`
## ------------------------------------------------
if (FALSE) { # \dontrun{
ad <- AnnData(
X = matrix(c(0, 1, 2, 3), nrow = 2)
)
ad$copy()
ad$copy("file.h5ad")
} # }
## ------------------------------------------------
## Method `RawR6$to_adata`
## ------------------------------------------------
if (FALSE) { # \dontrun{
ad <- AnnData(
X = matrix(c(0, 1, 2, 3), nrow = 2),
obs = data.frame(group = c("a", "b"), row.names = c("s1", "s2")),
var = data.frame(type = c(1L, 2L), row.names = c("var1", "var2")),
layers = list(
spliced = matrix(c(4, 5, 6, 7), nrow = 2),
unspliced = matrix(c(8, 9, 10, 11), nrow = 2)
)
)
ad$raw <- ad
ad$raw$to_adata()
} # }
## ------------------------------------------------
## Method `RawR6$print`
## ------------------------------------------------
if (FALSE) { # \dontrun{
ad <- AnnData(
X = matrix(c(0, 1, 2, 3), nrow = 2),
obs = data.frame(group = c("a", "b"), row.names = c("s1", "s2")),
var = data.frame(type = c(1L, 2L), row.names = c("var1", "var2")),
layers = list(
spliced = matrix(c(4, 5, 6, 7), nrow = 2),
unspliced = matrix(c(8, 9, 10, 11), nrow = 2)
),
obsm = list(
ones = matrix(rep(1L, 10), nrow = 2),
rand = matrix(rnorm(6), nrow = 2),
zeros = matrix(rep(0L, 10), nrow = 2)
),
varm = list(
ones = matrix(rep(1L, 10), nrow = 2),
rand = matrix(rnorm(6), nrow = 2),
zeros = matrix(rep(0L, 10), nrow = 2)
),
uns = list(a = 1, b = 2, c = list(c.a = 3, c.b = 4))
)
ad$raw <- ad
library(reticulate)
sc <- import("scanpy")
sc$pp$normalize_per_cell(ad)
ad[]
ad$raw[]
ad$print()
print(ad)
} # }