Open CMSimpson8 opened 2 years ago
Issue was partially solved by using as.numeric(data@seurat_clusters$[,1]) and contour = FALSE in the progression graph
Running into the same error...
Hi!
The progression_group
expects a factor value. You have to change the numeric or character valued column/group of your metadata as factor. Like following:
group = c(metadata$group_col)
group <- as.factor(group)
hope this helps.
I have tried the above suggestions but still getting the error. My group names are 'Control_D5', 'Control_D7', 'Control_D9'. I have also tried swapping the group names to the cluster numbers instead (0-8) but still had the error.
> control
An object of class Seurat
58153 features across 16728 samples within 2 assays
Active assay: SCT (24615 features, 2000 variable features)
3 layers present: counts, data, scale.data
1 other assay present: RNA
2 dimensional reductions calculated: pca, umap
> space <- reduce_dimensionality(control@assays$SCT@data, dist = "spearman", ndim = 3)
> control_group <- as.factor(control@meta.data$orig.ident)
> draw_trajectory_plot(space, progression_group = control_group, contour = TRUE)
Error in check_numeric_vector(progression_group, "progression_group", :
‘progression_group’ must be a numeric vector consisting of 24615 finite number(s)
Any help re this would be much appreciated!
before converting your control group to a factor, it has to be taken as a vector. try this:
control_group <- c(control@meta.data$orig.ident)
control_group <- as.factor(control_group)
draw_trajectory_plot(space, progression_group = control_group, contour = TRUE)
Hope this helps!
Hi @asif7adil, thanks for the suggestion! I'm afraid the same error still persists after trying that :(
> control_group <- c(control@meta.data$orig.ident)
> control_group <- as.factor(control_group)
> draw_trajectory_plot(space, progression_group = control_group, contour = TRUE)
Error in check_numeric_vector(progression_group, "progression_group", :
‘progression_group’ must be a numeric vector consisting of 24615 finite number(s)
> class(control_group)
[1] "factor"
> class(control_group[1])
[1] "factor"
Is there some black magic? I have 11 rows in my matrix, creating the group_name by myself does not work:
<fake_group_name <- factor(c("MCP", "CDP", "PreDC", "PreDC",
"PreDC", "PreDC", "PreDC", "PreDC",
"PreDC", "PreDC", "PreDC",
levels=c("CDP", "MCP", "PreDC")))
<fake_group_name
[1] MCP CDP PreDC PreDC PreDC PreDC PreDC PreDC PreDC PreDC PreDC
Levels: CDP MCP PreDC
<draw_trajectory_plot(space, fake_group_name, contour = TRUE)
Error in `map()` at purrr/R/superseded-map-df.R:81:3:
ℹ In index: 1.
Caused by error in `if (any(h <= 0)) ...`:
! 需要TRUE/FALSE值的地方不可以用缺少值
Run `rlang::last_trace()` to see where the error occurred.
But if I just borrow the factor from example data, it worked!
<data(ginhoux)
<group_name <- ginhoux$sample_info$group_name
<group_name <- group_name[1:11]
<group_name
[1] CDP CDP CDP CDP CDP CDP CDP CDP CDP CDP CDP
Levels: MDP CDP PreDC
<draw_trajectory_plot(space, fake_group_name, contour = TRUE)
The plot poped out as expected! I'm very, very confused about the black magic here. The group_name in example data and the fake_group_name I created were all the same, class of both is "factor", "typeof" of both is "integer".
Yeah I found out the weird unspoken rules. For every elements in the levels: If it appears in the factor, it must appears at least twice. Is it a feature or a bug?
I am having an issue using SCORPIUS, I want to set my progression group to show my Seurat clusters and the trajectory line between them - I am getting this error
Error in check_numeric_vector(progression_group, "progression_group", : ‘progression_group’ must be a numeric vector consisting of 2833 finite number(s)
the guide suggests setting the group name to Seuratobject$sample_info$group_name I have group set to mySeuratobject$meta.data$seurat_clusters
Is this the wrong subfile to set my group to? Which is the correct? I'm using R3.6.
Thanks!