Hi Zuzanna,

The input for the matchPWM function can be either a position weight
matrix created with the PWM function or a matrix of frequencies. The
connection between the two is the type argument in the PWM function. The
default for the type argument is "log2probratio" which understandably
gives slightly different results than those obtained when using a
frequency matrix as input. If type="prob", the results are the same. See
?PWM for details.


We use the PWM function with type="prob"  to create a position weight
matrix,

    library(Biostrings)

     sub <- DNAString("AATCGCGTAGGCGTACCGAT")
    sset <- DNAStringSet(c("AGTT", "ATGC", "AACG", "AATG"), start=c(1,1,1))
    m1 <- matchPWM(PWM(sset, type="prob"), sub)

Equivalently we can input a frequency matrix created as described on the
man page,

    mset <- rbind(A=c(4, 2, 0,0), C=c(0,0,1,1), G=c(0,1,1,2), T=c(0,1,2,1))
    m2 <- matchPWM(mset, sub)

    identical(m1, m2)


Valerie

> sessionInfo()
R version 2.12.0 Patched (2010-10-18 r53360)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8   
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8  
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                
 [9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] BSgenome.Hsapiens.UCSC.hg18_1.3.16 BSgenome_1.18.2                  
[3] GenomicFeatures_1.2.3              GenomicRanges_1.2.2              
[5] Biostrings_2.18.2                  IRanges_1.8.8                    

loaded via a namespace (and not attached):
[1] Biobase_2.10.0     biomaRt_2.6.0      DBI_0.2-5         
RCurl_1.5-0      
[5] RSQLite_0.9-4      rtracklayer_1.10.6 tools_2.12.0      
XML_3.2-0        



On 02/17/2011 06:59 AM, Zuzanna Makowska wrote:
> Dear List,
>
> I have a question regarding the matchPWM function of Biostrings package. 
>
> The help page for the function states that it requires a position weight matrix as an input. At the same time I found a post on the list giving a following example of the use of the function:
>
> (quoting: 
> 		[BioC] matching transcription factor binding sites
>
> 		Herve Pages hpages at fhcrc.org 
>
> 		Sat Apr 19 02:41:03 CEST 2008)
>
> 		Suppose 'pwm' contains a Position Weight Matrix, let's say:
>
> 		pwm <- rbind(A=c( 1,  0, 19, 20, 18,  1, 20,  7),
>                 		C=c( 1,  0,  1,  0,  1, 18,  0,  2),
>                 		G=c(17,  0,  0,  0,  1,  0,  0,  3),
>                 		T=c( 1, 20,  0,  0,  0,  1,  0,  8))
>
> 		Note that this is just a standard integer matrix with the 4 DNA base letters
> 		as row names (having these row names is mandatory).
> 		m <- matchPWM(pwm, chr1, min.score="90%")
>
> It seems to me that the matrix in this example is a position frequency matrix and not a position weight matrix (the difference between the two is explained nicely in: Applied Bioinformatics for the identification of regulatory elements; WW Wasserman&A Sandelin, Nat Rev Genet, 2004).
>
> Could somebody clarify what is the expected input for this function?
>
> Thanks in advance,
>
> Zuzanna Makowska
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


	[[alternative HTML version deleted]]

