Entering edit mode
Hi, An error occurred when I used the prePdata function: all (unlist (md_cols)% in% names (md)) is not TRUE:
> sce <- prepData(samp, Panel, Sample_sheet, features = Panel$fcs_colname)
Error in prepData(samp, Panel, Sample_sheet, features = Panel$fcs_colname) :
all(unlist(md_cols) %in% names(md)) is not TRUE
I checked Sample_ sheet$file_ The file name of name and flowSet are consistent. Why does this error occur? Can someone give me some guidance? Thank you.
The complete code is as follows (Panel is built by myself)
library(tidyverse)
Sample_sheet<-read.table("Sample_sheet.txt",header=T)
head(data.frame(md))
#fcs 文件
#BiocManager::install("cytofWorkflow",ask=F,update=F)
library(cytofWorkflow)
p1='CLEAN_date/'
fs1=list.files(p1,'*fcs' )
samp <- read.flowSet(files = fs1,path = p1)
#Panel
library(readxl)
Panel <- colnames(samp)
Panel <- as.data.frame(Panel)
#Panel <- Panel[c(3:51),]
Panel <- as.data.frame(Panel)
Panel[,2] <- pData(parameters(samp[[1]]))$desc
colnames(Panel)[1] <- "fcs_colname"
colnames(Panel)[2] <- "antigen"
all(Panel$fcs_colname %in% colnames(samp))
#[1] TRUE
all(Sample_sheet$file_name %in% rownames(samp@phenoData))
#[1] TRUE
#------------------------2. -----------------------
#BiocManager::install("CATALYST")
library(CATALYST)
Sample_sheet$group <- factor(Sample_sheet$group, levels = c("WT","MH","MH(mut)"))
Sample_sheet$Sample_id <- factor(Sample_sheet$Sample_id,
levels = Sample_sheet$Sample_id[order(Sample_sheet$group)])
# SingleCellExperiment
sce <- prepData(samp, Panel, Sample_sheet, features = Panel$fcs_colname)#实现了第2步得数据转换,arcsinh
Error in prepData(samp, Panel, Sample_sheet, features = Panel$fcs_colname) :
all(unlist(md_cols) %in% names(md)) is not TRUE
The error seems to be unrelated to the FCS file names and panel, but points to a discrepancy between
md
(yourSample_sheet
) andmd_cols
. By default,md
is expected to contain columns named"file_name", "sample_id", "patient_id", "condition"
. If this is not the case, please adjustmd_cols
accordingly. Perhaps have a look at the documentation at?prepData
for more details.