Hi, This is Wilson. I am trying to write a loop function to possibly mass analyse a set of flow frame files. However my sequence does not seem to recognise the "Subset" function utilised by the flowCore package. The loop terminates after the recognition of the Pico matrix (highlighted portion).
Pls kindly take a look and advise if I wrote any part wrong.
Thanks
Wilson
library(flowCore) df1<-list.files("G://Trial/") ##directory with list of files to be read in setwd("G://Trial/") for(i in df1){ xN <- as.character(i) y <- read.FCS(xN, transformation="linearize", which.lines=NULL, alter.names=FALSE, column.pattern=NULL, invert.pattern = FALSE, decades=0, ncdf = FALSE, min.limit=NULL, dataset=NULL, emptyValue=TRUE) logTrans <- logTransform(transformationId="log10-transformation", logbase=10, r=1, d=1) trans <- transformList(c("SSC-Log_Height", "FSC-Log_Height", "FL1-Log_Height", "FL2-Log_Height", "FL3-Log_Height", "FL4-Log_Height", "FL5-Log_Height", "FL6-Log_Height", "FL7-Log_Height" , "FL8-Log_Height", "FL9-Log_Height", "FL10-Log_Height", "FL11-Log_Height"), logTrans) xNtrans <- transform(y, trans)
##Matrix to be applied for data extraction
Pico <- matrix(c(1,1,5,5,0,2.5,4.85,0),ncol=2,nrow=4) ## (y-axis, x-axis)
colnames(Pico) <- c("FL4-Log_Height","FL2-Log_Height")
pico <- polygonGate(filterId="Counts", .gate = Pico)
xNs<-Subset(xN,pico)
Rect <- matrix(c(1,5,5,1,1,1,5,5),ncol=2,nrow=4) ## (y-axis, x-axis)
colnames(Rect) <- c("FL4-Log_Height","SSC-Log_Height")
rect <- polygonGate(filterId="Counts", .gate = Rect)
xNF<-Subset(xNs,rect)
z<-exprs(xNF) }
lapply(names(z), function(x){ write.table(z, file = paste("G://Trial/", x,".txt", sep = ""),sep="\t",row.names=F,col.names=T,quote=F)})
Sorry I mean the loop function was only to read until the highlighted portion. It did not recognise the "Subset" function and was only able to read until the first matrix labelled "Pico".