| 1 |
.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) |
| 2 |
.\" |
| 3 |
.\" Standard preamble: |
| 4 |
.\" ======================================================================== |
| 5 |
.de Sp \" Vertical space (when we can't use .PP) |
| 6 |
.if t .sp .5v |
| 7 |
.if n .sp |
| 8 |
.. |
| 9 |
.de Vb \" Begin verbatim text |
| 10 |
.ft CW |
| 11 |
.nf |
| 12 |
.ne \\$1 |
| 13 |
.. |
| 14 |
.de Ve \" End verbatim text |
| 15 |
.ft R |
| 16 |
.fi |
| 17 |
.. |
| 18 |
.\" Set up some character translations and predefined strings. \*(-- will |
| 19 |
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 20 |
.\" double quote, and \*(R" will give a right double quote. \*(C+ will |
| 21 |
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and |
| 22 |
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, |
| 23 |
.\" nothing in troff, for use with C<>. |
| 24 |
.tr \(*W- |
| 25 |
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 26 |
.ie n \{\ |
| 27 |
. ds -- \(*W- |
| 28 |
. ds PI pi |
| 29 |
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 30 |
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 31 |
. ds L" "" |
| 32 |
. ds R" "" |
| 33 |
. ds C` "" |
| 34 |
. ds C' "" |
| 35 |
'br\} |
| 36 |
.el\{\ |
| 37 |
. ds -- \|\(em\| |
| 38 |
. ds PI \(*p |
| 39 |
. ds L" `` |
| 40 |
. ds R" '' |
| 41 |
'br\} |
| 42 |
.\" |
| 43 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 44 |
.ie \n(.g .ds Aq \(aq |
| 45 |
.el .ds Aq ' |
| 46 |
.\" |
| 47 |
.\" If the F register is turned on, we'll generate index entries on stderr for |
| 48 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 49 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 50 |
.\" output yourself in some meaningful fashion. |
| 51 |
.ie \nF \{\ |
| 52 |
. de IX |
| 53 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 54 |
.. |
| 55 |
. nr % 0 |
| 56 |
. rr F |
| 57 |
.\} |
| 58 |
.el \{\ |
| 59 |
. de IX |
| 60 |
.. |
| 61 |
.\} |
| 62 |
.\" |
| 63 |
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 64 |
.\" Fear. Run. Save yourself. No user-serviceable parts. |
| 65 |
. \" fudge factors for nroff and troff |
| 66 |
.if n \{\ |
| 67 |
. ds #H 0 |
| 68 |
. ds #V .8m |
| 69 |
. ds #F .3m |
| 70 |
. ds #[ \f1 |
| 71 |
. ds #] \fP |
| 72 |
.\} |
| 73 |
.if t \{\ |
| 74 |
. ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 75 |
. ds #V .6m |
| 76 |
. ds #F 0 |
| 77 |
. ds #[ \& |
| 78 |
. ds #] \& |
| 79 |
.\} |
| 80 |
. \" simple accents for nroff and troff |
| 81 |
.if n \{\ |
| 82 |
. ds ' \& |
| 83 |
. ds ` \& |
| 84 |
. ds ^ \& |
| 85 |
. ds , \& |
| 86 |
. ds ~ ~ |
| 87 |
. ds / |
| 88 |
.\} |
| 89 |
.if t \{\ |
| 90 |
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 91 |
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 92 |
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 93 |
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 94 |
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 95 |
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 96 |
.\} |
| 97 |
. \" troff and (daisy-wheel) nroff accents |
| 98 |
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 99 |
.ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 100 |
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 101 |
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 102 |
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 103 |
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 104 |
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 105 |
.ds ae a\h'-(\w'a'u*4/10)'e |
| 106 |
.ds Ae A\h'-(\w'A'u*4/10)'E |
| 107 |
. \" corrections for vroff |
| 108 |
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 109 |
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 110 |
. \" for low resolution devices (crt and lpr) |
| 111 |
.if \n(.H>23 .if \n(.V>19 \ |
| 112 |
\{\ |
| 113 |
. ds : e |
| 114 |
. ds 8 ss |
| 115 |
. ds o a |
| 116 |
. ds d- d\h'-1'\(ga |
| 117 |
. ds D- D\h'-1'\(hy |
| 118 |
. ds th \o'bp' |
| 119 |
. ds Th \o'LP' |
| 120 |
. ds ae ae |
| 121 |
. ds Ae AE |
| 122 |
.\} |
| 123 |
.rm #[ #] #H #V #F C |
| 124 |
.\" ======================================================================== |
| 125 |
.\" |
| 126 |
.IX Title "TFBS::Matrix::PFM 3" |
| 127 |
.TH TFBS::Matrix::PFM 3 "2005-01-04" "perl v5.12.4" "User Contributed Perl Documentation" |
| 128 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 129 |
.\" way too many mistakes in technical documents. |
| 130 |
.if n .ad l |
| 131 |
.nh |
| 132 |
.SH "NAME" |
| 133 |
TFBS::Matrix::PFM \- class for raw position frequency matrix patterns |
| 134 |
.SH "SYNOPSIS" |
| 135 |
.IX Header "SYNOPSIS" |
| 136 |
.IP "\(bu" 4 |
| 137 |
creating a TFBS::Matrix::PFM object manually: |
| 138 |
.Sp |
| 139 |
.Vb 10 |
| 140 |
\& my $matrixref = [ [ 12, 3, 0, 0, 4, 0 ], |
| 141 |
\& [ 0, 0, 0, 11, 7, 0 ], |
| 142 |
\& [ 0, 9, 12, 0, 0, 0 ], |
| 143 |
\& [ 0, 0, 0, 1, 1, 12 ] |
| 144 |
\& ]; |
| 145 |
\& my $pfm = TFBS::Matrix::PFM\->new(\-matrix => $matrixref, |
| 146 |
\& \-name => "MyProfile", |
| 147 |
\& \-ID => "M0001" |
| 148 |
\& ); |
| 149 |
\& # or |
| 150 |
\& |
| 151 |
\& my $matrixstring = |
| 152 |
\& "12 3 0 0 4 0\en0 0 0 11 7 0\en0 9 12 0 0 0\en0 0 0 1 1 12"; |
| 153 |
\& |
| 154 |
\& my $pfm = TFBS::Matrix::PFM\->new(\-matrixstring => $matrixstring, |
| 155 |
\& \-name => "MyProfile", |
| 156 |
\& \-ID => "M0001" |
| 157 |
\& ); |
| 158 |
.Ve |
| 159 |
.IP "\(bu" 4 |
| 160 |
retrieving a TFBS::Matix::PFM object from a database: |
| 161 |
.Sp |
| 162 |
(See documentation of individual TFBS::DB::* modules to learn |
| 163 |
how to connect to different types of pattern databases and |
| 164 |
retrieve TFBS::Matrix::* objects from them.) |
| 165 |
.Sp |
| 166 |
.Vb 6 |
| 167 |
\& my $db_obj = TFBS::DB::JASPAR2\->new |
| 168 |
\& (\-connect => ["dbi:mysql:JASPAR2:myhost", |
| 169 |
\& "myusername", "mypassword"]); |
| 170 |
\& my $pfm = $db_obj\->get_Matrix_by_ID("M0001", "PFM"); |
| 171 |
\& # or |
| 172 |
\& my $pfm = $db_obj\->get_Matrix_by_name("MyProfile", "PFM"); |
| 173 |
.Ve |
| 174 |
.IP "\(bu" 4 |
| 175 |
retrieving list of individual TFBS::Matrix::PFM objects |
| 176 |
from a TFBS::MatrixSet object |
| 177 |
.Sp |
| 178 |
(See the TFBS::MatrixSet to learn how to create |
| 179 |
objects for storage and manipulation of multiple matrices.) |
| 180 |
.Sp |
| 181 |
.Vb 1 |
| 182 |
\& my @pfm_list = $matrixset\->all_patterns(\-sort_by=>"name"); |
| 183 |
.Ve |
| 184 |
.IP "\(bu" 4 |
| 185 |
convert a raw frequency matrix to other matrix types: |
| 186 |
.Sp |
| 187 |
.Vb 2 |
| 188 |
\& my $pwm = $pfm\->to_PWM(); # convert to position weight matrix |
| 189 |
\& my $icm = $icm\->to_ICM(); # convert to information con |
| 190 |
.Ve |
| 191 |
.SH "DESCRIPTION" |
| 192 |
.IX Header "DESCRIPTION" |
| 193 |
TFBS::Matrix::PFM is a class whose instances are objects representing |
| 194 |
raw position frequency matrices (PFMs). A \s-1PFM\s0 is derived from N |
| 195 |
nucleotide patterns of fixed size, e.g. the set of sequences |
| 196 |
.PP |
| 197 |
.Vb 12 |
| 198 |
\& AGGCCT |
| 199 |
\& AAGCCT |
| 200 |
\& AGGCAT |
| 201 |
\& AAGCCT |
| 202 |
\& AAGCCT |
| 203 |
\& AGGCAT |
| 204 |
\& AGGCCT |
| 205 |
\& AGGCAT |
| 206 |
\& AGGTTT |
| 207 |
\& AGGCAT |
| 208 |
\& AGGCCT |
| 209 |
\& AGGCCT |
| 210 |
.Ve |
| 211 |
.PP |
| 212 |
will give the matrix: |
| 213 |
.PP |
| 214 |
.Vb 4 |
| 215 |
\& A:[ 12 3 0 0 4 0 ] |
| 216 |
\& C:[ 0 0 0 11 7 0 ] |
| 217 |
\& G:[ 0 9 12 0 0 0 ] |
| 218 |
\& T:[ 0 0 0 1 1 12 ] |
| 219 |
.Ve |
| 220 |
.PP |
| 221 |
which contains the count of each nucleotide at each position in the |
| 222 |
sequence. (If you have a set of sequences as above and want to |
| 223 |
create a TFBS::Matrix::PFM object out of them, have a look at |
| 224 |
TFBS::PatternGen::SimplePFM module.) |
| 225 |
.PP |
| 226 |
PFMs are easily converted to other types of matrices, namely |
| 227 |
information content matrices and position weight matrices. A |
| 228 |
TFBS::Matrix::PFM object has the methods to_ICM and to_PWM which |
| 229 |
do just that, returning a TFBS::Matrix::ICM and TFBS::Matrix::PWM |
| 230 |
objects, respectively. |
| 231 |
.SH "FEEDBACK" |
| 232 |
.IX Header "FEEDBACK" |
| 233 |
Please send bug reports and other comments to the author. |
| 234 |
.SH "AUTHOR \- Boris Lenhard" |
| 235 |
.IX Header "AUTHOR - Boris Lenhard" |
| 236 |
Boris Lenhard <[email protected]> |
| 237 |
.SH "APPENDIX" |
| 238 |
.IX Header "APPENDIX" |
| 239 |
The rest of the documentation details each of the object |
| 240 |
methods. Internal methods are preceded with an underscore. |
| 241 |
.SS "new" |
| 242 |
.IX Subsection "new" |
| 243 |
.Vb 5 |
| 244 |
\& Title : new |
| 245 |
\& Usage : my $pfm = TFBS::Matrix::PFM\->new(%args) |
| 246 |
\& Function: constructor for the TFBS::Matrix::PFM object |
| 247 |
\& Returns : a new TFBS::Matrix::PFM object |
| 248 |
\& Args : # you must specify either one of the following three: |
| 249 |
\& |
| 250 |
\& \-matrix, # reference to an array of arrays of integers |
| 251 |
\& #or |
| 252 |
\& \-matrixstring,# a string containing four lines |
| 253 |
\& # of tab\- or space\-delimited integers |
| 254 |
\& #or |
| 255 |
\& \-matrixfile, # the name of a file containing four lines |
| 256 |
\& # of tab\- or space\-delimited integers |
| 257 |
\& ####### |
| 258 |
\& |
| 259 |
\& \-name, # string, OPTIONAL |
| 260 |
\& \-ID, # string, OPTIONAL |
| 261 |
\& \-class, # string, OPTIONAL |
| 262 |
\& \-tags # an array reference, OPTIONAL |
| 263 |
\&Warnings : Warns if the matrix provided has columns with different |
| 264 |
\& sums. Columns with different sums contradict the usual |
| 265 |
\& origin of matrix data and, unless you are absolutely sure |
| 266 |
\& that column sums _should_ be different, it would be wise to |
| 267 |
\& check your matrices. |
| 268 |
.Ve |
| 269 |
.SS "column_sum" |
| 270 |
.IX Subsection "column_sum" |
| 271 |
.Vb 8 |
| 272 |
\& Title : column_sum |
| 273 |
\& Usage : my $nr_sequences = $pfm\->column_sum() |
| 274 |
\& Function: calculates the sum of elements of one column |
| 275 |
\& (the first one by default) which normally equals the |
| 276 |
\& number of sequences used to derive the PFM. |
| 277 |
\& Returns : the sum of elements of one column (an integer) |
| 278 |
\& Args : columnn number (starting from 1), OPTIONAL \- you DO NOT |
| 279 |
\& need to specify it unless you are dealing with a matrix |
| 280 |
.Ve |
| 281 |
.SS "to_PWM" |
| 282 |
.IX Subsection "to_PWM" |
| 283 |
.Vb 9 |
| 284 |
\& Title : to_PWM |
| 285 |
\& Usage : my $pwm = $pfm\->to_PWM() |
| 286 |
\& Function: converts a raw frequency matrix (a TFBS::Matrix::PFM object) |
| 287 |
\& to position weight matrix. At present it assumes uniform |
| 288 |
\& background distribution of nucleotide frequencies. |
| 289 |
\& Returns : a new TFBS::Matrix::PWM object |
| 290 |
\& Args : none; in the future releases, it should be able to accept |
| 291 |
\& a user defined background probability of the four |
| 292 |
\& nucleotides |
| 293 |
.Ve |
| 294 |
.SS "to_ICM" |
| 295 |
.IX Subsection "to_ICM" |
| 296 |
.Vb 7 |
| 297 |
\& Title : to_ICM |
| 298 |
\& Usage : my $icm = $pfm\->to_ICM() |
| 299 |
\& Function: converts a raw frequency matrix (a TFBS::Matrix::PFM object) |
| 300 |
\& to information content matrix. At present it assumes uniform |
| 301 |
\& background distribution of nucleotide frequencies. |
| 302 |
\& Returns : a new TFBS::Matrix::ICM object |
| 303 |
\& Args : \-small_sample_correction # undef (default), \*(Aqschneider\*(Aq or \*(Aqpseudocounts\*(Aq |
| 304 |
.Ve |
| 305 |
.PP |
| 306 |
How a \s-1PFM\s0 is converted to \s-1ICM:\s0 |
| 307 |
.PP |
| 308 |
For a \s-1PFM\s0 element PFM[i,k], the probability without |
| 309 |
pseudocounts is estimated to be simply |
| 310 |
.PP |
| 311 |
.Vb 1 |
| 312 |
\& p[i,k] = PFM[i,k] / Z |
| 313 |
.Ve |
| 314 |
.PP |
| 315 |
where |
| 316 |
\&\- Z equals the column sum of the matrix i.e. the number of motifs used |
| 317 |
to construct the \s-1PFM\s0. |
| 318 |
\&\- i is the column index (position in the motif) |
| 319 |
\&\- k is the row index (a letter in the alphacer, here k is one of |
| 320 |
(A,C,G,T) |
| 321 |
.PP |
| 322 |
Here is how one normally calculates the pseudocount-corrected positional |
| 323 |
probability p'[i,j]: |
| 324 |
.PP |
| 325 |
.Vb 1 |
| 326 |
\& p\*(Aq[i,k] = (PFM[i,k] + 0.25*sqrt(Z)) / (Z + sqrt(Z)) |
| 327 |
.Ve |
| 328 |
.PP |
| 329 |
0.25 is for the flat distribution of nucleotides, and sqrt(Z) is the |
| 330 |
recommended pseudocount weight. In the general case, |
| 331 |
.PP |
| 332 |
.Vb 1 |
| 333 |
\& p\*(Aq[i,k] = (PFM[i,k] + q[k]*B) / (Z + B) |
| 334 |
.Ve |
| 335 |
.PP |
| 336 |
where q[k] is the background distribution of the letter (nucleotide) k, |
| 337 |
and B an arbitrary pseudocount value or expression (for no pseudocounts |
| 338 |
B=0). |
| 339 |
.PP |
| 340 |
For a given position i, the deviation from random distribution in bits |
| 341 |
is calculated as (Baldi and Brunak eq. 1.9 (2ed) or 1.8 (1ed)): |
| 342 |
.PP |
| 343 |
\&\- for an arbitrary alphabet of A letters: |
| 344 |
.PP |
| 345 |
.Vb 1 |
| 346 |
\& D[i] = log2(A) + sum_for_all_k(p[i,k]*log2(p[i,k])) |
| 347 |
.Ve |
| 348 |
.PP |
| 349 |
\&\- special case for nucleotides (A=4) |
| 350 |
.PP |
| 351 |
.Vb 1 |
| 352 |
\& D[i] = 2 + sum_for_all_k(p[i,k]*log2(p[i,k])) |
| 353 |
.Ve |
| 354 |
.PP |
| 355 |
D[i] equals the information content of the position i in the motif. To |
| 356 |
calculate the entire \s-1ICM\s0, you have to calculate the contrubution of each |
| 357 |
nucleotide at a position i to D[i], i.e. |
| 358 |
.PP |
| 359 |
ICM[i,k] = p'[i,k] * D[i] |
| 360 |
.SS "draw_logo" |
| 361 |
.IX Subsection "draw_logo" |
| 362 |
.Vb 10 |
| 363 |
\& Title : draw_logo |
| 364 |
\& Usage : my $gd_image = $pfm\->draw_logo() |
| 365 |
\& Function: draws a sequence logo; similar to the |
| 366 |
\& method in TFBS::Matrix::ICM, but can automatically calculate |
| 367 |
\& error bars for drawing |
| 368 |
\& Returns : a GD image object (see documentation of GD module) |
| 369 |
\& Args : many; PFM\-specific options are: |
| 370 |
\& \-small_sample_correction # One of |
| 371 |
\& # "Schneider" (uses correction |
| 372 |
\& # described by Schneider et al. |
| 373 |
\& # (Schneider t et al. (1986) J.Biol.Chem. |
| 374 |
\& # "pseudocounts" \- standard pseudocount |
| 375 |
\& # correction, more suitable for |
| 376 |
\& # PFMs with large r column sums |
| 377 |
\& # If the parameter is ommited, small |
| 378 |
\& # sample correction is not applied |
| 379 |
\& |
| 380 |
\& \-draw_error_bars # if true, adds error bars to each position |
| 381 |
\& # in the logo. To calculate the error bars, |
| 382 |
\& # it uses the \-small_sample_connection |
| 383 |
\& # argument if explicitly set, |
| 384 |
\& # or "Schneider" by default |
| 385 |
\&For other args, see draw_logo entry in TFBS::Matrix::ICM documentation |
| 386 |
.Ve |
| 387 |
.SS "add_PFM" |
| 388 |
.IX Subsection "add_PFM" |
| 389 |
.Vb 5 |
| 390 |
\& Title : add_PFM |
| 391 |
\& Usage : $pfm\->add_PFM($another_pfm) |
| 392 |
\& Function: adds the values of $pnother_pfm matrix to $pfm |
| 393 |
\& Returns : reference to the updated $pfm object |
| 394 |
\& Args : a TFBS::Matrix::PFM object |
| 395 |
.Ve |
| 396 |
.SS "name" |
| 397 |
.IX Subsection "name" |
| 398 |
.SS "\s-1ID\s0" |
| 399 |
.IX Subsection "ID" |
| 400 |
.SS "class" |
| 401 |
.IX Subsection "class" |
| 402 |
.SS "matrix" |
| 403 |
.IX Subsection "matrix" |
| 404 |
.SS "length" |
| 405 |
.IX Subsection "length" |
| 406 |
.SS "revcom" |
| 407 |
.IX Subsection "revcom" |
| 408 |
.SS "rawprint" |
| 409 |
.IX Subsection "rawprint" |
| 410 |
.SS "prettyprint" |
| 411 |
.IX Subsection "prettyprint" |
| 412 |
The above methods are common to all matrix objects. Please consult |
| 413 |
TFBS::Matrix to find out how to use them. |