DBresult: This function tests for differential expression

View source: R/DBresults.R

DBresultR Documentation

This function tests for differential expression

Description

This function is a wrapper for glmLRT in edgeR package. It performs likelihood ratio tests for given coefficinets contrasts after fitting read counts to a negative binomial glm by DBanalysis. DBresult also extracts the diffential analysis results of given contrasts at a chosen significance level. DBresult.cluster returns similar results but only contain genomic features belong to a given cluster.

Usage

DBresult(
  object,
  group1 = NULL,
  group2 = NULL,
  contrasts = NULL,
  p.adjust = "fdr",
  top.sig = FALSE,
  pvalue = "paj",
  pvalue.threshold = 0.05,
  abs.fold = 2,
  direction = "both",
  result.type = "GRangesList"
)

DBresult.cluster(
  object,
  group1 = NULL,
  group2 = NULL,
  contrasts = NULL,
  p.adjust = "fdr",
  top.sig = FALSE,
  pvalue = "paj",
  pvalue.threshold = 0.05,
  abs.fold = 2,
  direction = "both",
  cluster,
  cmthreshold = NULL,
  result.type = "GRangesList"
)

Arguments

object

a TCA object, for DBresult, DBanalysis should already be called on the object; for DBresult.cluster, both DBanalysis and timeclust should be already called.

group1

character string giving the group to be compared with, i.e., the denominator in the fold changes. group1 can be set NULL and will be ignored if the comparisons are passed to contrasts

group2

a character vetor giving the other groups to compare with group1, i.e., the numerator in the fold changes. group2 can be set NULL and will be ignored if the comparisons are passed to contrasts

contrasts

a character vector, each string in the vector gives a contrast of two groups with the format "group2vsgroup1", group1 is the denominator level in the fold changes and group2 is the numerator level in the fold changes.

p.adjust

character string specifying a correction method for p-values. Options are "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", and "none".

top.sig

logical if TRUE, only genomic regions with given log2-fold changes and significance levels (p-value) will be returned. Log2-fold changes are defined by abs.fold and direction; significance levels are defined by pvalue and pvalue.threshold

pvalue

character string specify the type of p-values used for defining the significance level(PValue or adjusted p-value paj)

pvalue.threshold

a numeric value giving threshold of selected p-value, Significant changes have lower (adjusted) p-values than the threshold.

abs.fold

a numeric value, the minimum absolute log2-fold changes. The returned genomic regions have changes with absolute log2-fold changes exceeding abs.fold.

direction

character string specify the direction of fold changes. "up": positive fold changes; "down": negative fold changes; "both": both positive and negative fold changes.

result.type

character string giving the data type of return value. Options are "GRangesList" and "list".

cluster

an integer giving the number of cluster from which genomic features are extracted.

cmthreshold

a numeric value, this argument is applicable only if cmeans' clustering method is selected when calling timeclust function. if not NULL, the result table of genomic features that belong to the defined cluster and the membership values to this cluster exceed cmthreshold are extracted.

Details

This function uses glmLRT from edgeR which perform likelihood ratio tests for the significance of changes. For more deatils, see glmLRT

Value

A list or a GRangesList. If result.type is "GRangesList", a GRangesList is returned containing the differential analysis results for all provided contrasts. Each GRanges object of the list is one contrast, the analysis results are contained in 4 metadata columns:

logFC log2-fold changes between two groups.

PValue p-values.

paj adjusted p-values

id name of genomic features

If result.type is "list", a list of data frames is returned. Each data frame contains one contrast with the following columns:

logFC log2-fold changes between two groups.

PValue p-values.

paj adjusted p-values

chr name of chromosomes

start starting positions of features in the chromosomes

end ending postitions of features in the chromosomes

id name of genomic features

Note

If not NULL group1, group2 and contrasts, result tables are extracted from comparisons in constrasts.

Author(s)

Mengjun Wu, Lei Gu

See Also

glmLRT

Examples

data(tca_ATAC)
tca_ATAC <- DBanalysis(tca_ATAC)
### extract differntial analysis of 24h, 72h to 0h
# set the contrasts using the 'group1' and 'group2' paramters
res1 <- DBresult(tca_ATAC, group1 = '0h', group2 = c('24h', '72h'))
# one can get the same result by setting the contrasts using hte 'contrasts' parameter
res2 <- DBresult(tca_ATAC, contrasts = c('24hvs0h', '72hvs0h'))
# extract significant diffential events
res.sig <- DBresult(tca_ATAC, contrasts = c('24hvs0h', '72hvs0h'),
                   top.sig = TRUE)

# extract differntial analysis of 24h, 72h to 0h of a given cluster
tca_ATAC <- timecourseTable(tca_ATAC, filter = TRUE)
tca_ATAC <- timeclust(tca_ATAC, algo = 'cm', k = 6)
res_cluster1 <- DBresult.cluster(tca_ATAC, group1 = '0h',
                                 group2 = c('24h', '72h'),
                                 cluster = 1)




MengjunWu/TCseq documentation built on May 15, 2023, 9:47 p.m.