Mike Robeson wrote:
> 
> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John W. Krahn)
> wrote:
> >
> > According to your data this should work:
> >
> > #!/usr/bin/perl
> > use warnings;
> > use strict;
> >
> > my $len = 30;  # pad out to this length
> > while ( <DATA> ) {
> >     unless ( s/^\s*>// ) {
> >         chomp;
> >         my @char = ( split( // ), ( '-' ) x ( $len - length ) );
> >         $_ = "@char\n";
> >         }
> >     print;
> >     }
> >
> > __DATA__
> >  >dog
> > agatagatcgcatcga
> >  >cat
> > acgcttcgatacgctagctta
> >  >mouse
> > agatatacgggt
> 
> I do not know what happend but the text didn't get formatted correctly
> on the list. But this is how the out put should really have been:
> 
> a g a t a g a t c g c a t c g a - - - - - -    dog
> a c g c t t c g a t a c g c t a g c t t a -    cat
> a g a t a t a c g g g t t - - - - - - - - -    mouse
> 
> That is, I want the edited sequence data and the name on the same line.

#!/usr/bin/perl
use warnings;
use strict;

my $len = 30;
my $name;
while ( <DATA> ) {
    chomp;
    unless ( s/^\s*>(.+)// ) {
        $name = $1;
        my @char = ( split( // ), ( '-' ) x ( $len - length ) );
        print "@char    $name\n";
        }
    }

__DATA__
 >dog
agatagatcgcatcga
 >cat
acgcttcgatacgctagctta
 >mouse
agatatacgggt



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to