Package 'mbX'

Title: A Comprehensive Microbiome Data Processing Pipeline
Description: Provides tools for cleaning, processing, and preparing microbiome sequencing data (e.g., 16S rRNA) for downstream analysis. Supports CSV, TXT, and 'Excel' file formats. The main function, ezclean(), automates microbiome data transformation, including format validation, transposition, numeric conversion, and metadata integration. Also ensures efficient handling of taxonomic levels, resolves duplicated taxa entries, and outputs a well-structured, analysis-ready dataset.
Authors: Utsav Lamichhane [aut, cre]
Maintainer: Utsav Lamichhane <[email protected]>
License: MIT + file LICENSE
Version: 0.1.3
Built: 2025-03-03 13:33:35 UTC
Source: CRAN

Help Index


Clean and Process Microbiome Data

Description

Processes microbiome and metadata files (e.g., 16S rRNA sequencing data) to produce an analysis-ready dataset. Supports CSV, TXT, and 'Excel' file formats. This function validates file formats, reads the data, and merges the datasets by the common column 'SampleID'. If a 'Taxonomy' column exists, the data are filtered to include only rows matching the provided taxonomic level.

Usage

ezclean(microbiome_data, metadata, level = "d")

Arguments

microbiome_data

A string specifying the path to the microbiome data file.

metadata

A string specifying the path to the metadata file.

level

A string indicating the taxonomic level for filtering the data (e.g., "genus").

Value

A data frame containing the cleaned and merged dataset.

Examples

# Example usage (ensure that 'inst/extdata' contains the appropriate files,
  # or modify this example to use your own data)
  microbiome_data <- system.file("extdata", "microbiome.csv", package = "mbX")
  metadata <- system.file("extdata", "metadata.csv", package = "mbX")
  if (nzchar(microbiome_data) && nzchar(metadata)) {
    cleaned_data <- ezclean(microbiome_data, metadata, "genus")
    head(cleaned_data)
  } else {
    message("Sample data files not found.")
  }

Visualize Microbiome Data

Description

Generates publication-ready visualizations for microbiome data. This function first processes the microbiome and metadata files using ezclean(), then creates a bar plot using ggplot2. Supported file formats are CSV, TXT, and 'Excel'. Note: Only one of the parameters top_taxa or threshold should be provided.

Usage

ezviz(
  microbiome_data,
  metadata,
  level,
  selected_metadata,
  top_taxa = NULL,
  threshold = NULL
)

Arguments

microbiome_data

A string specifying the path to the microbiome data file.

metadata

A string specifying the path to the metadata file.

level

A string indicating the taxonomic level for filtering the data (e.g., "genus").

selected_metadata

A string specifying the metadata column used for grouping.

top_taxa

An optional numeric value indicating the number of top taxa to keep. Use this OR threshold, but not both.

threshold

An optional numeric value indicating the minimum threshold value; taxa below this threshold will be grouped into an "Other" category.

Value

A ggplot object containing the visualization.

Examples

# Example usage (ensure that 'inst/extdata' contains the appropriate files):
  microbiome_data <- system.file("extdata", "microbiome.csv", package = "mbX")
  metadata <- system.file("extdata", "metadata.csv", package = "mbX")
  plot_obj <- ezviz(microbiome_data, metadata, "genus", "sample_type", top_taxa = 20)
  print(plot_obj)