Mike Robeson wrote:
>
> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John W. Krahn)
> wrote:
>
> > Mike Robeson wrote:
> > >
> > > 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
>
> Thanks for the help!! I new it had to be simple... but I just didn't see
> it! I just need to add some more code to it but I think I can take it
> from here.
You can make that a bit more robust. :-)
#!/usr/bin/perl
use warnings;
use strict;
my $len = 30;
while ( <DATA> ) {
unless ( /^\s*$/ or s/^\s*>(\S+)// ) {
my $name = $1;
my @char = ( /[acgt]/g, ( '-' ) x $len )[ 0 .. $len - 1 ];
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]