Skip to content
mbarbini edited this page Jul 18, 2019 · 15 revisions

How to source microbial data

Files

HeatMap.R

Functions


load.abundance.data

Description

load.abundance.data() is a method for loading abundance table in .csv files in the appropriate format for use with the heat map creating functions

Usage

load.abundance.data(path, column = 1)

Arguments

path the path from the working directory to the .csv file containing the abundance table

column the column number containing the feature names

Details

The abundance table needs to be loaded into R in such a way that the row names are the feature names, the sample names are the column names, and all its values are numerics.

Value

Returns a numerical matrix created from the abundance table

load.meta.data

Description

load.meta.data() is a method for loading metadata in .csv files in the appropriate format for use with the heat map creating functions

Usage

load.meta.data(path, tax_column = 1)

Arguments

path the path from the working directory to the .csv file containing the metadata

tax_column the column number containing the taxonomical or sample (ie identifying) name for the metadata

Details

This can be used to load feature or sample metadata. Metadata needs to be loaded in such a way that the row names are the identifying names and the traits are the column names.

Value

Returns a data.frame containing information extracted from the metadata

Warning

This will eliminate all duplicate entries from the metadata without merging their data resulting in potential data loss.

create.correlogram

Description

create.correlogram() creates a heat map based on the correlation of features given an abundance table and feature metadata.

Usage

create.correlogram(data, feature_meta, show = TRUE)

Arguments

data abundance data in a numerical matrix

feature_meta a data.frame containing feature metadata

show if true, will display the graph upon completion

Details

The features need to be the rows of the abundance data.

Value

Returns a pheatmap with the following components: row hclusters, column hclusters, kmeans, and gtable

create.heatmap

Description

create.heatmap() creates a heat map based on relative abundance, with row and column dendrograms based on given metadata

Usage

create.heatmap(data, sample_meta, feature_meta, percentile = 0.75, show = FALSE, omit_na = TRUE)

Arguments

data abundance data in a numerical matrix

sample_meta a data.frame containing sample metadata

feature_meta a data.frame containing feature metadata

percentile a filter for displaying only entries with a threshold correlation

show if true, will display the graph upon completion

omit_na whether to eliminate entries that are missing meta data

Details

The features need to be the rows of the abundance data.

Value

Returns a pheatmap with the following components: row hclusters, column hclusters, kmeans, and gtable

one.v.all

Description

one.v.all() uses the create.heatmap function, but filters the metadata such that it labels only a single feature category and type, labeling all others as 'other'

Usage

one.v.all(data, sample_meta, feature_meta, which = 2, percentile = 0.75, show = FALSE, column, trait)

Arguments

data abundance data in a numerical matrix

sample_meta a data.frame containing sample metadata

feature_meta a data.frame containing feature metadata

which a number representing whether to filter the sample(1) or feature(2) metadata

percentile a filter for displaying only entries with a threshold correlation

show if true, will display the graph upon completion

column the column number with the feature category

trait the specific feature type to use

Details

Compare only one feature type against all others in a feature category (ex. aerobic respiration v all other oxygen requirements). The features need to be the rows of the abundance data. Can supply any number of feature categories, but only one will be used.

Value

Returns a pheatmap with the following components: row hclusters, column hclusters, kmeans, and gtable

all.one.v.all

Description

all.one.v.all() uses the one.v.all function, creates a heatmap for every feature type found

Usage

all.one.v.all <- function(data, sample_meta, feature_meta, which = 2, percentile = 0.75, show = FALSE, column, directory='')

Arguments

data abundance data in a numerical matrix

sample_meta a data.frame containing sample metadata

feature_meta a data.frame containing feature metadata

which a number representing whether to filter the sample(1) or feature(2) metadata

percentile a filter for displaying only entries with a threshold correlation

show if true, will display the graph upon completion

column the column number with the feature category

directory the path from the working directory to where the file should be saved

Details

Creates a heatmap for every feature type found (ex. 3 forms of oxygen requirements). The features need to be the rows of the abundance data. Can supply any number of feature categories, but only one will be used. Will automatically name the files based on the trait

Clone this wiki locally