[BioC] Bioconductor Digest, Vol 73, Issue 25

Patrick Aboyoun paboyoun at fhcrc.org
Wed Mar 25 17:25:05 CET 2009


Bogdan,
Try the consensusMatrix function in the Biostrings package. It accepts a 
character vector, XStringSet (e.g. DNAStringSet), or an object generated 
by the pairwiseAlignment function:


 > suppressMessages(library(Biostrings))

 > consensusMatrix(DNAStringSet(c("ACGT", "AAAA", "ACCT", "AGGG")))
  [,1] [,2] [,3] [,4]
A    4    1    1    1
C    0    2    1    0
G    0    1    2    1
T    0    0    0    2
M    0    0    0    0
R    0    0    0    0
W    0    0    0    0
S    0    0    0    0
Y    0    0    0    0
K    0    0    0    0
V    0    0    0    0
H    0    0    0    0
D    0    0    0    0
B    0    0    0    0
N    0    0    0    0
-    0    0    0    0
+    0    0    0    0
 > consensusMatrix(DNAStringSet(c("ACGT", "AAAA", "ACCT", "AGGG")), 
baseOnly = TRUE)
      [,1] [,2] [,3] [,4]
A        4    1    1    1
C        0    2    1    0
G        0    1    2    1
T        0    0    0    2
other    0    0    0    0
 > sessionInfo()
R version 2.9.0 Under development (unstable) (2009-02-23 r47990)
i386-apple-darwin9.6.0

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] Biostrings_2.11.42 IRanges_1.1.54   

loaded via a namespace (and not attached):
[1] Biobase_2.3.11



Bogdan Tanasa wrote:
> Hi all,
>
> I am sorry to fill your inbox mail with a naive question, although I would
> really appreciate your opinion.
> I am looking for a R function that takes a set of aligned sequences, and
> transforms a position frequency
> matrix into a position weight matrix. Thanks a lot.
>
> bogdan
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list