[Bioperl-l] Printing strings without return

Gyoergy Abrusan abrusan at mpil-ploen.mpg.de
Wed Mar 24 12:56:10 EST 2004


Dear all

(Beginners question nr. x...)
I would like to ask how do I make one string from a Fasta file.
In other words, from:

 >name
actgtg
tgctat
accggg
...

the following:

 >name
actgtgtgctataccggg...


I wrote a simple script:

open FILE, "input.txt";
open (OUT, ">$RESULTS.txt")or die "$0:ERROR: can't write report file\n";

while ($seq=<FILE>)
{
if ($seq =~ />/)
  	{	
	print OUT "\n$seq";
	}		
else
	{
	print OUT "$seq";   	
	}
}


close OUT;

The problem is that the lines in FASTA contain a RETURN at the end, so 
the script doesn't change anything. Is there an option in perl to print 
till the RETURN?

Thanking you in advance.
Kind regards,

Gyorgy Abrusan



More information about the Bioperl-l mailing list