```
thesis <- function(graphics=TRUE,margin=TRUE,transform=TRUE,normalize=TRUE,clustering=TRUE) {
ptm <- proc.time()[3]
if(graphics==FALSE)
{
graphics.off()
}
#############################
# IMPORT DATA
############################
cat("Import Data(0/3)\n")
lb <<- read.FCS("Lympho B.fcs", transformation=FALSE);
cat("Import Data(1/3)\n")
nv<<- read.FCS("Naive Memory.fcs", transformation=FALSE);
cat("Import Data(2/3)\n")
pol<<- read.FCS("Polarisation.fcs", transformation=FALSE);
cat("Import Data(3/3)\n")
####################################################
# CHANGING NAMES TO COLUMNS
####################################################
colnames(lb)<<-c("FSC-A","SSC-A","FL1-H","FL2-H","FL3-H","FL4-H","FL5-H","FL6-H","FL7-H","FL8-H","FL9-H","FL10-H","TIME","SSC-H","SSC-W","FSC-W")
colnames(pol)<<-c("FSC-A","SSC-A","FL1-H","FL2-H","FL3-H","FL4-H","FL5-H","FL6-H","FL7-H","FL8-H","FL9-H","FL10-H","TIME","SSC-H","SSC-W","FSC-W")
colnames(nv)<<-c("FSC-A","SSC-A","FL1-H","FL2-H","FL3-H","FL4-H","FL5-H","FL6-H","FL7-H","FL8-H","FL9-H","FL10-H","TIME","SSC-H","SSC-W","FSC-W")
##################################################
# Remove Time
##################################################
lb<-lb[,-c(13)]
pol<-pol[,-c(13)]
nv<-nv[,-c(13)]
##############################################
# QUALITY ASSURANCE
###############################################
if (graphics==TRUE)
{
cat("Quality Assurance(0/1)\n")
QA(lb,pol,nv)
cat("Quality Assurance(1/1)\n")
}
################################################
# DENSITY PLOT
################################################
frames<-list("Lympho B"=lb,"Polarisation"=pol,"Naive Memory"=nv)
fs<<-as(frames,"flowSet")
if (graphics==TRUE)
{
cat("DensityPlot of all raw data\n")
d1 <- densityplot(~ ., fs, main="original")
png( file= "DensityPlot of all raw data.png")
plot(d1)
dev.off()
}
#############################################
# Margin Events
############################################
if (margin==TRUE)
{
lb.clean<<-margin(lb,graphics)
pol.clean<<-margin(pol,graphics)
nv.clean<<-margin(nv,graphics)
frames<-list("Lympho B"=lb.clean,"Polarisation"=pol.clean,"Naive Memory"=nv.clean)
fs<<-as(frames,"flowSet")
}
#########################################
# Compensate
#########################################
if (margin==TRUE)
{
comp()
frames<-list("Lympho B"=lb.comp,"Polarisation"=pol.comp,"Naive Memory"=nv.comp)
fs<<-as(frames,"flowSet")
}
###############################################
# tranform
###############################################
if (transform==TRUE)
{
cat("tranforming(0/3)\n")
transforming(lb.comp,graphics)
lb.trans<<-trans
cat("tranforming(1/3)\n")
transforming(pol.comp,graphics)
pol.trans<<-trans
cat("tranforming(2/3)\n")
transforming(nv.comp,graphics)
nv.trans<<-trans
cat("tranforming(3/3)\n")
frames<-list("Lympho B"=lb.trans,"Polarisation"=pol.trans,"Naive Memory"=nv.trans)
fs.trans<<-as(frames,"flowSet")
fs<<-as(frames,"flowSet")
}
#############################################################
# DENSITY PLOT transformed data
#############################################################
if (graphics==TRUE)
{
cat("DensityPlot of all transformed data\n")
d1 <- densityplot(~ ., fs, main="transformed")
png(file="Tranformed.png")
plot(d1)
dev.off()
}
################################
# NORMALIZE
#################################
if (normalize==TRUE)
{
cat("normalize...\n")
my_normalize(fs,graphics)
lb.norm<<-normalized[[1]]
pol.norm<<-normalized[[2]]
nv.norm<<-normalized[[3]]
fs.norm<<-normalized
fs<<-normalized
}
##############################################################
# CLUSTERING
##############################################################
if (clustering==TRUE)
{
cat("Clustering...\n")
subSpace(fs)
cat("Clustering...OK\n")
cat("THE END\n")
}
total<-proc.time()[3] - ptm
hours<-total%/%3600
minutes<-(total-hours*3600)%/%60
secs<-round(total%%60,digits=0)
####################################################
# CHANGING NAMES TO COLUMNS
####################################################
colnames(lb)<<-c("FSC-A","SSC-A","IGD FITC","CD10 PE","CD5 ECD","CD27 PC5.5","CD38 PC7","IGM APC","CD19 AA700","CD24 A750","CD21 PB","CD45 KO","TIME","SSC-H","SSC-W","FSC-W")
colnames(pol)<<-c("FSC-A","SSC-A","CXCR3 FITC","CCR10 PE","CCR7 PE CF594","CCR6 PERCPCY5.5","CCR4 PC7","CXCR5 APC","CD3 AA700","CD45RA AA750","CD4 PB","CD8 KO","TIME","SSC-H","SSC-W","FSC-W")
colnames(nv)<<-c("FSC-A","SSC-A","CD95 FITC","CCR7 PE","HLA DR ECD","CD25 PC5.5","CD45 RA PC7"," ICOS APC","CD3 AA700"," CD127 AA750","CD4 PB","CD8 KRO","TIME","SSC-H","SSC-W","FSC-W")
colnames(lb.clean)<<-c("FSC-A","SSC-A","IGD FITC","CD10 PE","CD5 ECD","CD27 PC5.5","CD38 PC7","IGM APC","CD19 AA700","CD24 A750","CD21 PB","CD45 KO","SSC-H","SSC-W","FSC-W")
colnames(pol.clean)<<-c("FSC-A","SSC-A","CXCR3 FITC","CCR10 PE","CCR7 PE CF594","CCR6 PERCPCY5.5","CCR4 PC7","CXCR5 APC","CD3 AA700","CD45RA AA750","CD4 PB","CD8 KO","SSC-H","SSC-W","FSC-W")
colnames(nv.clean)<<-c("FSC-A","SSC-A","CD95 FITC","CCR7 PE","HLA DR ECD","CD25 PC5.5","CD45 RA PC7"," ICOS APC","CD3 AA700"," CD127 AA750","CD4 PB","CD8 KRO","SSC-H","SSC-W","FSC-W")
colnames(lb.comp)<<-c("FSC-A","SSC-A","IGD FITC","CD10 PE","CD5 ECD","CD27 PC5.5","CD38 PC7","IGM APC","CD19 AA700","CD24 A750","CD21 PB","CD45 KO","SSC-H","SSC-W","FSC-W")
colnames(pol.comp)<<-c("FSC-A","SSC-A","CXCR3 FITC","CCR10 PE","CCR7 PE CF594","CCR6 PERCPCY5.5","CCR4 PC7","CXCR5 APC","CD3 AA700","CD45RA AA750","CD4 PB","CD8 KO","SSC-H","SSC-W","FSC-W")
colnames(nv.comp)<<-c("FSC-A","SSC-A","CD95 FITC","CCR7 PE","HLA DR ECD","CD25 PC5.5","CD45 RA PC7"," ICOS APC","CD3 AA700"," CD127 AA750","CD4 PB","CD8 KRO","SSC-H","SSC-W","FSC-W")
colnames(lb.trans)<<-c("FSC-A","SSC-A","IGD FITC","CD10 PE","CD5 ECD","CD27 PC5.5","CD38 PC7","IGM APC","CD19 AA700","CD24 A750","CD21 PB","CD45 KO","SSC-H","SSC-W","FSC-W")
colnames(pol.trans)<<-c("FSC-A","SSC-A","CXCR3 FITC","CCR10 PE","CCR7 PE CF594","CCR6 PERCPCY5.5","CCR4 PC7","CXCR5 APC","CD3 AA700","CD45RA AA750","CD4 PB","CD8 KO","SSC-H","SSC-W","FSC-W")
colnames(nv.trans)<<-c("FSC-A","SSC-A","CD95 FITC","CCR7 PE","HLA DR ECD","CD25 PC5.5","CD45 RA PC7"," ICOS APC","CD3 AA700"," CD127 AA750","CD4 PB","CD8 KRO","SSC-H","SSC-W","FSC-W")
colnames(lb.norm)<<-c("FSC-A","SSC-A","IGD FITC","CD10 PE","CD5 ECD","CD27 PC5.5","CD38 PC7","IGM APC","CD19 AA700","CD24 A750","CD21 PB","CD45 KO","SSC-H","SSC-W","FSC-W")
colnames(pol.norm)<<-c("FSC-A","SSC-A","CXCR3 FITC","CCR10 PE","CCR7 PE CF594","CCR6 PERCPCY5.5","CCR4 PC7","CXCR5 APC","CD3 AA700","CD45RA AA750","CD4 PB","CD8 KO","SSC-H","SSC-W","FSC-W")
colnames(nv.norm)<<-c("FSC-A","SSC-A","CD95 FITC","CCR7 PE","HLA DR ECD","CD25 PC5.5","CD45 RA PC7"," ICOS APC","CD3 AA700"," CD127 AA750","CD4 PB","CD8 KRO","SSC-H","SSC-W","FSC-W")
cat("Finished at")
sprintf("%02d:%02d:%02d", hours, minutes,round(secs,digits=0))
}
```