[Bioperl-l] Count or weight matrix in bioperl?
Stefan Kirov
skirov at utk.edu
Fri Feb 17 18:09:00 UTC 2006
If you have bioperl-live:
write a file:
>seqgroup1
ATC
CCC
TTT
my $mio=new Bio::Matrix::PSM::IO(-format=>'masta',-file=>$filename);
while (my $matrix=$mio->next_matrix) {#Returns
Bio::Matrix::PSM::SiteMatrix object
#do something with the matrix...
print $matrix->consensus,"\n";
}
This is not going to give you the raw counts, but it will give you the
fequency for each pos/letter. see the docs for Bio::Matrix::PSM::SiteMatrix
Hope this helps
Stefan
Sam Al-Droubi wrote:
>Torsten and all,
>
> I don't think this will work for me for it only generates statistics for a single sequence. What I need is a count matrix for each position for a number of DNA sequences. In other words, if I pass there 3 sequences to this function then it returns the count for each postion for each nucleotide.
>
> For example if I pass an array of sequences say: ATC,CCC,TTT
> then I should get a matrix back that will have count for postion 1,2,3 for each A,C,T, or G like this:
>
>
> 1 2 3
> A 1 0 0
> C 1 1 2
> T 1 2 1
> G 0 0 0
>
> Any idea of this is already built somewhere in bioperl?
>
> Thank you.
>
>
> Torsten Seemann <torsten.seemann at infotech.monash.edu.au> wrote:> Say I have an array of nucleotide sequences of of length N. I want to calculate the count matrix (weight matrix). That is for each position 1..N, I want to know how many As, Cs ,Ts and Gs there are. Is the code to do this already written in bioperl to build this matrix if I pass it those strings?
>
>
>> Please excuse my lack of knowledge as I am a new comer to bioinformatics.
>>
>>
>
>Use the Bio::Tools::SeqStats module. The PDoc documentation even has an
>example similar to what you want to do:
>
>http://doc.bioperl.org/releases/bioperl-1.5.0-RC1/Bio/Tools/SeqStats.html
>
>--Torsten Seemann
>
>
>
>
>Sincerely,
>Sam Al-Droubi, M.S.
>saldroubi at yahoo.com
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l at lists.open-bio.org
>http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>
More information about the Bioperl-l
mailing list