Learn R Programming

Linnorm (version 1.0.2)

RnaXSim: This function simulates a RNA-seq dataset based on a given distribution.

Description

This function simulates a RNA-seq dataset based on a given distribution.

Usage

RnaXSim(thisdata, distribution = "Poisson", NumRep = 3, NumDiff = 2000, NumFea = 20000, showinfo = FALSE, DEGlog2FC = "Auto", MaxLibSizelog2FC = 0.5)

Arguments

thisdata
Matrix: The matrix or data frame that contains your dataset. Each row is a gene and each column is a replicate. Undefined values such as NA are not supported. This program assumes that all columns are replicates of the same sample.
distribution
Character: Defaults to "Poisson". This parameter controls the output distribution of the simulated RNA-seq dataset. It can be one of "Gamma" (Gamma distribution), "Poisson" (Poisson distribution), "LogNorm" (Log Normal distribution) or "NB" (Negative Binomial distribution).
NumRep
Integer: The number of replicates. This is half of the number of output samples. Defaults to 3.
NumDiff
Integer: The number of Differentially Changed Features. Defaults to 2000.
NumFea
Integer: The number of Total Features. Defaults to 20000.
showinfo
Logical: should we show data information on the console? Defaults to FALSE.
DEGlog2FC
"Auto" or Double: log 2 fold change threshold that defines differentially expressed genes. If set to "Auto," DEGlog2FC is defined at the level where ANOVA can get a q value of 0.05 with the median mean, where the data values are log1p transformed. Defaults to "Auto".
MaxLibSizelog2FC
Double: The maximum library size difference from the mean that is allowed, in terms of log 2 fold change. Set to 0 to prevent program from generating library size differences. Defaults to 0.5.

Value

This function returns a list that contains a matrix of count data in integer raw count and a vector that shows which genes are differentially expressed. In the matrix, each row is a gene and each column is a replicate. The first NumRep (see parameter) of the columns belong to sample 1, and the last NumRep (see parameter) of the columns belong to sample 2. There will be NumFea (see parameter) number of rows.

Examples

Run this code
#Obtain example matrix:
library(seqc)
SampleA <- ILM_aceview_gene_BGI[,grepl("A_",colnames(ILM_aceview_gene_BGI))]
rownames(SampleA) <- ILM_aceview_gene_BGI[,2]
#Extract a portion of the matrix for an example
expMatrix <- SampleA[,1:10]
#Example for Negative Binomial distribution
simulateddata <- RnaXSim(expMatrix, distribution="NB", NumRep=3, NumDiff = 200, NumFea = 2000)
#Example for Poisson distribution
simulateddata <- RnaXSim(expMatrix, distribution="Poisson", NumRep=3, NumDiff = 200, NumFea = 2000)
#Example for Log Normal distribution
simulateddata <- RnaXSim(expMatrix, distribution="LogNorm", NumRep=3, NumDiff = 200, NumFea = 2000)
#Example for Gamma distribution
simulateddata <- RnaXSim(expMatrix, distribution="Gamma", NumRep=3, NumDiff = 200, NumFea = 2000)

Run the code above in your browser using DataLab