0
0
Entering edit mode
e.bestion • 0
@ebestion-9746
Last seen 5.8 years ago

Hi,

I am encountering an error when trying to run the read.flowSet. I have a folder of .fcs files from a 96 well plate, one file per well. I concatenate the info into a dataset, but recently I have started to have errors when running my code, which is due to the read.flowSet command returning Error: vector::_M_range_check.

The only option I found is to delete the fcs file corresponding to the faulty well, and run my loop again, but it is particularly cumbersone and I am loosing a lot of data doing so.

It is noteworthy that the read.FCS command also returns this error message.

fnames <- list.files(pattern=".fcs") # find all FCS files
dataset<-data.frame() #create empty data frame
loc0events<-vector() #create vector

for (i in 1:length(fnames))      #loop through all files
{
data<-read.flowSet(fnames[i])  # tell R that all files are flowfiles
data<- data.frame(cbind(exprs(data[[1,7]]),exprs(data[[1,8]]),exprs(data[[1,11]]),exprs(data[[1,10]]),exprs(data[[1,12]]),exprs(data[[1,9]]))) #extract data from flow files

# add column for volume in µl
vol=round((as.numeric(dataverif@description[['$VOL']])/1000),0) #add identifier column plateloc<-gsub(".fcs","",fnames[i]) if(dim(data)[1]!=0) # for wells where there are events { data<-cbind(plateloc, data) # add new column to existing dataset volumesampled<-rep(vol,dim(data)[1]) data<-cbind(data,volumesampled) dataset<-rbind(dataset, data) #combine all rows to a big file } else #for wells where there are no events { loc0events<-c(loc0events,plateloc) } } Error: vector::_M_range_check #if Error: vector::_M_range_check -> remove info in the folder levels(dataset$plateloc)

 "A01" "A03" "A04" "A05" "A08" "A09" "A10" "A11" "A12" "B01" "B05"

here I should remove the B05.fcs file

0
Entering edit mode

Can you send me B05.fcs for troubleshooting?

BTW, your first 3 lines can be simplified by

 fr <- read.FCS(fnames[i])  # tell R that all files are flowfiles
data<- data.frame(exprs(fr)[, c(7:12)]) #extract data from flow files

# add column for volume in µl
dataverif <- fr