R 使用flowViz的flowSet的多个闸门
我想在R 使用flowViz的flowSet的多个闸门,r,bioinformatics,bioconductor,R,Bioinformatics,Bioconductor,我想在流程集上使用多个椭球门,并绘制结果 我设法用每帧一个门来绘制flowSet,但无法正确构造filtersList对象。我得到以下警告: 警告消息: 1:“筛选器”必须是筛选器列表、筛选器结果列表或单个 筛选对象或筛选对象的命名列表。 2:“筛选器”必须是筛选器列表、筛选器结果列表或单个 筛选对象或筛选对象的命名列表。 set.seed(1) library(flowViz) # Graphical parameters flowViz.par.set("gate", list(lwd =
流程集上使用多个椭球门
,并绘制结果
我设法用每帧一个门来绘制flowSet
,但无法正确构造filtersList
对象。我得到以下警告:
警告消息:
1:“筛选器”必须是筛选器列表、筛选器结果列表或单个
筛选对象或筛选对象的命名列表。
2:“筛选器”必须是筛选器列表、筛选器结果列表或单个
筛选对象或筛选对象的命名列表。
set.seed(1)
library(flowViz)
# Graphical parameters
flowViz.par.set("gate", list(lwd = 8))
gp <- flowViz.par.get()
# First set of data
data1 <- matrix(c(rnorm(10000), rlnorm(10000)), ncol = 2)
colnames(data1) <- c("M1", "M2")
rownames(data1) <- 1:10000
# Second set of data
data2 <- matrix(c(rnorm(10000), rlnorm(10000)), ncol = 2)
colnames(data2) <- c("M1", "M2")
rownames(data2) <- 1:10000
# Constructing the flowFrames
frame1 <- new("flowFrame", exprs = data1)
frame2 <- new("flowFrame", exprs = data2)
# Gating
covar1 <- matrix(c(1,0.001,0.001,5), ncol = 2)
colnames(covar1) <- c("M1", "M2")
rownames(covar1) <- c("M1", "M2")
covar2 <- covar1
means1 <- c(M1 = 0, M2 = 2.5)
means2 <- c(M1 = 0, M2 = 10)
eg1 <- ellipsoidGate(.gate = covar1, mean = means1)
eg2 <- ellipsoidGate(.gate = covar2, mean = means2)
egs <- filters(list(gate1 = eg1, gate2 = eg2))
# Plotting only one flowFrame
xyplot(`M2`~`M1`, frame1, xlab = "M2", ylab = "M1", xlim = c(-4,4),
ylim = c(0,30), smooth = FALSE, filter = egs)
现在我想构造一个过滤器列表
,为我的流集
的每个流框
使用多个门
# Constructing the filtersList
myFilters <- filtersList(list(plot1 = egs, plot2 = egs))
xyplot(`M2`~`M1`|name, fs, xlab = "M2", ylab = "M1", xlim = c(-4,4),
ylim = c(0,30),
panel = function(x,y,...){
panel.xyplot.flowset(x = x, frames = fs, channel.x.name = "M1",
channel.y.name = "M2", gp = gp, smooth = FALSE, filter = myFilters)
})
#构建过滤器列表
我的过滤器我解决了这个问题。您只需从您的门列表中构造过滤器
对象
然后重复该对象,以获得与流集
长度相同的过滤器列表,并将列表
元素命名为与流集
元素相同的名称
但是您只能使用相同类型的门,因此不能组合矩形门
和椭球门
对象
# Constructing the filtersList
myFilters <- filters(list(eg1,eg2))
myFilters <- rep(list(myFilters),2)
names(myFilters) <- sampleNames(fs)
xyplot(`M2`~`M1`|name, fs, xlab = "M2", ylab = "M1", xlim = c(-4,4),
ylim = c(0,30),
panel = function(x,y,...){
panel.xyplot.flowset(x = x, frames = fs, channel.x.name = "M1",
channel.y.name = "M2", gp = gp, smooth = FALSE,
filter = myFilters)
})
#构建过滤器列表
我的过滤器
# Constructing the filtersList
myFilters <- filters(list(eg1,eg2))
myFilters <- rep(list(myFilters),2)
names(myFilters) <- sampleNames(fs)
xyplot(`M2`~`M1`|name, fs, xlab = "M2", ylab = "M1", xlim = c(-4,4),
ylim = c(0,30),
panel = function(x,y,...){
panel.xyplot.flowset(x = x, frames = fs, channel.x.name = "M1",
channel.y.name = "M2", gp = gp, smooth = FALSE,
filter = myFilters)
})