Closed ShawnXzz closed 2 years ago
Hi @ShawnXzz,
Thanks for using the tool and also for catching this!
transparentCol()
is actually just a small function I had been using to control the transparency of colors during visualization. In this example, I had initially used it so that the borders of the scatter pies would be invisible. However, as it happens, the borders should also be removed by setting lwd = 0
, thus making transparentCol()
redundant. I must have removed the function from being exported by STdeconvolve
, which is why you are getting this error.
Unless if you would like to color the borders of the scatter pies by some other group membership (like what is done for the mOB tutorial) you probably don't need to use group_cols
here and can remove that argument from the function. If you're interested in still using transparentCol()
, the function is pretty simple and for now you can copy and paste it into your current R session:
transparentCol <- function(color, percent = 50, name = NULL) {
## Get RGB values for named color
rgb.val <- grDevices::col2rgb(color)
## Make new color using input color as base and alpha set by transparency
t.col <- grDevices::rgb(rgb.val[1], rgb.val[2], rgb.val[3],
maxColorValue = 255,
alpha = (100 - percent) * 255 / 100,
names = name)
## Save the color
invisible(t.col)
}
Either way this is a good catch and I should update the code and tutorial accordingly.
Let me know if this helps and if you are still having trouble!
Brendan
Hi @ShawnXzz,
Thanks for using the tool and also for catching this!
transparentCol()
is actually just a small function I had been using to control the transparency of colors during visualization. In this example, I had initially used it so that the borders of the scatter pies would be invisible. However, as it happens, the borders should also be removed by settinglwd = 0
, thus makingtransparentCol()
redundant. I must have removed the function from being exported bySTdeconvolve
, which is why you are getting this error.Unless if you would like to color the borders of the scatter pies by some other group membership (like what is done for the mOB tutorial) you probably don't need to use
group_cols
here and can remove that argument from the function. If you're interested in still usingtransparentCol()
, the function is pretty simple and for now you can copy and paste it into your current R session:transparentCol <- function(color, percent = 50, name = NULL) { ## Get RGB values for named color rgb.val <- grDevices::col2rgb(color) ## Make new color using input color as base and alpha set by transparency t.col <- grDevices::rgb(rgb.val[1], rgb.val[2], rgb.val[3], maxColorValue = 255, alpha = (100 - percent) * 255 / 100, names = name) ## Save the color invisible(t.col) }
Either way this is a good catch and I should update the code and tutorial accordingly.
Let me know if this helps and if you are still having trouble!
Brendan
Hi @bmill3r Thank you so much for your reply, this answer was very helpful for my code. In addition, I have a question that needs your answer. When four 10x visium data is integrated, it includes multiple images. Can such data be imported into STdeconvolve for analysis?
Hi @ShawnXzz,
By integrated data, do you mean all 4 datasets together as one? In the LDA model, the predicted cell-type proportions are independent between pixels. This means that theoretically you can combine multiple datasets together into one input corpus. However, because LDA is a mixed membership model, this also means that you assume that the same cell-types are present at different proportions in all of the pixels that were combined from the different datasets. Now, a particular cell-type could be more enriched in the pixels that came from one dataset than the other datasets, but technically LDA assumes that all of the K deconvolved cell-types are present at some amount in every pixel. However, we also assume that the cell-type proportions of each pixel are sparse, though, which means that out of the K cell-types, for a given pixel only a few will have high proportions and the rest will have low proportions. To see more about what I mean here, check out the STdeconvolve failures vignette.
Does this help answer your question? Brendan
Hi,
This is a great software! I am currently using 10x visium data for analysis and want to define cell types, but when running "vizAllTopics", I get an
error:
“Error: 'transparentCol' is not an exported object from 'namespace:STdeconvolve'”
This is my code:
plt <- vizAllTopics(theta = deconProp, pos = pos, groups = rep("0", dim(deconProp)[1]), group_cols = c("0" = STdeconvolve::transparentCol("black", percent = 100)), r = 45, lwd = 0, showLegend = TRUE, plotTitle = NA)