Thank you, Roland! Just you writing it out made my code work. Really.
Programming is such a funny exercise. :-)
Have a good weekend, all.
John
John Ledwith, Bioinformatics
Cadus Pharmaceutical Corporation
john.ledwith at cadus.com
www.cadus.com
Voicemail: 914-467-6200 x448
Lab: 914-467-6230
-----Original Message-----
From: Roland Walker [SMTP:walker at ncbi.nlm.nih.gov]
Sent: Friday, November 06, 1998 12:00 PM
To: bio-soft at net.bio.net
Subject: [CORRECTION] Re: FASTA format - No funny
characters!!
[sorry, typing too fast]
[John.Ledwith at CADUS.COM writes]
> Thank you, Fran?ois. But lets say I want to set $/ (the input
record
> separator) to ">". (Baba) O'Reilly says that you can set it
to a
> multi-character string, but "^>", "\n>", even "\s>", isnt
cutting it (no
> pun intended).
#!/bin/perl
$/="\n>";
while (<>) {
chomp;
s/\A>?([^\n]*)\n//;
tr/\n//d;
my $defline=">$1";
my $sequence=$_;
$defline =~ s/\A([^\cA]{1,80}).*/$1/; # Example:
# limit defline to max
80 columns
# or up to the first
control-A
# other transformations left as
# an exercise to the reader
print "$defline\n$sequence\n";
}
--
Roland Walker
walker at ncbi.nlm.nih.gov
National Center for Biotechnology Information