Plotting the results of flowType
1
0
Entering edit mode
lt400 • 0
@lt400-12082
Last seen 7.9 years ago

Hello, 

   I have been using flowType to analyse 15 parameter flow cytometry data but I am having difficulty verifying that I am doing things correctly. I would like to take specific phenotypes from the results of the flowType() and plot them so that I can better visualise the cells that make up the phenotype (I need to create plots that the boss will understand). 

For example...Using the DLBCExample data in the vignette at code chunk 4. Is it possible to take a specific phenotype and plot only select parameters? ie. extract the data points that make up the "CD3+CD5-CD19+" phenotype and make each plot separately (FL1.LOG v FL2.LOG etc.). The reason I want to do this is that I have 15 parameters so the result of code chunk 4 on my own data is confusing to interpret and takes a long time to run.

Thanks

 

 

###################################################
### code chunk number 1: loadlibs
###################################################
library(flowType)
data(DLBCLExample)


###################################################
### code chunk number 2: PropMarkers
###################################################
PropMarkers <- 3:5
MFIMarkers <- PropMarkers
MarkerNames <- c('FS', 'SS','CD3','CD5','CD19')
Res <- flowType(DLBCLExample, PropMarkers, MFIMarkers, 'kmeans', MarkerNames);


###################################################
### code chunk number 3: SingleDPartitions
###################################################
plot(Res, DLBCLExample);


###################################################
### code chunk number 4: PlotPop
###################################################
plot(Res, "CD3+CD5-CD19+", Frame=DLBCLExample);

flowtype • 831 views
ADD COMMENT
1
Entering edit mode
koneill ▴ 30
@koneill-8031
Last seen 4.6 years ago
Canada

Unfortunately selecting markers isn't supported in the plot function in flowType right now. But you can do this manually using some of flowType's helper functions. This would also give you more control over the plotting:

 

###################################################
### code chunk number 1: loadlibs
###################################################
library(flowType)
data(DLBCLExample)


###################################################
### code chunk number 2: PropMarkers
###################################################
PropMarkers <- 3:5
MFIMarkers <- PropMarkers
MarkerNames <- c('FS', 'SS','CD3','CD5','CD19')
Res <- flowType(DLBCLExample, PropMarkers, MFIMarkers, 'kmeans', MarkerNames);


###################################################
### code chunk number 3: SingleDPartitions
###################################################
plot(Res, DLBCLExample);


###################################################
### code chunk number 4: PlotPop
###################################################
plot(Res, "CD3+CD5-CD19-", Frame=DLBCLExample );


###################################################
### code chunk number 5: Manual plot
###################################################

library(flowCore)

phenoCode <- encodePhenotype(pheno.string="CD3+CD5-CD19-", marker.names=Res@MarkerNames[Res@PropMarkers])

markersToPlot <- c('CD5', 'CD19')
phenoFrame <- data.frame(exprs(DLBCLExample)[,which(MarkerNames %in% markersToPlot)]) 
colnames(phenoFrame) <- markersToPlot

#This is the default plot in flowType, which hides the dots not in the phenotype 
#by making them white:
pairs(phenoFrame, col=getLabels(Res, phenoCode))

#This might be more useful for highlighting the cells in vs out of the phenotype:
pairs(phenoFrame, col=getLabels(Res, phenoCode)+1)


###################################################
### code chunk number 6: GGplot!
###################################################


library(ggplot2)
library(GGally)
phenoFrame$in_phenotype <- as.factor(getLabels(Res, phenoCode))

#ggpairs gives you much more control and options than built-in pairs.
#Here I've included a density plot in the upper side:

ggpairs(phenoFrame, 
        columns = markersToPlot,
        upper = list(continuous = "density"),
        mapping = ggplot2::aes(colour=in_phenotype),
        legend=1)

 

ADD COMMENT

Login before adding your answer.

Traffic: 543 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