summary_annotation_table: Summary of Annotation Table with Plot

View source: R/4_utils.R

summary_annotation_tableR Documentation

Summary of Annotation Table with Plot

Description

This function generates a summary of an annotation table from a 'mass_dataset' object or a user-provided object. The function filters annotation data based on a specified 'Level' and creates a polar bar plot to visualize the distribution of annotations across levels and databases.

Usage

summary_annotation_table(object, level = c(1, 2, 3, 4))

Arguments

object

Either a 'mass_dataset' object or a data frame containing annotation information.

level

A numeric vector specifying the annotation levels to include in the summary. Defaults to levels 1, 2, 3, and 4.

Details

If the input is a 'mass_dataset' object, the function extracts the annotation information using the 'massdataset::extract_variable_info' function. For non-'mass_dataset' objects, it expects the input to be in a specific format and selects the most relevant annotations based on the 'Level', 'SS', and 'Total.score' columns.

The function then filters out annotations with missing 'Compound.name' and those that are not in the specified 'level'. It calculates the number and percentage of annotations by level and database, which are visualized in a polar bar plot.

Value

A ggplot2 object representing a polar bar plot of the annotation summary, showing the number and percentage of annotations by level and database.

Author(s)

Xiaotao Shen xiaotao.shen@outlook.com

Examples

## Not run: 
# For a mass_dataset object:
summary_annotation_table(mass_object, level = c(1, 2, 3))

# For a custom annotation table:
custom_annotation <- data.frame(variable_id = ..., 
Level = ..., SS = ..., Total.score = ..., Compound.name = ...)
summary_annotation_table(custom_annotation, level = c(1, 2))

## End(Not run)


tidymass/metid documentation built on Oct. 8, 2024, 10:32 p.m.