Loop for mass analyses and extraction of FCS data
2
0
Entering edit mode
Wilson Yeo • 0
@wilson-yeo-9259
Last seen 6.4 years ago
Singapore

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)})
Exprs Lapply FCS for loop flowcore • 1.3k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode
Gavin Kelly ▴ 680
@gavin-kelly-6944
Last seen 4.0 years ago
United Kingdom / London / Francis Crick…

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 COMMENT
0
Entering edit mode
Jiang, Mike ★ 1.3k
@jiang-mike-4886
Last seen 2.5 years ago
(Private Address)

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 COMMENT

Login before adding your answer.

Traffic: 615 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6