as.trelliData: Generate an object from omicsData and/or statRes objects to...

View source: R/as.trelliData.R

as.trelliDataR Documentation

Generate an object from omicsData and/or statRes objects to pass to trelliscope building functions

Description

Either an omicData and/or a statRes object are accepted. omicData must be transformed and normalized, unless the data is isobaric protein or NMR data. If group_designation() has been run on the omicData object to add "main_effects", the resulting plots will include groups. The main effects group_designation and e_meta columns are merged to the e_data in long format to create the trelliData.omics dataframe, and e_meta is merged to statRes in long format to create trelliData.stat dataframe.

Usage

as.trelliData(omicsData = NULL, statRes = NULL)

Arguments

omicsData

an object of the class 'pepData', 'isobaricpepData', proData', 'metabData', 'lipidData', or 'nmrData', created by as.pepData, as.isobaricpepData, as.proData, as.metabData, as.lipidData, or as.nmrData, respectively.

statRes

statRes an object of the class 'statRes', created by imd_anova

Value

An object of class 'trelliData' containing the raw data and optionally, statRes. To be passed to trelliscope building functions.

Author(s)

David Degnan, Lisa Bramer

Examples



library(pmartRdata)

###########################
## MS/NMR OMICS EXAMPLES ##
###########################

# Transform the data
omicsData <- edata_transform(omicsData = pep_object, data_scale = "log2")

# Group the data by condition
omicsData <- group_designation(omicsData = omicsData, main_effects = c("Phenotype"))

# Apply the IMD ANOVA filter
imdanova_Filt <- imdanova_filter(omicsData = omicsData)
omicsData <- applyFilt(filter_object = imdanova_Filt, omicsData = omicsData,
                       min_nonmiss_anova = 2)

# Normalize my pepData
omicsData <- normalize_global(omicsData, "subset_fn" = "all", "norm_fn" = "median",
                             "apply_norm" = TRUE, "backtransform" = TRUE)

# Implement the IMD ANOVA method and compute all pairwise comparisons 
# (i.e. leave the `comparisons` argument NULL)
statRes <- imd_anova(omicsData = omicsData, test_method = 'combined')

# Generate the trelliData object
trelliData2 <- as.trelliData(omicsData = omicsData)
trelliData3 <- as.trelliData(statRes = statRes)
trelliData4 <- as.trelliData(omicsData = omicsData, statRes = statRes)

######################
## RNA-SEQ EXAMPLES ##  
######################

# Group data by condition
omicsData_seq <- group_designation(omicsData = rnaseq_object, main_effects = c("Virus"))

# Filter low transcript counts
omicsData_seq <- applyFilt(filter_object = total_count_filter(omicsData = omicsData_seq), 
 omicsData = omicsData_seq, min_count = 15)

# Select a normalization and statistics method (options are 'edgeR', 'DESeq2', and 'voom').
# See ?difexp_seq for more details
statRes_seq <- diffexp_seq(omicsData = omicsData_seq, method = "voom")

# Generate the trelliData object
trelliData_seq2 <- as.trelliData(omicsData = omicsData_seq)
trelliData_seq3 <- as.trelliData(statRes = statRes_seq)
trelliData_seq4 <- as.trelliData(omicsData = omicsData_seq, statRes = statRes_seq)



pmartR/pmartRqc documentation built on April 25, 2024, 6:18 a.m.