Question: Loop for mass analyses and extraction of FCS data
0
gravatar for Wilson Yeo
21 months ago by
Wilson Yeo0
Singapore
Wilson Yeo0 wrote:

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)})
flowcore fcs lapply for loop exprs • 368 views
ADD COMMENTlink modified 21 months ago by Jiang, Mike1.2k • written 21 months ago by Wilson Yeo0

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".

ADD REPLYlink written 21 months ago by Wilson Yeo0
Answer: Loop for mass analyses and extraction of FCS data
0
gravatar for Gavin Kelly
21 months ago by
Gavin Kelly560
United Kingdom / London / Francis Crick Institute
Gavin Kelly560 wrote:

It would be easier to diagnose if you gave the exact error message, but as a guess, flowcore::Subset requires the first argument be a flow object (such as your xNtrans ) whereas you're feeding it xN which is a character.

ADD COMMENTlink written 21 months ago by Gavin Kelly560
Answer: Loop for mass analyses and extraction of FCS data
0
gravatar for Jiang, Mike
21 months ago by
Jiang, Mike1.2k
(Private Address)
Jiang, Mike1.2k wrote:

It is recommended to use `add` method to append these gates to the `GatingSet` object from flowWorkspace package to capture your entire gating process for better organizing, archiving and retrieving the gating hierarchy. See the vignette of flowCore for more details.

ADD COMMENTlink written 21 months ago by Jiang, Mike1.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 357 users visited in the last hour