I would like to normalize the data in a seurat object using TPM Normalization. For this I need to extract the count matrix from the seurat object. Thus need help on this aspect.
I used the following code to execute the same:
Brain_Tumor_3p_filtered_feature_bc_matrix_seurat <- NormalizeTPM(Brain_Tumor_3p_filtered_feature_bc_matrix_seurat, sce = NULL, tr_length = NULL, log = FALSE,scale = 1, pseudo.count = log(0))
But it gives me the following error:
Converting input to matrix.
Error in as.vector(data) :
no method for coercing this S4 class to a vector
I tried to convert my Seurat object to SingleCellExperiment beforehand and run:
Brain_Tumor_3p_filtered_feature_bc_matrix_seurat_SingleCellExperiment<-as.SingleCellExperiment(Brain_Tumor_3p_filtered_feature_bc_matrix_seurat)
NormalizeTPM(sce=Brain_Tumor_3p_filtered_feature_bc_matrix_seurat_SingleCellExperiment, tr_length = NULL, log = FALSE,scale = 1, pseudo.count = log(0))
This still produces an error:
Error in `assays<-`(`*tmp*`, withDimnames = withDimnames, ..., value = `*vtmp*`) :
please use 'assay(x, withDimnames=FALSE)) <- value' or 'assays(x, withDimnames=FALSE)) <- value'
when the rownames or colnames of the supplied assay(s) are not identical to those of the
receiving SingleCellExperiment object 'x'
Find a sample of the data here:
dput(Brain_Tumor_3p_filtered_feature_bc_matrix_seurat[1:20,1:20])
new("Seurat", assays = list(RNA = new("Assay", counts = new("dgCMatrix",
i = c(3L, 8L, 12L, 13L, 14L, 5L, 8L, 13L, 14L, 3L, 8L, 13L,
14L, 8L, 9L, 18L, 3L, 8L, 14L, 8L, 8L, 13L, 15L, 1L, 4L,
8L, 11L, 12L, 13L, 15L, 8L, 13L, 14L, 1L, 3L, 8L, 13L, 14L,
15L, 8L, 13L, 2L, 8L, 13L, 14L, 1L, 8L, 14L, 8L, 8L, 3L,
8L, 12L, 13L, 14L, 3L, 8L, 13L, 14L, 3L, 8L, 1L), p = c(0L,
5L, 9L, 13L, 16L, 19L, 20L, 23L, 30L, 30L, 33L, 39L, 41L,
45L, 48L, 49L, 50L, 55L, 59L, 61L, 62L), Dim = c(20L, 20L
), Dimnames = list(c("AL627309.5", "LINC01409", "FAM87B",
"LINC01128", "LINC00115", "FAM41C", "AL645608.2", "SAMD11",
"NOC2L", "KLHL17", "PLEKHN1", "PERM1", "AL645608.7", "HES4",
"ISG15", "AGRN", "C1orf159", "TTLL10", "TNFRSF18", "TNFRSF4"
), c("AAACGAAAGAGAACCC-1", "AAACGCTGTACGCTAT-1", "AAAGGGCAGTAACCGG-1",
"AAATGGAAGTACCCTA-1", "AACAACCTCCCTCGAT-1", "AACAAGAGTCAGATTC-1",
"AACAGGGAGGTGCATG-1", "AACCAACAGAAATGGG-1", "AACCACAAGTTACGTC-1",
"AACCACACAAATGCGG-1", "AACCACACACCAGTAT-1", "AACCACATCCCGTTGT-1",
"AACCATGCATGACAGG-1", "AACCTGAAGGTAGATT-1", "AACCTTTTCCGCAACG-1",
"AAGAACAGTCGTTGGC-1", "AAGCGAGGTCGCGTTG-1", "AAGCGAGTCTAAGCCA-1",
"AAGCGTTAGAGAGCAA-1", "AAGCGTTAGCCTGTGC-1")), x = c(1, 1,
1, 2, 3, 1, 1, 1, 4, 1, 1, 3, 4, 2, 1, 1, 2, 1, 1, 2, 1,
2, 2, 1, 1, 2, 1, 1, 10, 1, 2, 1, 5, 3, 1, 5, 2, 6, 2, 1,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 20, 2, 1, 3, 2, 1,
1, 3, 1), factors = list()), data = new("dgCMatrix", i = c(3L,
8L, 12L, 13L, 14L, 5L, 8L, 13L, 14L, 3L, 8L, 13L, 14L, 8L, 9L,
18L, 3L, 8L, 14L, 8L, 8L, 13L, 15L, 1L, 4L, 8L, 11L, 12L, 13L,
15L, 8L, 13L, 14L, 1L, 3L, 8L, 13L, 14L, 15L, 8L, 13L, 2L, 8L,
13L, 14L, 1L, 8L, 14L, 8L, 8L, 3L, 8L, 12L, 13L, 14L, 3L, 8L,
13L, 14L, 3L, 8L, 1L), p = c(0L, 5L, 9L, 13L, 16L, 19L, 20L,
23L, 30L, 30L, 33L, 39L, 41L, 45L, 48L, 49L, 50L, 55L, 59L, 61L,
62L), Dim = c(20L, 20L), Dimnames = list(c("AL627309.5", "LINC01409",
"FAM87B", "LINC01128", "LINC00115", "FAM41C", "AL645608.2", "SAMD11",
"NOC2L", "KLHL17", "PLEKHN1", "PERM1", "AL645608.7", "HES4",
"ISG15", "AGRN", "C1orf159", "TTLL10", "TNFRSF18", "TNFRSF4"),
c("AAACGAAAGAGAACCC-1", "AAACGCTGTACGCTAT-1", "AAAGGGCAGTAACCGG-1",
"AAATGGAAGTACCCTA-1", "AACAACCTCCCTCGAT-1", "AACAAGAGTCAGATTC-1",
"AACAGGGAGGTGCATG-1", "AACCAACAGAAATGGG-1", "AACCACAAGTTACGTC-1",
"AACCACACAAATGCGG-1", "AACCACACACCAGTAT-1", "AACCACATCCCGTTGT-1",
"AACCATGCATGACAGG-1", "AACCTGAAGGTAGATT-1", "AACCTTTTCCGCAACG-1",
"AAGAACAGTCGTTGGC-1", "AAGCGAGGTCGCGTTG-1", "AAGCGAGTCTAAGCCA-1",
"AAGCGTTAGAGAGCAA-1", "AAGCGTTAGCCTGTGC-1")), x = c(1, 1,
1, 2, 3, 1, 1, 1, 4, 1, 1, 3, 4, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2,
1, 1, 2, 1, 1, 10, 1, 2, 1, 5, 3, 1, 5, 2, 6, 2, 1, 1, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 20, 2, 1, 3, 2, 1, 1, 3, 1), factors = list()),
scale.data = structure(numeric(0), .Dim = c(0L, 0L)), key = "rna_",
assay.orig = NULL, var.features = character(0), meta.features = structure(list(), .Names = character(0), row.names = c("AL627309.5",
"LINC01409", "FAM87B", "LINC01128", "LINC00115", "FAM41C",
"AL645608.2", "SAMD11", "NOC2L", "KLHL17", "PLEKHN1", "PERM1",
"AL645608.7", "HES4", "ISG15", "AGRN", "C1orf159", "TTLL10",
"TNFRSF18", "TNFRSF4"), class = "data.frame"), misc = list())),
meta.data = structure(list(orig.ident = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), .Label = "Brain_Tumor_3p_raw_feature_bc_matrix", class = "factor"),
nCount_RNA = c(8, 7, 9, 4, 4, 2, 5, 17, 0, 8, 19, 2,
5, 3, 1, 1, 26, 7, 4, 1), nFeature_RNA = c(5L, 4L, 4L,
3L, 3L, 1L, 3L, 7L, 0L, 3L, 6L, 2L, 4L, 3L, 1L, 1L, 5L,
4L, 2L, 1L), percent.Brain_Tumor_3p_filtered_feature_bc_matrix_seurat = c(5.73453284414736,
6.01779506968141, 3.55912743972445, 4.50131444820001,
1.02573056022348, 4.88421052631579, 3.52807510614124,
1.07083296761169, 9.39285409738211, 6.73866576667792,
4.57610789980732, 0.617430539064355, 6.66001496632577,
2.96102465225176, 4.46445802508845, 4.89557004123986,
7.83134851813312, 2.82530215036886, 5.54443053817272,
2.95155221072437)), row.names = c("AAACGAAAGAGAACCC-1",
"AAACGCTGTACGCTAT-1", "AAAGGGCAGTAACCGG-1", "AAATGGAAGTACCCTA-1",
"AACAACCTCCCTCGAT-1", "AACAAGAGTCAGATTC-1", "AACAGGGAGGTGCATG-1",
"AACCAACAGAAATGGG-1", "AACCACAAGTTACGTC-1", "AACCACACAAATGCGG-1",
"AACCACACACCAGTAT-1", "AACCACATCCCGTTGT-1", "AACCATGCATGACAGG-1",
"AACCTGAAGGTAGATT-1", "AACCTTTTCCGCAACG-1", "AAGAACAGTCGTTGGC-1",
"AAGCGAGGTCGCGTTG-1", "AAGCGAGTCTAAGCCA-1", "AAGCGTTAGAGAGCAA-1",
"AAGCGTTAGCCTGTGC-1"), class = "data.frame"), active.assay = "RNA",
active.ident = structure(c(`AAACGAAAGAGAACCC-1` = 1L, `AAACGCTGTACGCTAT-1` = 1L,
`AAAGGGCAGTAACCGG-1` = 1L, `AAATGGAAGTACCCTA-1` = 1L, `AACAACCTCCCTCGAT-1` = 1L,
`AACAAGAGTCAGATTC-1` = 1L, `AACAGGGAGGTGCATG-1` = 1L, `AACCAACAGAAATGGG-1` = 1L,
`AACCACAAGTTACGTC-1` = 1L, `AACCACACAAATGCGG-1` = 1L, `AACCACACACCAGTAT-1` = 1L,
`AACCACATCCCGTTGT-1` = 1L, `AACCATGCATGACAGG-1` = 1L, `AACCTGAAGGTAGATT-1` = 1L,
`AACCTTTTCCGCAACG-1` = 1L, `AAGAACAGTCGTTGGC-1` = 1L, `AAGCGAGGTCGCGTTG-1` = 1L,
`AAGCGAGTCTAAGCCA-1` = 1L, `AAGCGTTAGAGAGCAA-1` = 1L, `AAGCGTTAGCCTGTGC-1` = 1L
), .Label = "Brain_Tumor_3p_raw_feature_bc_matrix", class = "factor"),
graphs = list(), neighbors = list(), reductions = list(),
images = list(), project.name = "Brain_Tumor_3p_raw_feature_bc_matrix",
misc = list(), version = structure(list(c(4L, 1L, 0L)), class = c("package_version",
"numeric_version")), commands = list(), tools = list())
EDIT: I've added the sample of my seurat object for further idea into the dataset.
It appears @Basti is spot on with his observation of dropped rows.
You can always pad your TPM matrix with NaN and add it to the Seurat
object as an assay, if that is what you want. Alternatively, you could filter the Seurat
object to keep only the rows present in the TPM matrix and re-run.
Below is an example padding the missing data in the TPM matrix with NaN, as well as the alternative subsetting method:
library(Seurat)
#> Attaching SeuratObject
#> Attaching sp
library(ADImpute)
Brain_Tumor_3p_filtered_feature_bc_matrix_seurat <- new("Seurat", assays = list(RNA = new("Assay", counts = new("dgCMatrix",
i = c(3L, 8L, 12L, 13L, 14L, 5L, 8L, 13L, 14L, 3L, 8L, 13L,
14L, 8L, 9L, 18L, 3L, 8L, 14L, 8L, 8L, 13L, 15L, 1L, 4L,
8L, 11L, 12L, 13L, 15L, 8L, 13L, 14L, 1L, 3L, 8L, 13L, 14L,
15L, 8L, 13L, 2L, 8L, 13L, 14L, 1L, 8L, 14L, 8L, 8L, 3L,
8L, 12L, 13L, 14L, 3L, 8L, 13L, 14L, 3L, 8L, 1L), p = c(0L,
5L, 9L, 13L, 16L, 19L, 20L, 23L, 30L, 30L, 33L, 39L, 41L,
45L, 48L, 49L, 50L, 55L, 59L, 61L, 62L), Dim = c(20L, 20L
), Dimnames = list(c("AL627309.5", "LINC01409", "FAM87B",
"LINC01128", "LINC00115", "FAM41C", "AL645608.2", "SAMD11",
"NOC2L", "KLHL17", "PLEKHN1", "PERM1", "AL645608.7", "HES4",
"ISG15", "AGRN", "C1orf159", "TTLL10", "TNFRSF18", "TNFRSF4"
), c("AAACGAAAGAGAACCC-1", "AAACGCTGTACGCTAT-1", "AAAGGGCAGTAACCGG-1",
"AAATGGAAGTACCCTA-1", "AACAACCTCCCTCGAT-1", "AACAAGAGTCAGATTC-1",
"AACAGGGAGGTGCATG-1", "AACCAACAGAAATGGG-1", "AACCACAAGTTACGTC-1",
"AACCACACAAATGCGG-1", "AACCACACACCAGTAT-1", "AACCACATCCCGTTGT-1",
"AACCATGCATGACAGG-1", "AACCTGAAGGTAGATT-1", "AACCTTTTCCGCAACG-1",
"AAGAACAGTCGTTGGC-1", "AAGCGAGGTCGCGTTG-1", "AAGCGAGTCTAAGCCA-1",
"AAGCGTTAGAGAGCAA-1", "AAGCGTTAGCCTGTGC-1")), x = c(1, 1,
1, 2, 3, 1, 1, 1, 4, 1, 1, 3, 4, 2, 1, 1, 2, 1, 1, 2, 1,
2, 2, 1, 1, 2, 1, 1, 10, 1, 2, 1, 5, 3, 1, 5, 2, 6, 2, 1,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 20, 2, 1, 3, 2, 1,
1, 3, 1), factors = list()), data = new("dgCMatrix", i = c(3L,
8L, 12L, 13L, 14L, 5L, 8L, 13L, 14L, 3L, 8L, 13L, 14L, 8L, 9L,
18L, 3L, 8L, 14L, 8L, 8L, 13L, 15L, 1L, 4L, 8L, 11L, 12L, 13L,
15L, 8L, 13L, 14L, 1L, 3L, 8L, 13L, 14L, 15L, 8L, 13L, 2L, 8L,
13L, 14L, 1L, 8L, 14L, 8L, 8L, 3L, 8L, 12L, 13L, 14L, 3L, 8L,
13L, 14L, 3L, 8L, 1L), p = c(0L, 5L, 9L, 13L, 16L, 19L, 20L,
23L, 30L, 30L, 33L, 39L, 41L, 45L, 48L, 49L, 50L, 55L, 59L, 61L,
62L), Dim = c(20L, 20L), Dimnames = list(c("AL627309.5", "LINC01409",
"FAM87B", "LINC01128", "LINC00115", "FAM41C", "AL645608.2", "SAMD11",
"NOC2L", "KLHL17", "PLEKHN1", "PERM1", "AL645608.7", "HES4",
"ISG15", "AGRN", "C1orf159", "TTLL10", "TNFRSF18", "TNFRSF4"),
c("AAACGAAAGAGAACCC-1", "AAACGCTGTACGCTAT-1", "AAAGGGCAGTAACCGG-1",
"AAATGGAAGTACCCTA-1", "AACAACCTCCCTCGAT-1", "AACAAGAGTCAGATTC-1",
"AACAGGGAGGTGCATG-1", "AACCAACAGAAATGGG-1", "AACCACAAGTTACGTC-1",
"AACCACACAAATGCGG-1", "AACCACACACCAGTAT-1", "AACCACATCCCGTTGT-1",
"AACCATGCATGACAGG-1", "AACCTGAAGGTAGATT-1", "AACCTTTTCCGCAACG-1",
"AAGAACAGTCGTTGGC-1", "AAGCGAGGTCGCGTTG-1", "AAGCGAGTCTAAGCCA-1",
"AAGCGTTAGAGAGCAA-1", "AAGCGTTAGCCTGTGC-1")), x = c(1, 1,
1, 2, 3, 1, 1, 1, 4, 1, 1, 3, 4, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2,
1, 1, 2, 1, 1, 10, 1, 2, 1, 5, 3, 1, 5, 2, 6, 2, 1, 1, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 20, 2, 1, 3, 2, 1, 1, 3, 1), factors = list()),
scale.data = structure(numeric(0), .Dim = c(0L, 0L)), key = "rna_",
assay.orig = NULL, var.features = character(0), meta.features = structure(list(), .Names = character(0), row.names = c("AL627309.5",
"LINC01409", "FAM87B", "LINC01128", "LINC00115", "FAM41C",
"AL645608.2", "SAMD11", "NOC2L", "KLHL17", "PLEKHN1", "PERM1",
"AL645608.7", "HES4", "ISG15", "AGRN", "C1orf159", "TTLL10",
"TNFRSF18", "TNFRSF4"), class = "data.frame"), misc = list())),
meta.data = structure(list(orig.ident = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), .Label = "Brain_Tumor_3p_raw_feature_bc_matrix", class = "factor"),
nCount_RNA = c(8, 7, 9, 4, 4, 2, 5, 17, 0, 8, 19, 2,
5, 3, 1, 1, 26, 7, 4, 1), nFeature_RNA = c(5L, 4L, 4L,
3L, 3L, 1L, 3L, 7L, 0L, 3L, 6L, 2L, 4L, 3L, 1L, 1L, 5L,
4L, 2L, 1L), percent.Brain_Tumor_3p_filtered_feature_bc_matrix_seurat = c(5.73453284414736,
6.01779506968141, 3.55912743972445, 4.50131444820001,
1.02573056022348, 4.88421052631579, 3.52807510614124,
1.07083296761169, 9.39285409738211, 6.73866576667792,
4.57610789980732, 0.617430539064355, 6.66001496632577,
2.96102465225176, 4.46445802508845, 4.89557004123986,
7.83134851813312, 2.82530215036886, 5.54443053817272,
2.95155221072437)), row.names = c("AAACGAAAGAGAACCC-1",
"AAACGCTGTACGCTAT-1", "AAAGGGCAGTAACCGG-1", "AAATGGAAGTACCCTA-1",
"AACAACCTCCCTCGAT-1", "AACAAGAGTCAGATTC-1", "AACAGGGAGGTGCATG-1",
"AACCAACAGAAATGGG-1", "AACCACAAGTTACGTC-1", "AACCACACAAATGCGG-1",
"AACCACACACCAGTAT-1", "AACCACATCCCGTTGT-1", "AACCATGCATGACAGG-1",
"AACCTGAAGGTAGATT-1", "AACCTTTTCCGCAACG-1", "AAGAACAGTCGTTGGC-1",
"AAGCGAGGTCGCGTTG-1", "AAGCGAGTCTAAGCCA-1", "AAGCGTTAGAGAGCAA-1",
"AAGCGTTAGCCTGTGC-1"), class = "data.frame"), active.assay = "RNA",
active.ident = structure(c(`AAACGAAAGAGAACCC-1` = 1L, `AAACGCTGTACGCTAT-1` = 1L,
`AAAGGGCAGTAACCGG-1` = 1L, `AAATGGAAGTACCCTA-1` = 1L, `AACAACCTCCCTCGAT-1` = 1L,
`AACAAGAGTCAGATTC-1` = 1L, `AACAGGGAGGTGCATG-1` = 1L, `AACCAACAGAAATGGG-1` = 1L,
`AACCACAAGTTACGTC-1` = 1L, `AACCACACAAATGCGG-1` = 1L, `AACCACACACCAGTAT-1` = 1L,
`AACCACATCCCGTTGT-1` = 1L, `AACCATGCATGACAGG-1` = 1L, `AACCTGAAGGTAGATT-1` = 1L,
`AACCTTTTCCGCAACG-1` = 1L, `AAGAACAGTCGTTGGC-1` = 1L, `AAGCGAGGTCGCGTTG-1` = 1L,
`AAGCGAGTCTAAGCCA-1` = 1L, `AAGCGTTAGAGAGCAA-1` = 1L, `AAGCGTTAGCCTGTGC-1` = 1L
), .Label = "Brain_Tumor_3p_raw_feature_bc_matrix", class = "factor"),
graphs = list(), neighbors = list(), reductions = list(),
images = list(), project.name = "Brain_Tumor_3p_raw_feature_bc_matrix",
misc = list(), version = structure(list(c(4L, 1L, 0L)), class = c("package_version",
"numeric_version")), commands = list(), tools = list())
perform TPM normalization on matrix:
mat <- GetAssayData(object = Brain_Tumor_3p_filtered_feature_bc_matrix_seurat[['RNA']], slot = 'data')
# generate tpm matrix
tpms <- NormalizeTPM(mat, tr_length = NULL, log = FALSE,scale = 1, pseudo.count = log(0))
#> Converting input to matrix.
pad matrix:
Y <- mat
Y[] <- NaN
Y[rownames(tpms), colnames(tpms)] <- tpms
Brain_Tumor_3p_filtered_feature_bc_matrix_seurat[["TPMcounts"]] <- CreateAssayObject(data = Y)
check:
GetAssayData(object = Brain_Tumor_3p_filtered_feature_bc_matrix_seurat[['TPMcounts']], slot = 'data')
#> 20 x 20 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 20 column names 'AAACGAAAGAGAACCC-1', 'AAACGCTGTACGCTAT-1', 'AAAGGGCAGTAACCGG-1' ... ]]
#>
#> AL627309.5 NaN NaN NaN NaN NaN NaN NaN
#> LINC01409 NaN NaN NaN NaN NaN NaN NaN
#> FAM87B . . . . . . .
#> LINC01128 187341.27 . 146401.8 . 596565.6 . .
#> LINC00115 . . . . . . .
#> FAM41C . 210047.97 . . . . .
#> AL645608.2 NaN NaN NaN NaN NaN NaN NaN
#> SAMD11 . . . . . . .
#> NOC2L 92127.65 85065.63 71995.1 407352.4 146684.7 1e+06 141034.5
#> KLHL17 . . . 271386.5 . . .
#> PLEKHN1 . . . . . . .
#> PERM1 NaN NaN NaN NaN NaN NaN NaN
#> AL645608.7 NaN NaN NaN NaN NaN NaN NaN
#> HES4 236763.77 109307.36 277536.1 . . . 362452.2
#> ISG15 483767.32 595579.05 504067.0 . 256749.7 . .
#> AGRN . . . . . . 496513.3
#> C1orf159 . . . . . . .
#> TTLL10 . . . . . . .
#> TNFRSF18 . . . 321261.1 . . .
#> TNFRSF4 . . . . . . .
#>
#> AL627309.5 NaN NaN NaN NaN NaN NaN NaN NaN
#> LINC01409 NaN NaN NaN NaN NaN NaN NaN NaN
#> FAM87B . NaN . . . 112796.1 . .
#> LINC01128 . NaN . 86070.04 . . . .
#> LINC00115 54197.99 NaN . . . . . .
#> FAM41C . NaN . . . . . .
#> AL645608.2 NaN NaN NaN NaN NaN NaN NaN NaN
#> SAMD11 . NaN . . . . . .
#> NOC2L 113883.29 NaN 166158.0 211630.63 437641.2 352391.7 363589.9 1e+06
#> KLHL17 . NaN . . . . . .
#> PLEKHN1 . NaN . . . . . .
#> PERM1 NaN NaN NaN NaN NaN NaN NaN NaN
#> AL645608.7 NaN NaN NaN NaN NaN NaN NaN NaN
#> HES4 731686.92 NaN 106754.6 108776.18 562358.8 226407.5 . .
#> ISG15 . NaN 727087.4 444513.63 . 308404.7 636410.1 .
#> AGRN 100231.79 NaN . 149009.52 . . . .
#> C1orf159 . NaN . . . . . .
#> TTLL10 . NaN . . . . . .
#> TNFRSF18 . NaN . . . . . .
#> TNFRSF4 . NaN . . . . . .
#>
#> AL627309.5 NaN NaN NaN NaN NaN
#> LINC01409 NaN NaN NaN NaN NaN
#> FAM87B . . . . NaN
#> LINC01128 . 61187.73 217397.9 403992.9 NaN
#> LINC00115 . . . . NaN
#> FAM41C . . . . NaN
#> AL645608.2 NaN NaN NaN NaN NaN
#> SAMD11 . . . . NaN
#> NOC2L 1e+06 60179.81 320725.2 596007.1 NaN
#> KLHL17 . . . . NaN
#> PLEKHN1 . . . . NaN
#> PERM1 NaN NaN NaN NaN NaN
#> AL645608.7 NaN NaN NaN NaN NaN
#> HES4 . 773296.62 274749.6 . NaN
#> ISG15 . 105335.83 187127.3 . NaN
#> AGRN . . . . NaN
#> C1orf159 . . . . NaN
#> TTLL10 . . . . NaN
#> TNFRSF18 . . . . NaN
#> TNFRSF4 . . . . NaN
Alternatively, after calculating the TPM matrix, subset to the features in mat
; you could then successfully run the inital command:
btf <- subset(Brain_Tumor_3p_filtered_feature_bc_matrix_seurat, features=rownames(tpms))
NormalizeTPM(sce=as.SingleCellExperiment(btf), tr_length = NULL, log = FALSE, scale = 1, pseudo.count = log(0))
#> Converting input to matrix.
#> class: SingleCellExperiment
#> dim: 15 20
#> metadata(0):
#> assays(4): counts logcounts tpm normcounts
#> rownames(15): FAM87B LINC01128 ... TNFRSF18 TNFRSF4
#> rowData names(0):
#> colnames(20): AAACGAAAGAGAACCC-1 AAACGCTGTACGCTAT-1 ...
#> AAGCGTTAGAGAGCAA-1 AAGCGTTAGCCTGTGC-1
#> colData names(5): orig.ident nCount_RNA nFeature_RNA
#> percent.Brain_Tumor_3p_filtered_feature_bc_matrix_seurat ident
#> reducedDimNames(0):
#> mainExpName: RNA
#> altExpNames(1): TPMcounts
Created on 2022-07-26 by the reprex package (v2.0.1)