File: TFMPvalue-sc2pv.Rd

package info (click to toggle)
r-cran-tfmpvalue 0.0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 232 kB
  • sloc: cpp: 907; ansic: 18; sh: 13; makefile: 2
file content (54 lines) | stat: -rw-r--r-- 1,427 bytes parent folder | download | duplicates (3)
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
\name{TFMsc2pv}
\alias{TFMsc2pv}

\title{
  Compute P-value from score.
}
\description{
  Computes the P-value associated with a score threshold.
}
\usage{
TFMsc2pv(mat, score, bg=c(A=0.25, C=0.25, G=0.25, T=0.25),
         type=c("PFM", "PWM"))
}

\arguments{
  \item{mat}{
    The input matrix. It can be a Position Frequency Matrix (PFM) or
    Position Weight Matrix (PWM) in log ratio.
    The matrix must have row names with "A", "C", "G", "T".
  }
  \item{score}{
    The required score.
  }
  \item{bg}{
    The background frequency of the sequences. 
    A numeric vector with names "A", "C", "G", "T".
  }
  \item{type}{
    The type of input matrix. Can be "PFM" or "PWM".
  }
}

\value{
  The P-value is returned based on the matrix, given the desired score.
}
\references{
  Touzet, H., and Varre, J.-S. (2007). Efficient and accurate P-value computation for Position Weight Matrices. Algorithms Mol Biol 2, 15.
}
\author{
  Ge Tan
}

\examples{
  pfm <- matrix(c(3, 5, 4, 2, 7, 0, 3, 4, 9, 1, 1, 3, 3, 6, 4, 1, 11,
                  0, 3, 0, 11, 0, 2, 1, 11, 0, 2, 1, 3, 3, 2, 6, 4, 1,
                  8, 1, 3, 4, 6, 1, 8, 5, 1, 0, 8, 1, 4, 1, 9, 0, 2, 3,
                  9, 5, 0, 0, 11, 0, 3, 0, 2, 7, 0, 5),
                nrow = 4, dimnames = list(c("A","C","G","T"))
                )
  bg <- c(A=0.25, C=0.25, G=0.25, T=0.25)
  score <- 8.77
  type <- "PFM"
  pvalue <- TFMsc2pv(pfm, score, bg, type)
}