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

Tools tab not working when saved in HTML #12

Open
michael-kotliar opened this issue Oct 24, 2022 · 0 comments
Open

Tools tab not working when saved in HTML #12

michael-kotliar opened this issue Oct 24, 2022 · 0 comments

Comments

@michael-kotliar
Copy link

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
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant