Closed CalmRealistic closed 11 months ago
I tried this, but it did not work
md_cols = list(file = "Filename", factors = c("Response",
"Batch"))
ids0 <- md[[md_cols$file]]
ids1 <- fsApply(fs, identifier)
ids2 <- keyword(fs, "FILENAME")
if (length(unlist(ids2)) == length(fs))
ids2 <- basename(ids2)
check1 <- all(ids1 %in% ids0)
check2 <- all(ids2 %in% ids0)
ids_use <- which(c(check1, check2))[1]
ids <- list(ids1, ids2)[[ids_use]]
if (is.null(ids)) {
stop("Couldn't match 'flowSet'/FCS filenames\n",
"with those listed in 'md[[md_cols$file]]'.")
} else {
# reorder 'flowSet' frames according to metadata table
fs <- fs[match(md[[md_cols$file]], ids)]
}
The error says “all(unlist(md_cols) %in% names(md)) is not TRUE”, so could you please post names(md) and how your running prepData() when the error occurs? That check that fails is independent of the FCS files.
This is what names(md) gives [1] "Filename" "Group" "Number" "Response" "Batch"
and I am sorry, I did not understand the "how I am running prepdata".
Yeah so the names(md) dont match any of the defaults of the md_cols argument in prepData(). Have a look at ?prepData and adapt the md_cols argument to match your md table, and the error should be resolved. Or, alternatively, rename your md columns to match the defaults.
I changed my excell and now I have this I renamed some
names(md) [1] "file_name" "Group" "sample_id" "Condition" "Batch"
And would like some additional factors, but my code is wrong
factors <- list(factors = c("condition", "Group", "Batch")) sce <- prepData(fs, panel, md, features = panel$fcs_colname, md_cols=factors)
what should it be?
…Capital letter “Condition”?
Thank you, I guess the capital letter worked, because R was running really long time, but I will do the rest on my work computer, since the one I have crushed 2 times already.
Hi I am having en error when I reach prepDAta and I did not find the solution by searching it. This is the error Error in prepData(fs, panel, md, features = panel$fcs_colname) : all(unlist(md_cols) %in% names(md)) is not TRUE
FCS files have the same names as the md, nothing bizzare there.
This is my code
library(CATALYST) library(cowplot) library(flowCore) library(diffcyt) library(scater) library(SingleCellExperiment) library(readxl)
panel<- read_excel("Catalyst/ panel.xlsx") md<-read_excel("Catalyst/sample.data.xlsx") View(md)
fs <- read.flowSet(files = fcs_files, truncate_max_range = FALSE, ignore.text.offset=TRUE)
construct SingleCellExperiment
sce <- prepData(fs, panel, md, features = panel$fcs_colname)