[Bioperl-l] counting nucleotides in a sequence

Alan Christoffels chris at fugu-sg.org
Wed Feb 19 10:42:58 EST 2003


Hi jason,

> Not the fastest way to do it, but this code will get you the sequence
> chunks of length 10.
> Look at
> Bio::Tools::SeqStats for an easy way to calculate the individual nt
> frequencies (count_monomers).
> 
> my $chunk = 10;
> for( my $i = 1; $i < $seq->length; $i+= $chunk) {
>  my $subseq = $seq->trunc($i,$i+$chunk-1);
> }

Would it be correct to assume that this code will not handle the last 5
bases when the seqlength=35 and $i approaches 30. 

Alan

> 
> -j
> On Wed, 19 Feb 2003 parvesh at pacific.net.sg wrote:
> 
> > Hello
> > I am interested in calculating the nucleotides A,C, G and T
> > in my sequence for every 10 nt window.
> 
> > So I need to write a code that will scan the sequence for every 10 nts
> > like 1-10,11-20. preferably i can then stack the result in arrays and
> > write this array to file. Can someone help me to do this using bioperl
> > code please ? Thanks in advance for your help!
> >
> > Best wishes
> > Parvesh
> >
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at bioperl.org
> > http://bioperl.org/mailman/listinfo/bioperl-l
> >
> 
> --
> Jason Stajich
> Duke University
> jason at cgt.mc.duke.edu
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
> 

-- 
Alan Christoffels 
Molecular Genetics/Fugu informatics 
Institute of Molecular and Cell Biology 
30 Medical Drive 
Singapore
Tel:(65)6874-1489





More information about the Bioperl-l mailing list