Re: help me with a parsing script please

2011-05-13 Thread Rob Dixon
On 12/05/2011 10:23, Nathalie Conte wrote: HI, I have this file format chr start end strand x 12 24 1 x 24 48 1 1 100 124 -1 1 124 148 -1 Basically I would like to create a new file by grouping the start of the first line (12) with the end of the second line (48) and so on the output should lo

problem in creating a complex hash

2011-05-13 Thread Agnello George
Hi All I have a small issue in arranging data with a array ref . $arrayref = [ [ [ 'user1, 'c'], [ 'user2', 'a'], [ 'user2', 'b' ],[ 'user2', 'd' ],[ 'user3', 'a' ],[ 'user2', 'f' ] ] ]; i tried the following my %sh ; foreach my $i ( @$arrayref) { push (@{$sh{$i->[0]}},{group => [$i->[1] } )

Re: problem in creating a complex hash

2011-05-13 Thread Rob Coops
It might not look nice but I would do the following: #!/usr/local/bin/perl use strict; use warnings; my $arrayref = [ [ [ 'user1', 'c'], [ 'user2', 'a'], [ 'user2', 'b' ],[ 'user2', 'd' ],[ 'user3', 'a' ],[ 'user2', 'f' ] ] ]; my %hash; foreach my $arrayreference ( @{${$arrayref}[0]} ) { if (

Re: problem in creating a complex hash

2011-05-13 Thread Agnello George
On Fri, May 13, 2011 at 4:30 PM, Rob Coops wrote: > It might not look nice but I would do the following: > #!/usr/local/bin/perl > use strict; > use warnings; > my $arrayref = [ [ [ 'user1', 'c'], [ 'user2', 'a'], [ 'user2', 'b' ],[ > 'user2', 'd' ],[ 'user3', 'a' ],[ 'user2', 'f' ] ] ]; > my %has

Re: problem in creating a complex hash

2011-05-13 Thread Paul Johnson
On Fri, May 13, 2011 at 01:00:57PM +0200, Rob Coops wrote: > It might not look nice but I would do the following: But it can be cleaned up quite a lot: > #!/usr/local/bin/perl > > use strict; > use warnings; > > my $arrayref = [ [ [ 'user1', 'c'], [ 'user2', 'a'], [ 'user2', 'b' ],[ > 'user2',

Re: problem in creating a complex hash

2011-05-13 Thread Rob Dixon
On 13/05/2011 11:11, Agnello George wrote: Hi All I have a small issue in arranging data with a array ref . $arrayref = [ [ [ 'user1, 'c'], [ 'user2', 'a'], [ 'user2', 'b' ],[ 'user2', 'd' ],[ 'user3', 'a' ],[ 'user2', 'f' ] ] ]; i tried the following my %sh ; foreach my $i ( @$arrayref) {

another parsing script :)

2011-05-13 Thread Nathalie Conte
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

Re: another parsing script :)

2011-05-13 Thread John Francini
"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 "I have come to the conclusion that one useless man is called a disgrace; that two are called a law

Re: another parsing script :)

2011-05-13 Thread rent0n
On 13/05/11 17:11, John Francini wrote: "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 No, I'm quite sure pb (bp?) stands for base pairs, or nucl

Re: another parsing script :)

2011-05-13 Thread Luca Cappelletti
Hi Nathalie I'm absolute newbie in terms of Perl but take into account the use of PDL that will help you better manage vectors, matrix and number crunch calculations. cheers, Luca -- --- Luca Cappelletti http://developerinfodomestic.blogspot.com "...Together we stand, divided we

Re: another parsing script :)

2011-05-13 Thread Rob Dixon
On 13/05/2011 16:46, Nathalie Conte wrote: 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 Does your data look like this? With 10, 11, or 12 characters per line? I'm afraid I don't know what a pb is, are yo

Re: another parsing script :)

2011-05-13 Thread John SJ Anderson
On Fri, May 13, 2011 at 11:46, Nathalie Conte wrote: > 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 po

Re: problem in creating a complex hash

2011-05-13 Thread Uri Guttman
> "RC" == Rob Coops writes: RC> my $arrayref = [ [ [ 'user1', 'c'], [ 'user2', 'a'], [ 'user2', 'b' ],[ RC> 'user2', 'd' ],[ 'user3', 'a' ],[ 'user2', 'f' ] ] ]; this comment is for both you and the OP. you should format complex data so you can read it. it makes it much easier to edit an