R/05_visualization_export.R
plot_genediscover_detector_volcano.Rd
This function plots a volcano plot for gene detection using GeneDiscoveR.
plot_genediscover_detector_volcano(
GeneDiscoveRobject = NULL,
annotationTable = NULL,
name = NULL,
title = "",
type = "TPStype",
categories = c("Diterpene", "Bacterial", "Fungi")
)
The GeneDiscoveR object containing the gene detection results.
The annotation table used for filtering genes based on categories. With OG, Gene Tree Parent Clade, GeneID and type columns.
The name of the gene detection result to plot.
The title of the volcano plot.
The type of genes to plot (default is "TPStype"). Is the column name in the annotationTable.
The categories of genes to include in the plot (default is c("Diterpene", "Bacterial", "Fungi")).
A ggplot object representing the volcano plot.
# Create a GeneDiscoveR object
N0sDir <- system.file("extdata", "N0-1dot3-6", package = "GeneDiscoveR")
overallsDir <- system.file("extdata", "Comparatives-1dot3-6", package = "GeneDiscoveR")
dataFile <- system.file("extdata", "annotatedCDSs.tsv", package = "GeneDiscoveR")
minInflation <- 1.3
maxInflation <- 6
stepInflation <- 0.1
GeneDiscoveRobject <- GeneDiscoveR(overallsDir = overallsDir, N0sDir = N0sDir, dataFile = dataFile, minInflation = minInflation, maxInflation = maxInflation, stepInflation = stepInflation)
# Set active run
GeneDiscoveRobject <- set_run_active(GeneDiscoveRobject, InflationValue = 1.8)
#> -----------From OrthoFinder-----------
#> The process has been completed successfully
# Select species by phenotype
GeneDiscoveRobject <- select_species_by_phenotype(GeneDiscoveRobject = GeneDiscoveRobject, columnPhenotype = "Oil-body-type", columnID = "OrthofinderID", type = "one_in_specialized_cell")
GeneDiscoveRobject <- select_species_by_phenotype(GeneDiscoveRobject = GeneDiscoveRobject, columnPhenotype = "Oil-body-type", columnID = "OrthofinderID", type = "many_in_all_cells")
# Gene identification by phenotype
GeneDiscoveRobject <- gene_identification_by_phenotype(GeneDiscoveRobject = GeneDiscoveRobject, formula = as.formula("many_in_all_cells ~ one_in_specialized_cell"), statistic = "Fisher", name = "PerType", cores = 8)
library(readr)
# Load the TPS genes
TPSgenes <- read_tsv(system.file("extdata", "TPSgenes.tsv", package = "GeneDiscoveR"), col_names = TRUE)
#> Rows: 365 Columns: 8
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: "\t"
#> chr (8): Species, Ndna, OrthofinderID, GeneID, collapseID, TPStype, OG, Gene...
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
TPScategories <- c("Diterpene", "Bacterial", "Fungi")
title <- "Fisher's Exact Test per Type of Oil-body with TPS genes"
plot_genediscover_detector_volcano(GeneDiscoveRobject, annotationTable = TPSgenes, title = title, name = "PerType", type = "TPStype", categories = TPScategories)
# Volcano plot with TPS genes
# Output: A ggplot object representing the volcano plot.