agustina_s has asked for the wisdom of the Perl Monks concerning the following question:
This is my code:INPUT DATE 13-JUN-2000 COMMERCIAL SUPPLIERS SEQUENCE /exon="49-333" /intron="1-48;334-385" // DATE 14-JUN-2000 COMMERCIAL SUPPLIERS SEQUENCE /exon="1-120" /intron=" " // OUTPUT EXPECTED DATE "13-JUN 2002" Exon {Translation%49-333} Intron {Translation%1-48} Intron (Translation%334-385} DATE "14-JUN 2002" Exon {Translation -} Intron {Translation%1-120} REAL OUTPUT "ATE "13-JUN-2000 }xon {Translation%49-333 Intron {Translation%1-48} }ntron {Translation%334-385 "ATE "13-JUN-2000 }xon {Translation%1-120 }ntron {Translation%
I have also tried to put the date together in one string:#!/usr/local/bin/perl -w # A program that accept an input file: Scorpion database from Gen Bank # and will output the database in BioWare format my $file1="$ARGV[0]" #var to save the input database my $result=">".$ARGV[1]; my $counter=1; open(INFO1,$file1) or die "Can't open $file1.\n";#open file1 open(OUT,$result) or die "Can't open $result.\n"; #foreach line in the files foreach(<INFO1>) { if(/^DATE\s*(.*)-(.*)-(.*)/){ print 'DATE'."\t".'"'."$1-$2-$3".'"'."\n"; } elsif(/\s*\/intron=(.+)\n/) { my $item; my $local=$1; $local =~ s/\"//g; foreach $item (split('\;',$local)) { print "Intron\t \{Translation%$item\}\n"; } #end foreach } #end elsif elsif(/\s*\/exon=(.+)\n/) { my $item; my $local=$1; $local =~ s/\"//g; foreach $item (split('\;',$local)) { print "Exon\t", " \{Translation\%","$item\}","\n"; }#end foreach }#end elsif }
But it also give me the same result as above.print "DATE\t \"$1-$2-$3\"\n";
The Gory details of parsing quoted constructs ( in perldoc ) doesn't really help me. Is there something wrong in my code? Thanks so much...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strange quotes
by jmcnamara (Monsignor) on Feb 04, 2002 at 09:05 UTC | |
|
Re: strange quotes
by hossman (Prior) on Feb 04, 2002 at 09:19 UTC | |
|
Re: strange quotes
by particle (Vicar) on Feb 04, 2002 at 14:27 UTC | |
|
Re: strange quotes
by very empty (Scribe) on Feb 04, 2002 at 09:50 UTC | |
|
Re: strange quotes
by moodster (Hermit) on Feb 04, 2002 at 09:21 UTC |