Skip to content

Tools tab not working when saved in HTML #12

Description

@michael-kotliar

Hello,
I'm trying to export the heatmap to an HTML file and everything works fine except for some of the tools from the Tools tab. When I try to run, for example, Hierarchical Clustering it shows an Error. And I can't see anything that explains this error in the browser console.

Here is the code I run. It can be tested with any GCT input file. Produced HTML file can be opened in the Web Browser.

#!/usr/bin/env Rscript
options(warn=-1)
options("width"=200)
options(error=function(){traceback(3); quit(save="no", status=1, runLast=FALSE)})

suppressMessages(library(morpheus))
suppressMessages(library(argparse))
suppressMessages(library(htmlwidgets))


get_args <- function(){
    parser <- ArgumentParser(description="Morpheus heatmap from GCT file")
    parser$add_argument(
        "--gct",
        help=paste(
            "Path to the input GCT file."
        ),
        type="character", required="True"
    )
    parser$add_argument(
        "--output",
        help=paste(
            "Output prefix for generated files"
        ),
        type="character", default="./heatmap"
    )
    args <- parser$parse_args(commandArgs(trailingOnly = TRUE))
    return (args)
}

# Parse arguments
args <- get_args()

print("Used parameters")
print(args)

print(paste("Loading GCT data from", args$gct))
gct_data <- read.gct(args$gct)

morpheus_html <- morpheus(
    x=gct_data$data,
    rowAnnotations=if(nrow(gct_data$rowAnnotations) == 0) NULL else gct_data$rowAnnotations,
    columnAnnotations=if(nrow(gct_data$columnAnnotations) == 0) NULL else gct_data$columnAnnotations
)

html_location <- paste0(args$output, ".html")
print(paste("Saving heatmap to", html_location))
htmlwidgets::saveWidget(
    morpheus_html,
    file=html_location
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions