From a750286c3e9140454739a0ffe7cb7a8be92f2376 Mon Sep 17 00:00:00 2001 From: Martha Sudermann Date: Mon, 22 Jan 2024 15:41:09 -0800 Subject: [PATCH 1/4] Updates to report-psminer troubleshooting --- assets/main_report/index.qmd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/main_report/index.qmd b/assets/main_report/index.qmd index 836bceb7..c0461ded 100644 --- a/assets/main_report/index.qmd +++ b/assets/main_report/index.qmd @@ -22,6 +22,7 @@ library(phylocanvas) library(ape) library(magrittr) library(pheatmap) +library(heatmaply) library(tidyverse) library(palmerpenguins) library(ade4) @@ -386,9 +387,9 @@ heatmap_ani <- pheatmap(ani_matrix_format, show_rownames = T, labels_row =colnam *Things to address:* -1. There are lots of NAs in metadata. I ran into issues when trying run poppr and I was trying to select a specific column to color nodes. As a quick workaround, changed these to 'unknown', but what is a better solution? -2. The assembly prefix in sample names present in SNP aln output and treefile need to be addressed. In initial tool testing stage, I (Martha) have provided some quick workarounds, but this should be addressed at a larger level. -3. Need to clarify to use what REF is in the SNP tree or else rename +1. There are lots of NAs in metadata. I ran into issues when trying run poppr. I was trying to select a specific factor to color nodes by. As a quick workaround, changed these to 'unknown', but what is a better solution? +2. The assembly prefix in sample names present in SNP aln output and treefile need to be discussed. In initial tool testing stage, I (Martha) have provided some quick workarounds, but this should be addressed at a larger level. +3. Need to clarify whether to use REF in the SNP tree or else rename ```{r div_parse_inputs} snp_trees <- ape::read.tree(snp_tree_paths) From 201430c44f5faa9381759f441e17dba8ac87d71e Mon Sep 17 00:00:00 2001 From: Martha Sudermann Date: Mon, 22 Jan 2024 17:42:36 -0800 Subject: [PATCH 2/4] Simplify ANI command --- assets/main_report/index.qmd | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/assets/main_report/index.qmd b/assets/main_report/index.qmd index c0461ded..1e037d60 100644 --- a/assets/main_report/index.qmd +++ b/assets/main_report/index.qmd @@ -38,6 +38,7 @@ library(kableExtra) library(plotly) library(webshot2) library(metacoder) +devtools::install_github("grunwaldlab/psminer") library(psminer) library(ggdendro) ``` @@ -206,7 +207,6 @@ DT::datatable(final_table, # column_spec(5, extra_css = "width: 350px;") %>% # column_spec(1:5, extra_css = "font-size: 14px;") - ``` ::: callout-note @@ -365,21 +365,7 @@ ggtree_ani *TODO Relabel the row names if we opt to use heatmap, otherwise, maybe just NJ tree. Martha will look at this.* ```{r ANI dendrogram, fig.height = 8, fig.width=8} -ani_matrix_format <-as.matrix(ani_matrix) -colnames(ani_matrix_format) <- convert_id(colnames(ani_matrix_format)) -rownames(ani_matrix_format) <- convert_id(rownames(ani_matrix_format)) - -name_key <- c( - setNames(ref_data$Organism, convert_id(ref_data$LastMajorReleaseAccession)), - setNames(samp_data$sample, convert_id(samp_data$sample)), - setNames(assembly_entries, assembly_entries) -) - -# Relabel the tree tips -colnames(ani_matrix_format) <- name_key[colnames(ani_matrix_format)] -rownames(ani_matrix_format) <- name_key[rownames(ani_matrix_format)] - -heatmap_ani <- pheatmap(ani_matrix_format, show_rownames = T, labels_row =colnames(ani_matrix_format)) +psminer::make_ani_heatmap(ani_matrix, ref_data, samp_data, interactive = FALSE) ``` ::: From 70e364847ea91f613e30b29e8dc305d4a2437b57 Mon Sep 17 00:00:00 2001 From: Martha Sudermann Date: Mon, 22 Jan 2024 17:44:04 -0800 Subject: [PATCH 3/4] Updates incorporating psminer fxns --- assets/main_report/index.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/main_report/index.qmd b/assets/main_report/index.qmd index 1e037d60..7d57a43c 100644 --- a/assets/main_report/index.qmd +++ b/assets/main_report/index.qmd @@ -362,7 +362,7 @@ ggtree_ani ### ANI heatmap and dendrogram -*TODO Relabel the row names if we opt to use heatmap, otherwise, maybe just NJ tree. Martha will look at this.* +*TODO still want option to make interactive plot, but with the renaming of columns and rows, some of the interative heatmap fxns fail to work. Still looking at how to simplify this. ```{r ANI dendrogram, fig.height = 8, fig.width=8} psminer::make_ani_heatmap(ani_matrix, ref_data, samp_data, interactive = FALSE) From d0710fb837ee1bb017016aaf3e490b6b38f39505 Mon Sep 17 00:00:00 2001 From: Martha Sudermann Date: Mon, 22 Jan 2024 17:50:38 -0800 Subject: [PATCH 4/4] Update report as we test out psminer fxns --- assets/main_report/index.qmd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/main_report/index.qmd b/assets/main_report/index.qmd index 7d57a43c..3e25cef5 100644 --- a/assets/main_report/index.qmd +++ b/assets/main_report/index.qmd @@ -266,6 +266,8 @@ plot_ly( ::: panel-tabset ### Core phylogeny +TODO-make psminer function, where plot is interactive if output is HTML, and not, if PDF. Ensure that dimensions are correct. + ```{r id_core_phylo, eval = length(read_lines(core_phylo_path)) > 0} convert_id <- function(ids) { gsub(ids, pattern = "[.-]", replacement = "_") @@ -362,7 +364,7 @@ ggtree_ani ### ANI heatmap and dendrogram -*TODO still want option to make interactive plot, but with the renaming of columns and rows, some of the interative heatmap fxns fail to work. Still looking at how to simplify this. +*TODO still want option to make interactive plot if output is an HTML file, but with the renaming of columns and rows, some of the interative heatmap fxns fail to work. Still looking at how to simplify this. ```{r ANI dendrogram, fig.height = 8, fig.width=8} psminer::make_ani_heatmap(ani_matrix, ref_data, samp_data, interactive = FALSE)