"200 pb" -- does pb mean petabytes?

If so, those aren't going to fit in memory; you're going to have to read the 
file line by line, accumulating totals and ratios as you go.

J

--
John Francini <franc...@mac.com>
"I have come to the conclusion that one useless man is called a disgrace; that 
two are called a law firm; and that three or more become a Congress. And by God 
I have had *this* Congress!" --John Adams

On May 13, 2011, at 11:46, Nathalie Conte <n...@sanger.ac.uk> wrote:

> HI,
> 
> I have a file with sequences each sequence is 200 pb long and I have 30K lines
> 
> ATGGATAGATA\n
> TTCGATTCATT\n
> GCCTAGACAT\n
> TTGCATAGACTA\n
> I want to calculate the AT ratio of each  base based on their position  (3/4) 
> for the 1st position, 3/4 on the second, (0/4) on the 3rd...
> I am beginner so please excuse my perl thinking!
> 
> my plan was to put everything in arrays, split on the digit and then  for 
> each line put the 1st digit in another array,
> my $fh ="./txt" ;
> unless (open(REGIONS, $fh)){
>       print "Cannot open file \n";
> }
> 
> my @list = <REGIONS>;
> close REGIONS;
> 
> foreach my $line (@list){
>    chomp $line;
>     my @pb = split(/\d/, $line);
>   my @position = $pb[0]; for the fisrt position
>       $line++;
> 
> do that in a loop 200 times ( as we have 200 pb per sequence) which will 
> create 200 arrays with 30K digits in them. I would need an array of all 
> arrays at that point???
> 
> from them use a condition loop assessing the A or T compo  for each array in 
> the big array , count them with a counter and divide by the size of each 
> array.
> 
> Could you please help me with this?
> Thanks
> Nat
> 
> 
> -- 
> The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a 
> charity registered in England with number 1021457 and a company registered in 
> England with number 2742969, whose registered office is 215 Euston Road, 
> London, NW1 2BE. 
> -- 
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
> 
> 

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to