[Bioperl-l] Printing strings without return

Jason Stajich jason at cgt.duhs.duke.edu
Wed Mar 24 13:01:35 EST 2004


On Wed, 24 Mar 2004, Gyoergy Abrusan wrote:

> 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
> 	{
# add this line
	$seq =~ s/\s+//g;
> 	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
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list