Title:Flow cytometery for Biophyicists
#Structure
A classical paper on Doublet discrimination may be seen in (Wersto et al. (2001))
library(flowCore)
library(flowClust)
library(magrittr)
#https://rdrr.io/github/fribalet/FCSplankton/src/R/core-functions.R
# Function 1: my_influx(fcsfile)
my_influx=function(fcsfile) {
df.fcs<-read.FCS(fcsfile, emptyValue=F)
df=data.frame(df.fcs@exprs)
return(df)
}
# Example
influx_fcs_file="DB.20141208.A.0003.fcs"
df<-my_influx(influx_fcs_file)
colnames(df)
[1] "pulse.width" "FSC..Par." "FSC..Perp." "SSC"
[5] "ROS" "X692.40..488." "TIME"
# Function 2 :df.singlet(dataframe)
df.singlet=function(df){
# True only for influx setting
attach(df)
ik=which(pulse.width<14000)
df.singlet=data.frame(
pw=pulse.width[ik],
fsc.par=FSC..Par.[ik],
fsc.perp=FSC..Perp.[ik],
ssc=SSC[ik],
ros=ROS[ik])
return(df.singlet)
}
# Example
dfs=df.singlet(df)
attach(dfs)
attach(df)
plot(pulse.width,SSC,pch=16,cex=0.2)
points(pw,ssc,pch=16,cex=0.2,col="red")
pth="./jyotifacs/20141208/"
fnames=list.files(pth)
gnames=""
for (i in fnames){
gnames[i]=paste0(pth,i,sep="")
}
f1=gnames[7]
f2=gnames[10]
f3=gnames[22]
f4=gnames[25]
df1=my_influx(f1)
df2=my_influx(f2)
df3=my_influx(f3)
df4=my_influx(f4)
df1s=df.singlet(df1)
df2s=df.singlet(df2)
df3s=df.singlet(df3)
df4s=df.singlet(df4)
The effect of magnetic field is explored using box-cox transformation.
a1=hist(df1s$ssc,1000)
a2=hist(df2s$ssc,1000)
a3=hist(df3s$ssc,1000)
a4=hist(df4s$ssc,1000)
par(mfrow=c(1,2))
plot(a1$counts[10:180],pch=16,type="l",cex=0.5,col="blue",ylim=c(0,3000),ylab="counts")
points(a3$counts[10:180],pch=16,type="l",cex=0.5,col="red")
plot(a2$counts[10:180],pch=16,type="l",cex=0.5,col="blue",ylab="counts",ylim=c(0,3000))
points(a4$counts[10:180],pch=16,type="l",cex=0.5,col="red")
a1=hist(df1s$ros,1000)
a2=hist(df2s$ros,1000)
a3=hist(df3s$ros,1000)
a4=hist(df4s$ros,1000)
par(mfrow=c(1,2))
plot(a1$counts[10:180],pch=16,type="l",cex=0.5,col="blue",ylim=c(0,3000),ylab="counts")
points(a3$counts[10:180],pch=16,type="l",cex=0.5,col="red")
plot(a2$counts[10:180],pch=16,type="l",cex=0.5,col="blue",ylab="counts",ylim=c(0,3000))
points(a4$counts[10:180],pch=16,type="l",cex=0.5,col="red")
a1=hist(df1$SSC,1000)
a2=hist(df2$SSC,1000)
a3=hist(df3$SSC,1000)
a4=hist(df4$SSC,1000)
par(mfrow=c(1,2))
plot(a1$counts[10:180],pch=16,type="l",cex=0.5,col="blue",ylim=c(0,6000),ylab="counts")
points(a3$counts[10:180],pch=16,type="l",cex=0.5,col="red")
plot(a2$counts[10:180],pch=16,type="l",cex=0.5,col="blue",ylab="counts",ylim=c(0,6000))
points(a4$counts[10:180],pch=16,type="l",cex=0.5,col="red")