Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubles in the tutorial with plotEnrichHeatmap followed by ComplexHeatmap::draw #2226

Open
alekseybelikov opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alekseybelikov
Copy link

Attach your log file
ArchR-plotEnrichHeatmap-32564018f95d-Date-2024-10-25_Time-20-25-52.634833.log

Describe the bug

  1. Wherever there is plotEnrichHeatmap function followed by ComplexHeatmap::draw functtion, e.g.
heatmapEM <- plotEnrichHeatmap(enrichMotifs)
ComplexHeatmap::draw(heatmapEM, heatmap_legend_side = "bot", annotation_legend_side = "bot")

the following error occurs:

Error in grid.Call.graphics(C_downvppath, name$path, name$name, strict): Viewport 'Norm. Enrichment -log10(P-adj) [0-Max]_heatmap_body_1_1' was not found

  1. The same error occurs if instead of

ComplexHeatmap::draw(heatmapEM, heatmap_legend_side = "bot", annotation_legend_side = "bot")

a simple draw(heatmapEM) is used.

  1. Interestingly, draw works with no issues after plotMarkerHeatmap
heatmapPeaks <- plotMarkerHeatmap(
  seMarker = markersPeaks, 
  cutOff = "FDR <= 0.1 & Log2FC >= 0.5",
  transpose = TRUE
)

draw(heatmapPeaks)

To Reproduce
Reproduced multiple times in the tutorial, e.g

heatmapEncode <- plotEnrichHeatmap(enrichEncode, n = 7, transpose = TRUE)
ComplexHeatmap::draw(heatmapEncode, heatmap_legend_side = "bot", annotation_legend_side = "bot")
heatmapATAC <- plotEnrichHeatmap(enrichATAC, n = 7, transpose = TRUE)
ComplexHeatmap::draw(heatmapATAC, heatmap_legend_side = "bot", annotation_legend_side = "bot")
heatmapCodex <- plotEnrichHeatmap(enrichCodex, n = 7, transpose = TRUE)
ComplexHeatmap::draw(heatmapCodex, heatmap_legend_side = "bot", annotation_legend_side = "bot")
heatmapRegions <- plotEnrichHeatmap(enrichRegions, n = 7, transpose = TRUE)
ComplexHeatmap::draw(heatmapRegions, heatmap_legend_side = "bot", annotation_legend_side = "bot")

Expected behavior
No error and the heatmap plotted

Workaround
With the help of Claude I was able to devise a painful workaround:

# extract matrix from an existing heatmap object:
mat <- heatmapEM@ht_list[[1]]@matrix


# Create new heatmap with simplified parameters
new_heatmap <- Heatmap(
    matrix = mat,
    name = "Norm. Enrichment",
    # Use a simple blue color scheme
    col = colorRamp2(c(0, 0.5, 1), c("#E6E7E8", "#6156D2", "#000000")),
    # Basic clustering
    cluster_columns = TRUE,
    cluster_rows = TRUE,
    # Column settings
    column_names_rot = 90,
    column_names_gp = gpar(fontsize = 10),
    # Legend settings
    heatmap_legend_param = list(
        title = "Norm. Enrichment",
        direction = "horizontal",
        legend_width = unit(4, "cm")
    ),
    # Add some padding
    bottom_annotation = NULL,
    show_row_names = TRUE,
    row_names_gp = gpar(fontsize = 5),
    # Add borders for better visibility
    rect_gp = gpar(col = "white", lwd = 0.5)
)

draw(new_heatmap)

It worked.

But this is really not what I want to do for every heatmap.

@alekseybelikov alekseybelikov added the bug Something isn't working label Oct 25, 2024
@rcorces
Copy link
Collaborator

rcorces commented Oct 25, 2024

Hi @alekseybelikov! Thanks for using ArchR! Lately, it has been very challenging for me to keep up with maintenance of this package and all of my other
responsibilities as a PI. I have not been responding to issue posts and I have not been pushing updates to the software. We are actively searching to hire
a computational biologist to continue to develop and maintain ArchR and related tools. If you know someone who might be a good fit, please let us know!
In the meantime, your issue will likely go without a reply. Most issues with ArchR right not relate to compatibility. Try reverting to R 4.1 and Bioconductor 3.15.
Newer versions of Seurat and Matrix also are causing issues. Sorry for not being able to provide active support for this package at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants