Package 'ggtaxplot'

Title: Create Plots to Visualize Taxonomy
Description: Provides a comprehensive suite of functions for processing and visualizing taxonomic data. It includes functionality to clean and transform taxonomic data, categorize it into hierarchical ranks (such as Phylum, Class, Order, Family, and Genus), and calculate the relative abundance of each category. The package also generates a color palette for visual representation of the taxonomic data, allowing users to easily identify and differentiate between various taxonomic groups. Additionally, it features a river plot visualization to effectively display the distribution of individuals across different taxonomic ranks, facilitating insights into taxonomic visualization.
Authors: Clement Coclet [aut, cre] (GITLAB: https://gitlab.com/ccoclet/)
Maintainer: Clement Coclet <[email protected]>
License: GPL-3
Version: 0.0.1
Built: 2024-12-21 03:46:27 UTC
Source: CRAN

Help Index


ggtaxplot Process and Plot Taxonomic Data

Description

This function processes data and generates a taxonomic river plot.

Usage

ggtaxplot(
  data,
  ID_col = "ID",
  tax_col = "Taxonomy",
  rm_NA = FALSE,
  threshold = 2,
  custom_colors = NULL
)

Arguments

data

A data frame containing two columns: ID and Taxonomy.

ID_col

A column with ID values.

tax_col

A column with Taxonomy.

rm_NA

A logical value indicating whether to remove rows where the taxonomy column is 'Unknown' or NA. Default is FALSE.

threshold

A numeric threshold for filtering low-abundance taxa (Others).

custom_colors

Optional custom colors assigned to phyla.

Value

A ggplot object of the river plot.

Examples

# Example data frame
data <- data.frame(
 ID = c("ID1", "ID2", "ID3"),
 Taxonomy = c("d__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;\
 o__Enterobacterales;f__Enterobacteriaceae;g__Escherichia",
            "d__Bacteria;p__Actinobacteria;c__Actinobacteria;\
            o__Corynebacteriales;f__Corynebacteriaceae;g__Corynebacterium",
            "d__Bacteria;p__Firmicutes;c__Bacilli;\
            o__Bacillales;f__Bacillaceae;g__Bacillus")
            )
# Generate the river plot
plot <- ggtaxplot(data)
print(plot)

Lighten a Color

Description

This function lightens a given color by a specified factor.

Usage

lighten_color(color, factor)

Arguments

color

A character string representing a color in any valid format (e.g., hex code, color name).

factor

A numeric value between 0 and 1 indicating the amount to lighten the color. A factor of 0 means no change, while a factor of 1 results in white.

Value

A character string representing the lightened color in RGB format.