Re: Concatenating line into array problem

2004-06-11 Thread John W. Krahn
Edward Wijaya wrote: Hi groups, Hello, I have a file which contain many many of this line (Fasta Format): YNL331C CAATATGCGAGGGACCTACATGTTGA CATGACAATGAATTCTATTGAA YKL071W ATAATTATTCCTGTTTCTTTAACCTG GTGTACAAACACTTAAGC What I would like to do is to concatenate the

Re: Concatenating line into array problem

2004-06-11 Thread John W. Krahn
John W. Krahn wrote: This should do what you want: $/ = ''; while ( ) { next unless s/\s+\S.*//; chomp; tr/\n//d; print $_\n; } After seeing your data file change that to: $/ = ''; while ( ) { next unless s/\S+.*\n//; chomp; tr/\n//d; print $_\n;

Re: Concatenating line into array problem

2004-06-11 Thread Zeus Odin
This works: ---BEGIN CODE--- #!/usr/bin/perl use warnings; use strict; $/ = ''; while (DATA) { s/(.*?\n.*?)\n/$1/s; print; } __DATA__ YNL331C CAATATGCGAGGGACCTACATGTTGA CATGACAATGAATTCTATTGAA YKL071W ATAATTATTCCTGTTTCTTTAACCTG GTGTACAAACACTTAAGC ---END CODE---

Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
Hi groups, I have a file which contain many many of this line (Fasta Format): YNL331C CAATATGCGAGGGACCTACATGTTGA CATGACAATGAATTCTATTGAA YKL071W ATAATTATTCCTGTTTCTTTAACCTG GTGTACAAACACTTAAGC What I would like to do is to concatenate the line below into one single string. Such as the

RE: Concatenating line into array problem

2004-06-10 Thread Tim Johnson
); next; } chomp; $line .= $_; } shift @crseq; print join(\n, @crseq), \n; -Original Message- From: Edward Wijaya [mailto:[EMAIL PROTECTED] Sent: Thursday, June 10, 2004 9:09 PM To: [EMAIL PROTECTED] Subject: Concatenating line into array

Re: Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
On Thu, 10 Jun 2004 21:19:17 -0700, Tim Johnson [EMAIL PROTECTED] wrote: while () { if (/^/) { push (@crseq, $line); next; } chomp; $line .= $_; } shift @crseq; print join(\n, @crseq), \n;

RE: Concatenating line into array problem

2004-06-10 Thread Charles K. Clarkson
From: Edward Wijaya mailto:[EMAIL PROTECTED] wrote: : #---My Code -- : while () { : if (/^/) { : next; : } : chomp; : $line .= $_; : } : push (@crseq, $line); : print join(\n, @crseq), \n; How about: my @crseq; while ( ) { next unless/^[ACGT]/;

Re: Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
How about: my @crseq; while ( ) { next unless/^[ACGT]/; chomp; push @crseq, $_ . scalar ; } print @crseq; Hi Charles, Thanks for your reply. Your code works for my example in email, but not the file with more lines, (please see attached file). So sorry if I didn't give precise

RE: Concatenating line into array problem

2004-06-10 Thread Charles K. Clarkson
From: Edward Wijaya mailto:[EMAIL PROTECTED] wrote: :: How about: :: :: my @crseq; :: while ( ) { :: next unless/^[ACGT]/; :: chomp; :: push @crseq, $_ . scalar ; :: } :: print @crseq; :: : : Hi Charles, : : Thanks for your reply. : : Your code works for my example in email,