Title: | Analysis of RNA Cytosine-5 Methylation |
---|---|
Description: | Bisulfite-treated RNA non-conversion in a set of samples is analysed as follows : each sample's non-conversion distribution is identified to a Poisson distribution. P-values adjusted for multiple testing are calculated in each sample. Combined non-conversion P-values and standard errors are calculated on the intersection of the set of samples. For further details, see C Legrand, F Tuorto, M Hartmann, R Liebers, D Jakob, M Helm and F Lyko (2017) <doi:10.1101/gr.210666.116>. |
Authors: | C Legrand |
Maintainer: | Carine Legrand <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.2 |
Built: | 2024-11-15 04:21:24 UTC |
Source: | https://github.com/cran/BisRNA |
BisRNA analyses non-conversion of bisulfite-treated RNA of a set of samples, in order to distinguish actual cytosine-5 methylation marks from artifacts. Calculations are done as follows:
each sample's ratio (Poisson parameter / coverage) is determined, assuming a null Poisson distribution (RNAmeth.poisson.par
),
non-conversion p-values are calculated for each sample (RNAmeth.poisson.test
),
combined non-conversion p-values and standard error of the non-conversion ratios
are calculated on the intersection of the set of samples samples.combine
.
A small non-conversion p-value points to methylation of a RNA cytosine, or another event blocking bisulfite conversion.
## Load data data(Bisdata,package="BisRNA") ## Ratio (Poisson parameter / coverage), derived p-values, # adjusted for multiple testing using either BH (here), or IHW if available. lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") # lambda2 <- RNAmeth.poisson.par(Bisdata2)$estimate BisXP2 <- RNAmeth.poisson.test(Bisdata2,lambda2,method="BH") # lambda3 <- RNAmeth.poisson.par(Bisdata3)$estimate BisXP3 <- RNAmeth.poisson.test(Bisdata3,lambda3,method="BH") ## Combined p-values ; median and standard error of ## bisulfite non-conversion ratio BisXP.combined <- samples.combine(BisXP1,BisXP2,BisXP3)
## Load data data(Bisdata,package="BisRNA") ## Ratio (Poisson parameter / coverage), derived p-values, # adjusted for multiple testing using either BH (here), or IHW if available. lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") # lambda2 <- RNAmeth.poisson.par(Bisdata2)$estimate BisXP2 <- RNAmeth.poisson.test(Bisdata2,lambda2,method="BH") # lambda3 <- RNAmeth.poisson.par(Bisdata3)$estimate BisXP3 <- RNAmeth.poisson.test(Bisdata3,lambda3,method="BH") ## Combined p-values ; median and standard error of ## bisulfite non-conversion ratio BisXP.combined <- samples.combine(BisXP1,BisXP2,BisXP3)
A dataset containing the RNA names, C position, coverage and non-conversion ratio for three synthetic samples of a RNA bisulfite sequencing experiment.
data(Bisdata)
data(Bisdata)
Three data frames with 330 to 345 rows and the 4 following variables:
RNA name or identifier
Cytosine position in RNA
Number of available reads at Cpos
Bisulfite non-conversion ratio at Cpos
data(Bisdata) ls(pattern="Bisdata") head(Bisdata1)
data(Bisdata) ls(pattern="Bisdata") head(Bisdata1)
A dataset containing the RNA names, C position, coverage and non-conversion ratio for synthetic sample 1 of a RNA bisulfite sequencing experiment.
data(Bisdata)
data(Bisdata)
Data frame with 330 to 345 rows and the 4 following variables:
RNA name or identifier
Cytosine position in RNA
Number of available reads at Cpos
Bisulfite non-conversion ratio at Cpos
data(Bisdata) ls(pattern="Bisdata") head(Bisdata1)
data(Bisdata) ls(pattern="Bisdata") head(Bisdata1)
A dataset containing the RNA names, C position, coverage and non-conversion ratio for synthetic sample 2 of a RNA bisulfite sequencing experiment.
data(Bisdata)
data(Bisdata)
Data frame with 330 to 345 rows and the 4 following variables:
RNA name or identifier
Cytosine position in RNA
Number of available reads at Cpos
Bisulfite non-conversion ratio at Cpos
data(Bisdata) ls(pattern="Bisdata") head(Bisdata2)
data(Bisdata) ls(pattern="Bisdata") head(Bisdata2)
A dataset containing the RNA names, C position, coverage and non-conversion ratio for synthetic sample 3 of a RNA bisulfite sequencing experiment.
data(Bisdata)
data(Bisdata)
Data frame with 330 to 345 rows and the 4 following variables:
RNA name or identifier
Cytosine position in RNA
Number of available reads at Cpos
Bisulfite non-conversion ratio at Cpos
data(Bisdata) ls(pattern="Bisdata") head(Bisdata3)
data(Bisdata) ls(pattern="Bisdata") head(Bisdata3)
class.BisXP
creates a BisXP object from a table containing RNA name,
C position, bisulfite non-conversion ratio and adjusted p-value.
class.BisXP(BisData)
class.BisXP(BisData)
BisData |
A data frame with 4 columns:
|
This function takes bisulfite experiment data as an input table, performs checks, and casts the table into a BisXP object, with rows labelled after a RNA_C.position pattern.
If the input table is correct, then the output will be a BisXP object corresponding to a consolidated data frame with rows labelled after a RNA_C.position pattern.
RNA <- c("NM_00001","NM_00001","NM_00002") Cpos <- as.integer(c(1,5,1)) ncratio <- c(0.1,0.5,0.3) pv.adj <- c(0.001,0.1,0.3) BSdata <- data.frame(RNA, Cpos, ncratio, pv.adj, stringsAsFactors = FALSE) bsXP <- class.BisXP(BSdata)
RNA <- c("NM_00001","NM_00001","NM_00002") Cpos <- as.integer(c(1,5,1)) ncratio <- c(0.1,0.5,0.3) pv.adj <- c(0.001,0.1,0.3) BSdata <- data.frame(RNA, Cpos, ncratio, pv.adj, stringsAsFactors = FALSE) bsXP <- class.BisXP(BSdata)
fisher.method
takes a list of independent p-values and combines them
using Fisher's method.
fisher.method(pvalues)
fisher.method(pvalues)
pvalues |
A list of p-values |
This function takes a list of p-values as input, determines the number of degrees of freedom (2 * number of p-values), combines the p-values using Fisher's method and returns the combined p-value in output.
The p-value combined using Fisher's method.
Fisher RA (1925) Statistical Methods for Research Workers. Edinburg: Oliver and Boyd.
Fisher RA (1948) Questions and Answers #14. In: Mosteller F, Fisher RA (1948) The American Statistician, 2:30-31 http://www.jstor.org/stable/2681650
list.pv <- c(0.0001,0.0142,0.0150) p.combined <- fisher.method(list.pv)
list.pv <- c(0.0001,0.0142,0.0150) p.combined <- fisher.method(list.pv)
intersectMatrix
takes 2 matrices and outputs their
intersection based on common row.names.
intersectMatrix(Tab1, Tab2)
intersectMatrix(Tab1, Tab2)
Tab1 |
A matrix or data frame with defined row.names |
Tab2 |
A matrix or data frame with defined row.names |
This function takes 2 matrices as input, determines the intersection of their row names, and returns a single matrix containing the rows in the intersection and concatenated columns of the initial matrices.
A matrix with rows common to both Tab1 and Tab2, and concatenated columns.
read.BisXP
reads a table containing RNA name, C position,
bisulfite non-conversion ratio and adjusted p-value from a file
and casts it into a BisXP object.
read.BisXP(filename)
read.BisXP(filename)
filename |
Address of the file containing data from a bisulfite experiment in 4 columns separated by a tabulation, with header on the first line:
|
This function takes a file name as input, reads the bisulfite data table contained in this file, performs checks, and casts the data into a BisXP object, which contain input data with rows labelled after a RNA_C.position pattern.
If the input table is correct, then the output will be a BisXP object corresponding to a consolidated data frame with rows labelled after a RNA_C.position pattern.
RNAs <- c("NM_00001","NM_00001","NM_00002") Cpos <- c(1,5,1) ncratio <- c(0.1,0.5,0.3) pv.adj <- c(0.001,0.1,0.3) BSdata <- data.frame(RNAs, Cpos, ncratio, pv.adj)
RNAs <- c("NM_00001","NM_00001","NM_00002") Cpos <- c(1,5,1) ncratio <- c(0.1,0.5,0.3) pv.adj <- c(0.001,0.1,0.3) BSdata <- data.frame(RNAs, Cpos, ncratio, pv.adj)
RNAmeth.poisson.par
determines the ratio (Poisson parameter / coverage),
based on the assumption that bisulfite-treated RNA's non-conversion ratios
follow a Poisson distribution.
RNAmeth.poisson.par(BSrna)
RNAmeth.poisson.par(BSrna)
BSrna |
A dataframe containing RNA name, C position, coverage and non-conversion ratio, in this order. |
This function takes RNA bisulfite sequencing data from one sample as input, restricts the dataset to RNAs for which coverage is at least 10, and divides data into coverage bins. Then, the Poisson parameter is estimated at each coverage bin using fitdistr from package MASS. The ratio (Poisson parameter / coverage) (median and 95% confidence interval) is returned in output.
This function returns a list containing:
The ratio (Poisson parameter / coverage) (median taken over coverage bins)
A confidence interval for the ratio (Poisson parameter / coverage) (bootstrap confidence interval of the median, type "bca")
## Load data, find out ratio (Poisson parameter / coverage). data(Bisdata,package="BisRNA") lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate ## P-values adjusted for multiple testing, using either BH (here) or IHW method. BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") ## Print BisXP1 BisXP1 ## Display BisXP1 as a data frame BisXP1.df <- data.frame(BisXP1$nonconv.ratio, BisXP1$pv.adj, row.names=BisXP1$RNA.pos) BisXP1.df
## Load data, find out ratio (Poisson parameter / coverage). data(Bisdata,package="BisRNA") lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate ## P-values adjusted for multiple testing, using either BH (here) or IHW method. BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") ## Print BisXP1 BisXP1 ## Display BisXP1 as a data frame BisXP1.df <- data.frame(BisXP1$nonconv.ratio, BisXP1$pv.adj, row.names=BisXP1$RNA.pos) BisXP1.df
RNAmeth.poisson.test
tests RNA bisulfite sequencing non-conversion
based on a sample and the ratio (Poisson parameter / coverage) for this sample.
RNAmeth.poisson.test(BisRNA, lambda, method="BH")
RNAmeth.poisson.test(BisRNA, lambda, method="BH")
BisRNA |
A dataframe containing RNA name, C position, coverage and non-conversion ratio |
lambda |
Ratio (Poisson parameter / coverage) |
method |
Adjustment method for multiple testing, either "BH" (Benjamini-Hochberg) or "IHW" (Independent Hypothesis Weighting, from R package IHW) |
This function takes RNA bisulfite sequencing data from one sample and the ratio (Poisson parameter / coverage) as inputs. Then, the dataset is restricted to those C positions where non-conversion ratio is larger than (Poisson parameter / coverage). Finally, it carries out poisson.test and a correction for multiple testing. The output of function RNAmeth.poisson.test is a BisXP object which contains RNA names, C positions, non-conversion ratios and adjusted p-values. The formatting into a BisXP object guarantees that some consistency checks are satisfied.
This function returns a BisXP object whose elements correspond to RNAs where non-conversion ratio is higher than lambda = ratio (Poisson parameter / coverage). The variables contained in this object are the non-conversion ratio and the adjusted p-value.
## Load data, find out ratio Poison parameter / coverage, ## and produce corresponding adjusted p-values. data(Bisdata,package="BisRNA") lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") ## Print BisXP1 BisXP1 ## Display BisXP1 as a data frame BisXP1.df <- data.frame(BisXP1$nonconv.ratio, BisXP1$pv.adj, row.names=BisXP1$RNA.pos) BisXP1.df
## Load data, find out ratio Poison parameter / coverage, ## and produce corresponding adjusted p-values. data(Bisdata,package="BisRNA") lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") ## Print BisXP1 BisXP1 ## Display BisXP1 as a data frame BisXP1.df <- data.frame(BisXP1$nonconv.ratio, BisXP1$pv.adj, row.names=BisXP1$RNA.pos) BisXP1.df
samples.combine
takes RNA bisulfite sequencing samples as input,
combines their p-values using Fisher's method, and produces median and
standard error of the bisulfite non-conversion ratios.
samples.combine(BisXP1, ...)
samples.combine(BisXP1, ...)
BisXP1 |
A BisXP object containing non-conversion ratio and p-value |
... |
One or more additional samples, in the form of BisXP objects |
This function takes several bisulfite sequencing samples, in form of BisXP objects, as inputs. It is recommended to provide at least 3 samples and in any case all available, relevant samples. Using RNA and C positions present in all samples, the adjusted p-values of each sample are combined using Fisher's method. Median and standard error of the non-conversion ratio are also given in output.
This function returns a data frame whose row names correspond to the RNA and C position which are present in all samples, and the following variables:
p-value adjusted (done in the preparation of the BisXP object) and combined (done here)
Median of bisulfite non-conversion ratio for a specific RNA and C positions
Standard error of bisulfite non-conversion ratio for a specific RNA and C positions
Fisher RA (1925) Statistical Methods for Research Workers. Edinburg: Oliver and Boyd.
Fisher RA (1948) Questions and Answers #14. In: Mosteller F, Fisher RA (1948) The American Statistician, 2:30-31 http://www.jstor.org/stable/2681650
## Load data data(Bisdata,package="BisRNA") ## Obtain the ratio (Poisson parameter / coverage), and p-values ## adjusted for multiple testing using BH (here) or IHW method. lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") lambda2 <- RNAmeth.poisson.par(Bisdata2)$estimate BisXP2 <- RNAmeth.poisson.test(Bisdata2,lambda2,method="BH") lambda3 <- RNAmeth.poisson.par(Bisdata3)$estimate BisXP3 <- RNAmeth.poisson.test(Bisdata3,lambda3,method="BH") ## Combine samples BisXP.combined <- samples.combine(BisXP1,BisXP2,BisXP3)
## Load data data(Bisdata,package="BisRNA") ## Obtain the ratio (Poisson parameter / coverage), and p-values ## adjusted for multiple testing using BH (here) or IHW method. lambda1 <- RNAmeth.poisson.par(Bisdata1)$estimate BisXP1 <- RNAmeth.poisson.test(Bisdata1,lambda1,method="BH") lambda2 <- RNAmeth.poisson.par(Bisdata2)$estimate BisXP2 <- RNAmeth.poisson.test(Bisdata2,lambda2,method="BH") lambda3 <- RNAmeth.poisson.par(Bisdata3)$estimate BisXP3 <- RNAmeth.poisson.test(Bisdata3,lambda3,method="BH") ## Combine samples BisXP.combined <- samples.combine(BisXP1,BisXP2,BisXP3)
testMeth
applies poisson.test to a sample from bisulfite-treated RNA experiment taking into account the ratio (Poisson parameter / coverage) characteristic of this sample.
testMeth(X, lambda)
testMeth(X, lambda)
X |
A list containing coverage as 1st element and non-conversion ratio as 2nd element, for one C position. |
lambda |
ratio (Poisson parameter / coverage) |
This function takes RNA bisulfite sequencing coverage and non-conversion ratio, applies poisson.test and outputs the p-value.
This function returns the p-value from poisson.test.