load_taxa_table: Load a taxa table for use with mctoolsr

View source: R/input_output_filter.R

load_taxa_tableR Documentation

Load a taxa table for use with mctoolsr

Description

Load in a taxa table (also known as an OTU table) and a corresponding mapping file with metadata values. The samples in the loaded taxa table and mapping file will be in the same order and only samples in both will be loaded. The function can optionally filter samples of a specific type based on the mapping file. This can also be done later via the filter_data function.

Usage

load_taxa_table(tab_fp, map_fp, filter_cat, filter_vals, keep_vals, taxa_fp)

Arguments

tab_fp

Taxa table filepath.

map_fp

Metadata mapping filepath.

filter_cat

[OPTIONAL] The map_fp header string for the factor you would like to use to filter samples.

filter_vals

[OPTIONAL] The values within the filter category (vector or single value) you would like to use to remove samples from the imported data.

keep_vals

[OPTIONAL] Alternatively, keep only samples represented by these values.

taxa_fp

[OPTIONAL] If taxonomy is not contained in the taxa table, you can supply a tab-delimited file with the taxon ID in the first column and the taxonomy in the second column. It assumes no header line in the file. Lines beginning with '#' are ignored.

Value

A list variable with (1) the loaded taxa table, (2) the loaded mapping file, and optionally (3) the loaded taxonomy.

Examples

## Not run: 
load_taxa_table("filepath_to_taxa_table.txt", "filepath_to_mapping_file.txt",
  "sample_type", filter_vals = "blank")

## End(Not run)

leffj/mctoolsr documentation built on Aug. 5, 2022, 1:27 a.m.