Closed ronfinn closed 4 years ago
for this line:
plot.atac <- assay(esca.rse)[result$FDR < fdr.cut.off & abs(result$ESCC_minus_ESAD) > diff.cut.off,]
Is plot.atac
a matrix? How big is it?
And can you copy the message from trackback()
after the error?
Thanks for getting back to me:
Here is the output from the trackback()
> traceback()
22: lapply(labels_mat[, i], function(x) {
g = grobWidth(textGrob(x, gp = labels_gp))
if (i < ncol) {
g = g + gap
}
g
})
21: do.call("unit.c", lapply(labels_mat[, i], function(x) {
g = grobWidth(textGrob(x, gp = labels_gp))
if (i < ncol) {
g = g + gap
}
g
}))
20: discrete_legend_body(at = at, labels = labels, nrow = nrow, ncol = ncol,
grid_height = grid_height, grid_width = grid_width, gap = gap,
labels_gp = labels_gp, border = border, background = background,
type = type, legend_gp = legend_gp, pch = pch, size = size,
by_row = by_row)
19: Legend(at = at, labels = labels, title = title, title_gp = title_gp,
grid_height = grid_height, grid_width = grid_width, border = border,
labels_gp = labels_gp, direction = legend_direction, nrow = nrow,
ncol = ncol, legend_gp = gpar(fill = map_to_colors(object,
at)), title_position = title_position, by_row = by_row)
18: .local(object, ...)
17: color_mapping_legend(ColorMappingList2[[i]], param = ColorMappingParamList2[[i]],
plot = FALSE, ...)
16: color_mapping_legend(ColorMappingList2[[i]], param = ColorMappingParamList2[[i]],
plot = FALSE, ...)
15: FUN(X[[i]], ...)
14: lapply(seq_along(ColorMappingList2), function(i) color_mapping_legend(ColorMappingList2[[i]],
param = ColorMappingParamList2[[i]], plot = FALSE, ...))
13: draw_legend(ColorMappingList, ColorMappingParamList, side = side,
plot = FALSE, legend_list = legend_list, padding = padding,
...)
12: .local(object, ...)
11: annotation_legend_size(object, legend_list = annotation_legend_list,
max_height = calc_legends_max_height(object))
10: annotation_legend_size(object, legend_list = annotation_legend_list,
max_height = calc_legends_max_height(object))
9: .local(object, ...)
8: make_layout(object, row_title = row_title, row_title_side = row_title_side,
row_title_gp = row_title_gp, column_title = column_title,
column_title_side = column_title_side, column_title_gp = column_title_gp,
heatmap_legend_side = heatmap_legend_side, merge_legends = merge_legends,
show_heatmap_legend = show_heatmap_legend, heatmap_legend_list = heatmap_legend_list,
annotation_legend_side = annotation_legend_side, show_annotation_legend = show_annotation_legend,
annotation_legend_list = annotation_legend_list, ht_gap = ht_gap,
main_heatmap = main_heatmap, padding = padding, auto_adjust = auto_adjust,
row_dend_side = row_dend_side, row_sub_title_side = row_sub_title_side,
column_dend_side = column_dend_side, column_sub_title_side = column_sub_title_side,
row_gap = row_gap, cluster_rows = cluster_rows, cluster_row_slices = cluster_row_slices,
clustering_distance_rows = clustering_distance_rows, clustering_method_rows = clustering_method_rows,
row_dend_width = row_dend_width, show_row_dend = show_row_dend,
row_dend_reorder = row_dend_reorder, row_dend_gp = row_dend_gp,
row_order = row_order, row_km = row_km, row_km_repeats = row_km_repeats,
row_split = row_split, height = height, heatmap_height = heatmap_height,
column_gap = column_gap, cluster_columns = cluster_columns,
cluster_column_slices = cluster_column_slices, clustering_distance_columns = clustering_distance_columns,
clustering_method_columns = clustering_method_columns, column_dend_width = column_dend_width,
show_column_dend = show_column_dend, column_dend_reorder = column_dend_reorder,
column_dend_gp = column_dend_gp, column_order = column_order,
column_km = column_km, column_km_repeats = column_km_repeats,
column_split = column_split, width = width, heatmap_width = heatmap_width)
7: make_layout(object, row_title = row_title, row_title_side = row_title_side,
row_title_gp = row_title_gp, column_title = column_title,
column_title_side = column_title_side, column_title_gp = column_title_gp,
heatmap_legend_side = heatmap_legend_side, merge_legends = merge_legends,
show_heatmap_legend = show_heatmap_legend, heatmap_legend_list = heatmap_legend_list,
annotation_legend_side = annotation_legend_side, show_annotation_legend = show_annotation_legend,
annotation_legend_list = annotation_legend_list, ht_gap = ht_gap,
main_heatmap = main_heatmap, padding = padding, auto_adjust = auto_adjust,
row_dend_side = row_dend_side, row_sub_title_side = row_sub_title_side,
column_dend_side = column_dend_side, column_sub_title_side = column_sub_title_side,
row_gap = row_gap, cluster_rows = cluster_rows, cluster_row_slices = cluster_row_slices,
clustering_distance_rows = clustering_distance_rows, clustering_method_rows = clustering_method_rows,
row_dend_width = row_dend_width, show_row_dend = show_row_dend,
row_dend_reorder = row_dend_reorder, row_dend_gp = row_dend_gp,
row_order = row_order, row_km = row_km, row_km_repeats = row_km_repeats,
row_split = row_split, height = height, heatmap_height = heatmap_height,
column_gap = column_gap, cluster_columns = cluster_columns,
cluster_column_slices = cluster_column_slices, clustering_distance_columns = clustering_distance_columns,
clustering_method_columns = clustering_method_columns, column_dend_width = column_dend_width,
show_column_dend = show_column_dend, column_dend_reorder = column_dend_reorder,
column_dend_gp = column_dend_gp, column_order = column_order,
column_km = column_km, column_km_repeats = column_km_repeats,
column_split = column_split, width = width, heatmap_width = heatmap_width)
6: .local(object, ...)
5: draw(ht_list, ...)
4: draw(ht_list, ...)
3: .local(object, ...)
2: draw(ht_list, newpage = TRUE, column_title = paste0("ATAC-seq ESCC vs ESAD (FDR < ",
fdr.cut.off, ", Diff mean log2 Count > ", diff.cut.off,
")"), column_title_gp = gpar(fontsize = 12, fontface = "bold"),
heatmap_legend_side = "bottom", annotation_legend_side = "right")
1: draw(ht_list, newpage = TRUE, column_title = paste0("ATAC-seq ESCC vs ESAD (FDR < ",
fdr.cut.off, ", Diff mean log2 Count > ", diff.cut.off,
")"), column_title_gp = gpar(fontsize = 12, fontface = "bold"),
heatmap_legend_side = "bottom", annotation_legend_side = "right")
I think it might due to the format of plot.atac
is not correct. Can you paste the output from str(plot.atac)
?
Thank you, here you go:
> str(plot.atac)
num [1:4067, 1:33] 1.59 1.74 1.29 1.54 1.29 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:4067] "ESCA_61_chr1_1124660_1125159" "ESCA_62_chr1_1125161_1125660" "ESCA_66_chr1_1136429_1136928" "ESCA_364_chr1_2048227_2048726" ...
..$ : chr [1:33] "ESCC-TCGA-IG-A51D-01A" "ESCC-TCGA-IG-A51D-01A" "ESCC-TCGA-LN-A9FQ-01A" "ESCC-TCGA-LN-A9FQ-01A" ...
Ah, sorry it has nothing to be with the matrix. This is a problem of the annotation:
> > ha = HeatmapAnnotation(df = data.frame("Group" = esca.rse$primary_diagnosis,
> "Replicate" = stringr::str_match(colnames(esca.rse),"rep[0-9]?")),
> show_annotation_name = T,
> col = list(Group = c("Squamous cell carcinoma, NOS" = "red",
> "Adenocarcinoma, NOS" = "blue")),
> show_legend = T,
> annotation_name_side = "left",
> annotation_name_gp = gpar(fontsize = 6))
What are the values of
data.frame("Group" = esca.rse$primary_diagnosis,
> "Replicate" = stringr::str_match(colnames(esca.rse),"rep[0-9]?"))
?
>data.frame("Group" = esca.rse$primary_diagnosis, "Replicate" = stringr::str_match(colnames(esca.rse),"rep[0-9]?"))
Group Replicate
1 Squamous cell carcinoma, NOS <NA>
2 Squamous cell carcinoma, NOS <NA>
3 Squamous cell carcinoma, NOS <NA>
4 Squamous cell carcinoma, NOS <NA>
5 Adenocarcinoma, NOS <NA>
6 Adenocarcinoma, NOS <NA>
7 Adenocarcinoma, NOS <NA>
8 Adenocarcinoma, NOS <NA>
9 Squamous cell carcinoma, NOS <NA>
10 Squamous cell carcinoma, NOS <NA>
11 Adenocarcinoma, NOS <NA>
12 Adenocarcinoma, NOS <NA>
13 Squamous cell carcinoma, NOS <NA>
14 Squamous cell carcinoma, NOS <NA>
15 Squamous cell carcinoma, NOS <NA>
16 Squamous cell carcinoma, NOS <NA>
17 Squamous cell carcinoma, NOS <NA>
18 Adenocarcinoma, NOS <NA>
19 Adenocarcinoma, NOS <NA>
20 Squamous cell carcinoma, NOS <NA>
21 Squamous cell carcinoma, NOS <NA>
22 Squamous cell carcinoma, NOS <NA>
23 Squamous cell carcinoma, NOS <NA>
24 Squamous cell carcinoma, NOS <NA>
25 Squamous cell carcinoma, NOS <NA>
26 Squamous cell carcinoma, NOS <NA>
27 Squamous cell carcinoma, NOS <NA>
28 Squamous cell carcinoma, NOS <NA>
29 Squamous cell carcinoma, NOS <NA>
30 Adenocarcinoma, NOS <NA>
31 Adenocarcinoma, NOS <NA>
32 Adenocarcinoma, NOS <NA>
33 Adenocarcinoma, NOS <NA>
The second column (Replicate) are all NA. I think that causes the error.
Thanks for your reply, Any suggestions for how I fix this? Sorry, new to R and I am having trouble trying to authour of this script to respond. BW, R.
Can you just remove it? It is all NAs and provides no information.
And by the way, what does this line do:
"Replicate" = stringr::str_match(colnames(esca.rse),"rep[0-9]?"))
I think you might have done something wrong with using str_match()
. Maybe nothing in the column names matches rep[0-9]?
? Maybe you can change it to rep[0-9]*
to match any number of digits?
Hi there,
I am new to using R and I was just trying to run a R script that someone lese has provided and I have run across the following error when using ComplexHeatmap:
I was wonder if you can tell me where I am going wrong?
Kind Regards,
R.