diff --git a/R/fusions.R b/R/fusions.R
index 63a6e5c5..77d402e5 100644
--- a/R/fusions.R
+++ b/R/fusions.R
@@ -188,7 +188,7 @@ fusions_table <- function(fusions) {
"fusion_caller"
)
))
- tab1 |>
+ res <- tab1 |>
DT::datatable(
filter = "none", rownames = FALSE, width = 800, height = 490,
escape = FALSE, extensions = c("Buttons", "Scroller"),
@@ -202,9 +202,13 @@ fusions_table <- function(fusions) {
DT::formatStyle(columns = names(tab1), `font-size` = "12px", "text-align" = "center") |>
##### Highlight rows with fusions involving cancer genes or DNA support from MANTA
DT::formatStyle(columns = "Cancer gene(s)", backgroundColor = DT::styleEqual(c(FALSE, TRUE), c("transparent", "lightgrey"))) |>
- DT::formatStyle(columns = "DNA support (A)", backgroundColor = DT::styleEqual(c(FALSE, TRUE), c("transparent", "coral"))) |>
- DT::formatStyle(columns = "DNA support (B)", backgroundColor = DT::styleEqual(c(FALSE, TRUE), c("transparent", "coral"))) |>
DT::formatStyle(columns = "Reported fusion", backgroundColor = DT::styleEqual(c(FALSE, TRUE), c("transparent", "lightgreen")))
+ if (all(c("DNA support (A)", "DNA support (B)") %in% colnames(tab1))) {
+ res <- res |>
+ DT::formatStyle(columns = "DNA support (A)", backgroundColor = DT::styleEqual(c(FALSE, TRUE), c("transparent", "coral"))) |>
+ DT::formatStyle(columns = "DNA support (B)", backgroundColor = DT::styleEqual(c(FALSE, TRUE), c("transparent", "coral")))
+ }
+ return(res)
}
#' RCircos HG38 CytoBandIdeogram Object
diff --git a/inst/rmd/rnasum.Rmd b/inst/rmd/rnasum.Rmd
index fc1ceff5..a6ffbd34 100755
--- a/inst/rmd/rnasum.Rmd
+++ b/inst/rmd/rnasum.Rmd
@@ -1525,8 +1525,15 @@ if (!is.null(add_cancer_group)) {
##### ...gene fusion section: Include only those which are DNA-supported (see Structural variants section) or reported in FusionGDB
ref_genes.list[["summary"]]$Fusion <- NULL
if (runFusionChunk) {
- ref_genes.list[["summary"]]$Fusion <- fusions |>
- dplyr::filter(.data$reported_fusion | .data$geneA_dna_support | .data$geneB_dna_support) |>
+ tmp <- NULL
+ if (runSVsChunk) {
+ tmp <- fusions |>
+ dplyr::filter(.data$reported_fusion | .data$geneA_dna_support | .data$geneB_dna_support)
+ } else {
+ tmp <- fusions |>
+ dplyr::filter(.data$reported_fusion)
+ }
+ ref_genes.list[["summary"]]$Fusion <- tmp |>
dplyr::select("geneA", "geneB") |>
unlist() |>
unique()
@@ -2235,7 +2242,7 @@ Fusion genes detected in transcriptome data are reported if **at least one** of
### - Summary
-Out of the `r if ( runFusionChunk ) { nrow(fusions) } else { c("0") }` fusion event(s) [**`r if ( runFusionChunk ) { nrow(fusions[ fusions$geneA_dna_support | fusions$geneB_dna_support, ]) } else { c("0") }`**]{style="color:#ff0000"} involve **DNA-supported** fusion genes (see [Structural variants] section), [**`r if ( runFusionChunk ) { nrow(fusions[ fusions$reported_fusion, ]) } else { c("0") }`**]{style="color:#02d653"} are **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** and [**`r if ( runFusionChunk ) { nrow(fusions[ fusions$fusions_cancer, ]) } else { c("0") }`**]{style="color:#767689"} involve **[Cancer genes]**.
+Out of the `r if ( runFusionChunk ) { nrow(fusions) } else { c("0") }` fusion event(s) [**`r if ( runFusionChunk && runSVsChunk ) { nrow(fusions[ fusions$geneA_dna_support | fusions$geneB_dna_support, ]) } else { c("0") }`**]{style="color:#ff0000"} involve **DNA-supported** fusion genes (see [Structural variants] section), [**`r if ( runFusionChunk ) { nrow(fusions[ fusions$reported_fusion, ]) } else { c("0") }`**]{style="color:#02d653"} are **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** and [**`r if ( runFusionChunk ) { nrow(fusions[ fusions$fusions_cancer, ]) } else { c("0") }`**]{style="color:#767689"} involve **[Cancer genes]**.
**`r if ( !runFusionChunk ) { c("No fusion genes were detected!") }`**
@@ -2304,10 +2311,10 @@ Fusion events are ordered by the following columns:
### - Genomic view
-[**`r if ( runFusionChunk ) { nrow(fusions[ (fusions$geneA_dna_support | fusions$geneB_dna_support) & fusions$circos, ]) } else { c("0") }`**]{style="color:#ff0000"} **DNA-supported** fusion genes (see [Structural variants] section) and [**`r if ( runFusionChunk ) { nrow(fusions[ fusions$reported_fusion & fusions$circos, ]) } else { c("0") }`**]{style="color:#02d653"} fusions events **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** are presented in the genomic context. [*Red*]{style="color:#ff0000"} is used for links between positions of same chromosomes and [*blue*]{style="color:#0000ff"} for links between different chromosomes. The table at the bottom contains genomic coordinates of individual fusion genes sorted by their genomic location.
+[**`r if ( runFusionChunk && runSVsChunk ) { nrow(fusions[ (fusions$geneA_dna_support | fusions$geneB_dna_support) & fusions$circos, ]) } else { c("0") }`**]{style="color:#ff0000"} **DNA-supported** fusion genes (see [Structural variants] section) and [**`r if ( runFusionChunk ) { nrow(fusions[ fusions$reported_fusion & fusions$circos, ]) } else { c("0") }`**]{style="color:#02d653"} fusions events **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** are presented in the genomic context. [*Red*]{style="color:#ff0000"} is used for links between positions of same chromosomes and [*blue*]{style="color:#0000ff"} for links between different chromosomes. The table at the bottom contains genomic coordinates of individual fusion genes sorted by their genomic location.
[NOTE]{style="color:#ff0000"}:
-**`r if ( runFusionChunk ) { nrow(fusions[ (fusions$geneA_dna_support | fusions$geneB_dna_support) & fusions$circos, ]) } else { c("0") }`** of such fusions do not have genomic information available and are not presented on the *circos plot* (see *Genomic view* column in the [- Summary] table).
+**`r if ( runFusionChunk && runSVsChunk ) { nrow(fusions[ (fusions$geneA_dna_support | fusions$geneB_dna_support) & fusions$circos, ]) } else { c("0") }`** of such fusions do not have genomic information available and are not presented on the *circos plot* (see *Genomic view* column in the [- Summary] table).
`r if ( !runSVsChunk ) { c("Genomic data for this sample is **NOT AVAILABLE**.") }`
@@ -4510,12 +4517,17 @@ cat(drugsTable_legend)
`r if ( params$drugs && !runFusionChunk ) { c("Fusion genes information for this sample is **NOT AVAILABLE**.") }`
-`r if ( params$drugs && runFusionChunk ) { paste0("**", nrow(fusions[ fusions$geneA_dna_support == "Yes" | fusions$geneB_dna_support == "Yes" , ]), "** **DNA-supported** fusion genes (see [Structural variants] section) and **", nrow(fusions[ fusions$reported_fusion == "Yes" , ]), "** gene fusions **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** were screened for suitable drugs.") } else if ( params$drugs && !runFusionChunk ) { paste0("**0** involving **DNA-supported** fusion genes (see [Structural variants] section) and **0** gene fusions **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** were screened for suitable drugs.") }`
+`r if ( params$drugs && runFusionChunk && runSVsChunk ) { paste0("**", nrow(fusions[ fusions$geneA_dna_support == "Yes" | fusions$geneB_dna_support == "Yes" , ]), "** **DNA-supported** fusion genes (see [Structural variants] section) and **", nrow(fusions[ fusions$reported_fusion == "Yes" , ]), "** gene fusions **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** were screened for suitable drugs.") } else if ( params$drugs && !runFusionChunk ) { paste0("**0** involving **DNA-supported** fusion genes (see [Structural variants] section) and **0** gene fusions **reported in [FusionGDB](https://ccsm.uth.edu/FusionGDB)** were screened for suitable drugs.") }`
```{r drugs_predictive_fusion_genes, comment = NA, message=FALSE, warning=FALSE, eval = runFusionChunk}
##### Generate table with drugs targeting fusion genes
-genesA <- as.vector(fusions[fusions_ann$reported_fusion == "Yes" | fusions_ann$geneA_dna_support == "Yes" | fusions_ann$geneB_dna_support == "Yes", ]$geneA)
-genesB <- as.vector(fusions[fusions_ann$reported_fusion == "Yes" | fusions_ann$geneA_dna_support == "Yes" | fusions_ann$geneB_dna_support == "Yes", ]$geneB)
+if (runSVsChunk) {
+ genesA <- as.vector(fusions[fusions_ann$reported_fusion == "Yes" | fusions_ann$geneA_dna_support == "Yes" | fusions_ann$geneB_dna_support == "Yes", ]$geneA)
+ genesB <- as.vector(fusions[fusions_ann$reported_fusion == "Yes" | fusions_ann$geneA_dna_support == "Yes" | fusions_ann$geneB_dna_support == "Yes", ]$geneB)
+} else {
+ genesA <- as.vector(fusions[fusions_ann$reported_fusion == "Yes", ]$geneA)
+ genesB <- as.vector(fusions[fusions_ann$reported_fusion == "Yes", ]$geneB)
+}
drugsTable.fusion_genes <- RNAsum::civicDrugTable(
genes = unique(c(genesA, genesB)),