myTAI (version 0.9.3)

DiffGenes: Differential Gene Expression Analysis

Description

Detect differentially expressed genes (DEGs) in a standard ExpressionSet object.

Usage

DiffGenes(
  ExpressionSet,
  nrep,
  method = "foldchange",
  lib.size = NULL,
  p.adjust.method = NULL,
  comparison = NULL,
  alpha = NULL,
  filter.method = NULL,
  n = NULL,
  stage.names = NULL
)

Arguments

ExpressionSet

a standard PhyloExpressionSet or DivergenceExpressionSet object.

nrep

either a numeric value specifying the constant number of replicates per stage or a numeric vector specifying the variable number of replicates for each stage position.

method

method to detect differentially expressed genes.

lib.size

the library sizes to equalize library sizes by quantile-to-quantile normalization (see equalizeLibSizes).

p.adjust.method

p value correction method that is passed to p.adjust. Available options are:

  • p.adjust.method = "BH" (Benjamini-Hochberg correction)

  • p.adjust.method = "bonferroni" (Bonferroni correction)

  • p.adjust.method = "holm"

  • p.adjust.method = "hochberg"

  • p.adjust.method = "hommel"

  • p.adjust.method = "BY"

  • p.adjust.method = "fdr"

If p.adjust.method = NULL (Default) then no p-value correction is performed.

comparison

a character string specifying whether genes having fold-change or p-values below, above, or below AND above (both) the alpha value should be excluded from the dataset. In case comparison = "both" is chosen, the cut.off argument must be a two dimensional vector defining the lower alpha value at the first position and the upper alpha value at the second position.

alpha

a numeric value specifying the cut-off value above which Genes fulfilling the corresponding fold-change, log-fold-change, or p-value should be retained and returned by DiffGenes.

filter.method

a method how to alpha values in multiple stages. Options are "const", "min-set", and "n-set".

n

a numeric value for method = "n-set".

stage.names

a character vector specifying the new names of collapsed stages.

Details

All methods to perform dection of differentially expressed genes assume that your input dataset has been normalized before passing it to DiffGenes. For RNA-Seq data DiffGenes assumes that the libraries have been normalized to have the same size, i.e., to have the same expected column sum under the null hypothesis. If this isn't the case please run equalizeLibSizes before calling DiffGenes.

Available methods for the detection of differentially expressed genes:

  • method = "foldchange": ratio of replicate geometric means between developmental stages. Here, the DiffGenes functions assumes that absolute expression levels are stored in your input ExpresisonSet.

  • method = "log-foldchange": difference of replicate arithmetic means between developmental stages. Here, the DiffGenes functions assumes that log2a transformed expression levels are stored in your input ExpresisonSet.

  • method = "t.test": Welch t.test between replicate expression levels of two samples.

  • method = "wilcox.test": Wilcoxon Rank Sum Test between replicate expression levels of two samples.

  • method = "doubletail": Computes two-sided p-values by doubling the smaller tail probability (see exactTestDoubleTail for details).

  • method = "smallp": Performs the method of small probabilities as proposed by Robinson and Smyth (2008) (see exactTestBySmallP for details).

  • method = "deviance": Uses the deviance goodness of fit statistics to define the rejection region, and is therefore equivalent to a conditional likelihood ratio test (see edgeR package for details).

Exclude non differentially expressed genes from the result dataset:

When specifying the alpha argument you furthermore, need to specify the filter.method to decide how non differentially expressed genes should be classified in multiple sample comparisons and which genes should be retained in the final dataset returned by DiffGenes. In other words, all genes < alpha based on the following filter.method are removed from the result dataset.

Following extraction criteria are implemented in this function:

  • const: all genes that have at least one sample comparison that undercuts or exceeds the alpha value cut.off will be excluded from the ExpressionSet. Hence, for a 7 stage ExpressionSet genes passing the alpha threshold in 6 stages will be retained in the ExpressionSet.

  • min-set: genes passing the alpha value in ceiling(n/2) stages will be retained in the ExpressionSet, where n is the number of stages in the ExpressionSet.

  • n-set: genes passing the alpha value in n stages will be retained in the ExpressionSet. Here, the argument n needs to be specified.

See Also

Expressed

Examples

Run this code
# NOT RUN {
data(PhyloExpressionSetExample)

# Detection of DEGs using the fold-change measure
DEGs <- DiffGenes(ExpressionSet = PhyloExpressionSetExample[ ,1:8],
                  nrep          = 2,
                  comparison    = "below",
                  method        = "foldchange",
                  stage.names   = c("S1","S2","S3"))


head(DEGs)


# Detection of DEGs using the log-fold-change measure
# when choosing method = "log-foldchange" it is assumed that
# your input expression matrix stores log2 expression levels 
log.DEGs <- DiffGenes(ExpressionSet = tf(PhyloExpressionSetExample[1:5,1:8],log2),
                      nrep          = 2,
                      comparison    = "below",
                      method        = "log-foldchange",
                      stage.names   = c("S1","S2","S3"))


head(log.DEGs)


# Remove fold-change values < 2 from the dataset:

## first have a look at the range of fold-change values of all genes 
apply(DEGs[ , 3:8],2,range)

# now remove genes undercutting the alpha = 2 threshold
# hence, remove genes having p-values <= 0.05 in at
# least one sample comparison
DEGs.alpha <- DiffGenes(ExpressionSet = PhyloExpressionSetExample[1:250 ,1:8],
                        nrep          = 2,
                        method        = "t.test",
                        alpha         = 0.05,
                        comparison    = "above",
                        filter.method = "n-set",
                        n             = 1,
                        stage.names   = c("S1","S2","S3"))

# now again have a look at the range and find
# that fold-change values of 2 are the min value
apply(DEGs.alpha[ , 3:5],2,range)

# now check whether each example has at least one stage with a p-value <= 0.05
head(DEGs.alpha)

# }

Run the code above in your browser using DataLab