Re: Position Weight Matrix of Set of Strings with Perl

2006-09-07 Thread Rob Dixon
Wijaya Edward wrote: > > From: Rob Dixon >> >> use strict; >> use warnings; >> >> my %pwm; >> >> while () { >>my $col = 0; >>foreach my $c (/\S/g) { >> $pwm{$c}[$col++]++; >>} >> } >> >> foreach my $freq (values %pwm) { >>$_ = $_ ? $_ / keys %pwm : 0 foreach @$freq; >> } >> >>

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Mumia W.
On 09/06/2006 05:41 AM, Mumia W. wrote: On 09/06/2006 04:02 AM, Wijaya Edward wrote: Dear Experts, I am looking for a really efficient way to compute a position weight matrix (PWM) [...] Although I'm sure that smarter posters than I will [...] do it right. Ugh, I forgot about Wijaya's re

RE: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Wijaya Edward
'0', '1', '0' ], 'C' => [ '1', '0', '0', '0', '0', '0' ], 'G' => [ '0', '0', '1', '1', '0', '1' ] }; Hope to h

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Dr.Ruud
Rob Dixon schreef: > use strict; > use warnings; > > my %pwm; > > while () { >my $col = 0; >foreach my $c (/\S/g) { > $pwm{$c}[$col++]++; >} > } > > foreach my $freq (values %pwm) { >$_ = $_ ? $_ / keys %pwm : 0 foreach @$freq; > } > > use Data::Dumper; > print Dumper \%pwm; >

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Rob Dixon
Wijaya Edward wrote: > Dear Experts, > > I am looking for a really efficient way to compute a position weight matrix > (PWM) from a set of strings. In each set the strings are of the same length. > Basically PWM compute the frequency (or probabilities) of bases [ATCG] occur > in each position/col

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Mumia W.
On 09/06/2006 04:02 AM, Wijaya Edward wrote: Dear Experts, I am looking for a really efficient way to compute a position weight matrix (PWM) from a set of strings. In each set the strings are of the same length. Basically PWM compute the frequency (or probabilities) of bases [ATCG] occur in eac

Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Wijaya Edward
Dear Experts, I am looking for a really efficient way to compute a position weight matrix (PWM) from a set of strings. In each set the strings are of the same length. Basically PWM compute the frequency (or probabilities) of bases [ATCG] occur in each position/column of a string. For example