Closed pilidlao closed 1 year ago
Hi. Could you try to previously install SummarizedExperiment
, ncdfFlow
, flowCore
and SingleCellExperiment
, please?
Thank you very much! It worked. I am trying to run this initially with samples from a single run (6 tubes in total) and have run into issues at several steps. When I run:
> fcs1 <- fcs.SCE(directory = ".", pattern = "Control", metadata = md1, events = 100000, transf.cofactor = 4000, project.name = "Mito1")
[1] "Unmixed\\CD3_CD28 Control\\Tube_001_S.fcs" "Unmixed\\CD3_CD28 Control\\Tube_002_S.fcs"
[3] "Unmixed\\CD3_CD28 Control\\Tube_003_S.fcs" "Unmixed\\CD3_CD28 Control\\Unstained.fcs"
[5] "Unmixed\\Unstimulated Control\\Tube_001.fcs" "Unmixed\\Unstimulated Control\\Tube_002.fcs"
[7] "Unmixed\\Unstimulated Control\\Tube_003.fcs" "Unmixed\\Unstimulated Control\\Unstained.fcs"
> library(flowAI)
> fcs1_nod <- qc.and.removeDoublets(fcs1, physical.markers = c("FSC_A:NA", "FSC_H:NA", "SSC_A:NA",
+ "SSC_H:NA"), return.fcs = F)
I get repetitive warnings:
There were 24 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: Impossible to retrieve the time channel automatically. The quality control can only be performed on signal acquisition and dynamic range.
2: The TIMESTEP keyword was not found and hence it was set to 0.01. Graphs labels indicating time might not be correct
3: In grep(FSCA, colnames(exprstmp)) :
argument 'pattern' has length > 1 and only the first element will be used
What is the solution to this? [these are unmixed, not raw files].
I also ran:
> fcs1_cluster <- clustering.flow(fcs1, method = "SOM", assay.i = "transformed", num.k =15)
> fcs500 <- sub.samples(fcs.SCE = fcs1, subsampling = 500)
> install.packages('uwot')
> library(uwot)
> fcs500 <- dim.reduction(fcs500, dr.method = c("UMAP", "pca"), assay.i = "transformed")
> flowplot(fcs500, x.axis = c("BV480-A:CD62L", "BV570-A:CD4", "BV570-A:CD4"), y.axis = c("BUV395-A:CD45RA", "PerCP-A:CD8",
+ "SSC_H:NA"), color.by = "SOM.k15", assay.i = "transformed")
I tried many changes and get different errors for flowplot():
Error in `geom_point()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `FUN()`:
! object 'BV570' not found
Run `rlang::last_trace()` to see where the error occurred.
OR this:
Error in `[.data.frame`(data, , color.by) : undefined columns selected
Any idea what I might be getting wrong?
> fcs500
class: SingleCellExperiment
dim: 37 4000
metadata(5): project_name input_fcs reduced_metadata raw_channel_names PCA.rotation
assays(2): raw transformed
rownames(37): Time:NA SSC-H:NA ... BUV496-A:CD27 AF-A:NA
rowData names(0):
colnames(4000): 1.71081 1.37442 ... 8.90560 8.94769
colData names(7): filename sample_id ... cell_id SOM.k15
reducedDimNames(2): PCA UMAP
mainExpName: NULL
altExpNames(0):
> rlang::last_trace(drop=F)
<error/rlang_error>
Error in `palette()`:
! Insufficient values in manual scale. 15 needed but only 1 provided.
---
Backtrace:
▆
1. └─FlowCT::flowplot(...)
2. └─cowplot::get_legend(g1)
3. └─cowplot::get_plot_component(plot, "guide-box")
4. ├─cowplot::as_gtable(plot)
5. └─cowplot:::as_gtable.default(plot)
6. ├─cowplot::as_grob(plot)
7. └─cowplot:::as_grob.ggplot(plot)
8. └─ggplot2::ggplotGrob(plot)
9. ├─ggplot2::ggplot_gtable(ggplot_build(x))
10. │ └─ggplot2:::attach_plot_env(data$plot$plot_env)
11. │ └─base::options(ggplot2_plot_env = env)
12. ├─ggplot2::ggplot_build(x)
13. └─ggplot2:::ggplot_build.ggplot(x)
14. └─base::lapply(data, scales_map_df, scales = npscales)
15. └─ggplot2 (local) FUN(X[[i]], ...)
16. ├─base::unlist(...)
17. └─base::lapply(scales$scales, function(scale) scale$map_df(df = df))
18. └─ggplot2 (local) FUN(X[[i]], ...)
19. └─scale$map_df(df = df)
20. └─ggplot2 (local) map_df(..., self = self)
21. └─base::lapply(aesthetics, function(j) self$map(df[[j]]))
22. └─ggplot2 (local) FUN(X[[i]], ...)
23. └─self$map(df[[j]])
24. └─ggplot2 (local) map(..., self = self)
25. └─self$palette(n)
26. └─ggplot2 (local) palette(...)
27. └─cli::cli_abort("Insufficient values in manual scale. {n} needed but only {length(values)} provided.")
28. └─rlang::abort(...)
I am sorry if this is long winded but would appreciate any help I can get. Thank you in advance.
Hi again. I'm glad the previous error was fixed.
Regarding these other ones, I guess everything is crashing because of markers' nomenclature. Please, try to simplify them by using FSC instead of FSC:NA, or CD62L rather than BV480-A:CD62L (and so on for other markers). You can find useful this part of the tutorial.
(and please, for other errors, open a new issue if it's possible. Thanks)
Hi again, thank you for the advice. I simplified the marker nomenclature as you advised and flowplot works now. However, the data points are getting cut off at the top right end. Is there a way to rescale this? (I tried to do a simple FSC_A v SSC_A and noticed this).
In the section on "Dimensionality reduction" in the instructions, I was able to get a plot akin to figure A but not B or C. In the dr.plotting command, the error is that object color_clusters is not recognized. Without that, just typing
dr.plotting(fcs500, plot.dr = "UMAP", assay.i = "transformed") gives me a series of figures (possibly akin to figure C) with only x-axis labels and scales but no plots. If I add color.by, for e.g.: dr.plotting(fcs500, plot.dr = "UMAP", assay.i = "transformed", color.by="SOM.k30") I get figure A but absent numbers indicating which clusters match with which colors on the graph as in figure B, some of the colors are very similar and it is difficult to distinguish among them. Could you please suggest how to make that happen?
Also, in the quality control and doublet removal step, I get warnings:
fcs <- qc.and.removeDoublets(fcs, physical.markers = c("FSC_A", "FSC_H", "SSC_A", "SSC_H"), return.fcs = F) Error: vector memory exhausted (limit reached?) In addition: Warning messages: 1: The TIMESTEP keyword was not found and hence it was set to 0.01. Graphs labels indicating time might not be correct 2: In ord_fcs_time(set[[i]], timeCh) : Expression data in the file (File name given) were not originally ordered by time. Any idea how to fix this? Are there changes I can make in .fcs files to add the keyword or fix the time ordering? Thanks a lot for all your support.
I apologize for not opening this as a new issue. I promise to do that if I need help again next time. Thank you again for your help!
Sorry for delaying so much the response.
Please, add the code and the figure for understanding the first issue.
Regarding the second one: the color_clusters
is a variable that contains a vector of colors. I guess it'll give you an error if hasn't been created before... in that case, create it or leave it empty for using the default palette.
When running dr.plotting
, is it appearing any message of error or warning that gives you a clue about what's happening?
For adding labels, use the option label.by = "SOM.k30"
(please, see function documentation with ?dr.plotting
).
You have an error message indicating some problems with RAM (I think) and other some warnings related with time (but no important for downstream analysis).
Thank you for your response. I have added the code below:
dr.plotting(fcs500_2, plot.dr = "UMAP", assay.i = "transformed", colors = color_clusters, color.by = "SOM.k30") Error in is_missing(values) : object 'color_clusters' not found dr.plotting(fcs500_2, plot.dr = "UMAP", assay.i = "transformed", color.by = "SOM.k30") Error in UseMethod("depth") : no applicable method for 'depth' applied to an object of class "NULL"
I tried using label.by="SOM.k30":
dr.plotting(fcs500_2, plot.dr = "UMAP", assay.i = "transformed", label.by = "SOM.k30") Error in UseMethod("depth") : no applicable method for 'depth' applied to an object of class "NULL"
How do I create a color_clusters vector and add it to the SCE?
Regarding the quality control and doublet removal, while creating the fcs.SCE:
fcs1_10k <- fcs.SCE(directory = ".", pattern = "Control", metadata = md1, events = 10000, transf.cofactor = 4000, project.name = "Mito1") fcs1_10k <- marker.names(fcs1_10k, new.names=new_names1) fcs1_10k_qc <- qc.and.removeDoublets(fcs2_10k, physical.markers = c("FSC_A", "FSC_H", "SSC_A", "SSC_H"), return.fcs = F) Error: vector memory exhausted (limit reached?)
I reduced the number of events from events=10000 progressively to 1000, 100 and even 10 but the same error message (Error: vector memory exhausted (limit reached?)) pops up each time. So, I am not sure it is a RAM issue.
Thanks again for your help.
Hi again,
Regarding the first issue: I've never seen this error, most probably your fcs.SCE
object is wrong built (why??). Could you show me the output of head(colData(fcs500_2))
and str(colData(fcs500_2))
, please?
For creating a colors vector, you should do something like this: mypalette <- div.colors(30)
(so many colors as clusters you requested for in SOM), and then add it wherever you want.
I'm totally confused with your last error... your several tests are very well thought out but I have no idea why is appearing this error, sorry. However, this is not a critical step so I think you can go ahead without big deals.
Not able to install it in MacOS Ventura 13.2.1 (M1 Pro). Get this error when I try:
Tried installing gcc and resetting path but does not work. Any suggestions? Thank you in advance.