qnbtest: This is the main function of differential RNA methylation...

Description Usage Arguments Value Author(s) Examples

View source: R/qnbtest.R

Description

This function tests for differential RNA methylation between two conditions.

Usage

1
2
qnbtest(control_ip,treated_ip,control_input,treated_input,
size.factor=NA,mode="auto",plot.dispersion=TRUE,output.dir = NA)

Arguments

control_ip

a reads count data frame for IP samples of control

treated_ip

a reads count data frame for IP samples of treated

control_input

a reads count data frame for input samples of control

treated_input

a reads count data frame for input samples of treated

size.factor

A list of size factor. The size factor of the IP and input sample of the biological replicate and directly reflect their sequencing depth. If size.factor=NA, QNB will compute the size factor of IP and input sample of each replicate. If user could provide the size.factor, the name of each term must be control_ip, treated_ip, control_input, treated_input in list.

mode

There are four ways how the empirical dispersion can be computed:

  • pooled - Use the samples from all conditions with replicates to estimate a single pooled empirical dispersion value, called "pooled", and assign it to all samples. In this mode, the number of replicates must be the same.

  • per-condition - For each condition with replicates, compute an empirical dispersion value by considering the data from samples for this condition.

  • blind - Ignore the sample labels and compute an empirical dispersion value as if all samples were replicates of a single condition. This can be done even if there are no biological replicates.

  • auto - Select mode according to the size of samples automaticly.The default is auto. By default, QNB package implements the "per-conditon" mode for a more sensitive estimation of the raw variance parameter when biological replicates are provided; while the "blind" mode is implemented when biological replicates are not available.

plot.dispersion

The default is TRUE. If plot.dispersion=FALSE, it will not save the dispersion figure.

output.dir

The saved file path. The default is NA. If output.dir=NA, the path is the current path.

Value

Results will get a matrix including 7 columns (p.treated, p.control, log2.RR, log2.OR, pvalue, q, padj).

p.treated

The percentage of methylation under treated condition.

p.control

The percentage of methylation under control condition.

log2.RR

The normalized risk ratio.

log2.OR

The normalized odds ratio.

pvalue

Indicate the significance of the methylation site as an RNA differential methylation site

q

The standardized feature abundance, which is proportional to the expression level of the RNA transcript.

padj

The FDR of the methylation site, indicating the significance of the peak as an RNA differential methylation site after multiple hypothesis correction usting BH method.

Author(s)

Lian Liu <liulian19860905@163.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## The function is currently defined as load library and specify the parameters

library("QNB")

f1 = system.file("extdata", "control_ip.txt", package="QNB")
f2 = system.file("extdata", "treated_ip.txt", package="QNB")
f3 = system.file("extdata", "control_input.txt", package="QNB")
f4 = system.file("extdata", "treated_input.txt", package="QNB")

meth1 = read.table(f1,header=TRUE)
meth2 = read.table(f2,header=TRUE)
unmeth1 = read.table(f3,header=TRUE)
unmeth2 = read.table(f4,header=TRUE)

# When there are replicates under two conditions, we could select 
# mode="per-condition" or mode="pooled" to estimate the dispersion. 
# The default is mode="auto".

result = qnbtest(meth1,meth2,unmeth1,unmeth2,mode="per-condition")

# When size.factor is not NA

## Not run:
total_number_reads_control_ip <- c(3015921,2563976,198530)
total_number_reads_treated_ip <- c(1565101,152389,323569)
total_number_reads_control_input <- c(108561,302534,108123)
total_number_reads_treated_input <- c(301270,208549,308654)

# calculate the number of reads for a "standard" library
standard_library_size <- exp(mean(log( c(total_number_reads_control_ip,
                                  total_number_reads_treated_ip,
                                  total_number_reads_control_input,
                                  total_number_reads_treated_input))))

# calculate the sample size factor based on the total number of reads
size.factor <- list(control_ip = total_number_reads_control_ip/standard_library_size,
                   treated_ip = total_number_reads_treated_ip/standard_library_size,
                   control_input = total_number_reads_control_input/standard_library_size,
                   treated_input = total_number_reads_treated_input/standard_library_size)

# use size factor calculated from previous step in QNB model
result <- qnbtest(meth1, meth2, unmeth1, unmeth2,
                 size.factor = size.factor)
## End(Not run)


# If you have replicates for one condition but not for the other, or without any 
# replicates for # two conditions, you can select mode="blind" to estimate 
# the dispersion. 

f1 = system.file("extdata", "no_rep_controlip.txt", package="QNB")
f2 = system.file("extdata", "no_rep_treatedip.txt", package="QNB")
f3 = system.file("extdata", "no_rep_controlinput.txt", package="QNB")
f4 = system.file("extdata", "no_rep_treatedinput.txt", package="QNB")

no_rep_meth1 = read.table(f1,header=TRUE)
no_rep_meth2 = read.table(f2,header=TRUE)
no_rep_unmeth1 = read.table(f3,header=TRUE)
no_rep_unmeth2 = read.table(f4,header=TRUE)

## Not run: 
result = qnbtest(no_rep_meth1, 
                 no_rep_meth2,
                 no_rep_unmeth1,
                 no_rep_unmeth2,
                 mode="blind")
## End(Not run)

# If you could not decide which mode to estimate dispersion, mode="auto" 
# will select suitable way to estimate dispersion according to the replicates.

## Not run: 
result = qnbtest(meth1, meth2,unmeth1,unmeth2)
## End(Not run)

QNB documentation built on Nov. 17, 2017, 8:09 a.m.