当我在我的数据代码上运行 oncoprint 函数时,我看到以下警告(尽管它仍然会生成 oncoprint,但我无法判断是否有任何问题):
1:您cell_fun
为超过 100 行或列的热图定义,绘制可能非常慢。考虑使用矢量化版本layer_fun
。2:列注释“分子”中的值具有与矩阵列名称不同的名称顺序。这可能会导致对您的数据的错误结论。请仔细检查。(警告 #2 ^ 适用于我使用的每一个列注释(例如:性别、年龄等))
cell_fun 参数在哪里?我没有传递一个名为 cell_fun 的参数,所以我假设它是 oncoprint() 使用的某个函数的参数。layer_fun 与 cell_fun 有何不同?我将如何创建此变量并将其传递给 oncoprint 函数?
至于警告 2,我尝试搜索论坛和(我认为)github 源代码,但无法理解这意味着什么或如何修复它。目前,我正在测试整个数据集的子集,因为它需要很长时间才能运行。因此,在我的数据子集中,并不是所有类型的分子诊断——这就是为什么会出现这个警告吗?因为注释列的诊断比在我的数据子集中看到的要多?这能解释我所有的警告,比如警告 2 吗?
我试图用玩具数据/数据的子集制作一个可重复的样本,但是当我运行它时,我再也看不到警告了!如果不向某人发送数据文件以自行尝试,我不知道该怎么办。
这是我正在运行的行:
#label rows as Sample ID, then rm sample col
row.names(toydf) <- toydf$samples
toydf <- toydf[, 2:length(toydf)]
#Create Colors for Annotation
gender_cols <- c("Male" = "blue", "Female" = "pink")
grade_cols <- c("1" = "white", "2" = "gray", "3" = "black")
mol_cols <- c("Glioma" = "yellow",
"GBM" = "black",
"Oligo" = "pink")
col <-
c(
"arm_level_gain" = "blue",
"wt" = "beige",
"missense" = "pink",
"arm_level_loss" = "red",
"damaging_mutation" = "purple"
)
ha_top = HeatmapAnnotation(
df = toydf,
col = list(
Molecular = mol_cols, # defined earlier in script
Grade = grade_cols,
Gender = gender_cols
),
na_col = "grey"
)
ha_all = HeatmapAnnotation( #constructor function-- read complexheatmap documentation
df = toydf,
col = list(Molecular = mol_cols,
Grade = grade_cols,
Gender = gender_cols),
na_col = "grey"
)
#some var that oncoprint needs
## Define grfphical representations of different alteration types
alter_fun = list(
background = function(x, y, w, h) {
grid.rect(x,
y,
w - unit(0.5, "mm"),
h - unit(0.5, "mm"),
gp = gpar(fill = "beige", col = NA))
},
wt = function(x, y, w, h)
grid.rect(x, y, w * 0.9, h * 0.9, gp = gpar(fill = "beige", col = NA)),
focal_loss = function(x, y, w, h)
grid.rect(x, y, w * 0.9, h * 0.9,
gp = gpar(fill = col["focal_loss"], col = NA)),
damaging_mutation = function(x, y, w, h)
grid.rect(x, y, w * 0.9, h * 0.9,
gp = gpar(fill = col["damaging_mutation"], col = NA)),
missense = function(x, y, w, h)
grid.rect(x, y, w * 0.9, h * 0.9,
gp = gpar(fill = col["missense"], col = NA)),
focal_gain = function(x, y, w, h)
grid.rect(x, y, w * 0.9, h * 0.9,
gp = gpar(fill = col["focal_gain"], col = NA)),
arm_level_gain = function(x, y, w, h)
grid.rect(x, y, w * 0.9, h * 0.9,
gp = gpar(fill = col["arm_level_gain"], col = NA)),
arm_level_loss = function(x, y, w, h)
grid.rect(x, y, w * 0.9, h * 0.9,
gp = gpar(fill = col["arm_level_loss"], col = NA))
)
barplot_traits <- c("focal_loss", "damaging_mutation", "missense", "focal_gain", "arm_level_gain",
"arm_level_loss", "wt")
oncoPrint(
toym,
alter_fun = alter_fun,
show_pct = F,
row_names_gp = gpar(size = 16),
col = col,
#cluster_columns = hc_order, #is hc_order a dendrogram/hclust object?
top_annotation = ha_all,
#column_split = toydf$Molecular,
row_names_side = "left",
#row_order = genes_order,
right_annotation = rowAnnotation(
row_barplot = anno_oncoprint_barplot(barplot_traits, # only AMP and HOMDEL
border = TRUE, #height = unit(4, "cm"),
axis_param = list(side = "bottom", labels_rot = 90))))