Closed Nab14 closed 1 year ago
Could you point me to where this is happening? Which vignette are you refering?
I was trying to run the KRAS vignette https://hectorrdb.github.io/condimentsPaper/articles/KRAS.html Thank you for your help,
Oh I see,
Yes the code is not optimal. It is pulling data from the original study (using the condimentsPaper::import_KRAS
function) which does not have a column for cell names per say, so that column is named X1 by default in R.
I only rename it later in the vignette as you noted.
As per your error, I think you were using an old version, the correct line should read
df$scores <- kras[, df$X1]$scores$scaled_scores
If you yourself replaced kras
with sce
, could you please tell me the output of
is(sce)
I'm using my own data. I used Seurat for clustering and created a sce from a Seurat object Below is the output of is (sce) Thank you
[1] "SingleCellExperiment" "RangedSummarizedExperiment" "SummarizedExperiment" "RectangularData" "Vector"
[6] "Annotated" "vector_OR_Vector"
And how did you create the the df
object?
after imbalance_score ex: sce<- imbalance_score(Object = sce, conditions = "group", dimred = "TSNE")
I used bind_cols then to generate df
df <- bind_cols( as.data.frame(reducedDims(sce)$TSNE), as.data.frame(colData(sce)[, -3]) ) %>% sample_frac(1)
thank you
I see. Is there a column in df that refers to cell names. If so (let's call if cells
) you can just do
df$scores <- sce[, df$cells]$scores$scaled_scores
Let me know if taht work
It's still gives me an error, see below Error in SummarizedExperiment:::.SummarizedExperiment.charbound(subset, : index out of bounds: ATCCACCCACAAATCC-1_2 TCCCAGTTCTCAACGA-1_2 ... GACCGTGGTACGTAGG-1_3 TTACCATTCATTCCTA-1_3
The column you use should match the colnames(sce)
mean(colnames(sce) %in% df$cells) == 1
mean(df$cells %in% colnames(sce)) == 1
Must be true both times Le mar. 25 oct. 2022 à 18:21, Nab14 @.***> a écrit :
It's still gives me an error, see below Error in SummarizedExperiment:::.SummarizedExperiment.charbound(subset, : index out of bounds: ATCCACCCACAAATCC-1_2 TCCCAGTTCTCAACGA-1_2 ... GACCGTGGTACGTAGG-1_3 TTACCATTCATTCCTA-1_3
— Reply to this email directly, view it on GitHub https://github.com/HectorRDB/condiments/issues/18#issuecomment-1290824904, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRNESFG2SWD4NQ5CIM4SGTWFACHDANCNFSM6AAAAAARNCXWTA . You are receiving this because you commented.Message ID: @.***>
I was able to fix the issue by using the code below Thank you for your help,
df <- df %>% as.data.frame() %>% mutate(cells = rownames(.), conditions = df$group) scores <- imbalance_score(Object = df %>% select(tSNE_1, tSNE_2) %>% as.matrix(), conditions = df$conditions) df$scores <- scores$scaled_scores
Hi Hector, I have a problem trying to reproduce this part of the code on my data df$scores <- sce[, df$X1]$scores$scaled_scores
I'm getting this error Error in .Primitive("[")(new("dgCMatrix", i = c(8L, 13L, 26L, 28L, 29L, : invalid or not-yet-implemented 'Matrix' subsetting
What X1 stand for? especially that in the next part of the code it replaced by "Cells" Thanks