diff --git a/NAMESPACE b/NAMESPACE index df42d71..c487e94 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -32,6 +32,7 @@ export(plotKEGGPathway) export(plotPCA) export(plotTree) export(setAnnotation) +export(setTree) export(strainClusterHeatmap) export(summariseAbundance) import(BiocFileCache) diff --git a/R/plotCirclize.R b/R/plotCirclize.R index 660db03..83061bd 100644 --- a/R/plotCirclize.R +++ b/R/plotCirclize.R @@ -21,6 +21,7 @@ #' @param returnRawDf return the raw data frame used in the plot #' @param featCircos which type of circos to use in the corresponding feature #' @param include_gene include these gene IDs, ignoring the thesh_snp_gene argument +#' @param only_genome_id show only the genome IDs #' @importFrom circlize CELL_META circos.clear circos.par circos.initialize circos.rect circos.barplot circos.track circos.text circos.points #' @return draw circlize plot #' @export @@ -30,7 +31,7 @@ plotCirclize <- function(stana, candSp, genomeId, include_gene=NULL, cols=c("tomato","steelblue","gold","seagreen"), controlColor="steelblue", MAF=FALSE, cl=NULL, featCircos=list(), showGeneName=TRUE, - returnRawDf=FALSE, + returnRawDf=FALSE, only_genome_id=FALSE, featThresh=0, cex=0.3, textCex=0.5,bar_width=10, contPalette=c("steelblue", "tomato"), discPalette="Dark2") { @@ -76,16 +77,18 @@ plotCirclize <- function(stana, candSp, genomeId, include_gene=NULL, qqcat("Genome ID in SNV information:\n") for (i in unique(info$genome_id)) { tmp_info <- subset(info, genome_id==i) - qqcat(" @{i}: @{min(tmp_info$position)} - @{max(tmp_info$position)}, number of position: @{nrow(tmp_info)}\n") + qqcat(" @{i}: @{min(tmp_info$position)} - @{max(tmp_info$position)}", + ", number of position: @{nrow(tmp_info)}\n") } + if (only_genome_id) {return(1)} + qqcat("Genome ID: @{genomeId}\n") ## Deleting "None" and gene ids with only one position info$genome_id <- info$genome_id |> strsplit("_") |> vapply("[", 1, FUN.VALUE="character") circ_plot <- subset(info, info$genome_id==genomeId) - if (length(featList)>0) { for (nm in names(featList)) { circ_plot[[nm]] <- featList[[nm]][row.names(circ_plot)] @@ -99,9 +102,9 @@ plotCirclize <- function(stana, candSp, genomeId, include_gene=NULL, circ_plot <- subset(circ_plot, !circ_plot$gene_id %in% names(gene_num[gene_numcutoff, 1, 0)) |> data.frame() +} + +#' setTree +#' @param stana stana object +#' @param species species ID +#' @param tre tree to be set +#' @export +#' @return stana +setTree <- function(stana, species, tre) { + if (class(tre)!="phylo") {stop("Please provide phylo object")} + stana@treeList[[species]] <- tre + return(stana) } \ No newline at end of file diff --git a/man/plotCirclize.Rd b/man/plotCirclize.Rd index 0ee2069..9196cd3 100644 --- a/man/plotCirclize.Rd +++ b/man/plotCirclize.Rd @@ -18,6 +18,7 @@ plotCirclize( featCircos = list(), showGeneName = TRUE, returnRawDf = FALSE, + only_genome_id = FALSE, featThresh = 0, cex = 0.3, textCex = 0.5, @@ -53,6 +54,8 @@ plotCirclize( \item{returnRawDf}{return the raw data frame used in the plot} +\item{only_genome_id}{show only the genome IDs} + \item{featThresh}{for numeric features, the values above this value will be colored , default to zero.} \item{cex}{point size} diff --git a/man/setTree.Rd b/man/setTree.Rd new file mode 100644 index 0000000..aaf2da8 --- /dev/null +++ b/man/setTree.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{setTree} +\alias{setTree} +\title{setTree} +\usage{ +setTree(stana, species, tre) +} +\arguments{ +\item{stana}{stana object} + +\item{species}{species ID} + +\item{tre}{tree to be set} +} +\value{ +stana +} +\description{ +setTree +}