OK, I feel like an idiot. When I initially asked for help with this I 
just realized that I forgot two little details. I was supposed to add 
the number of sequences as well as the length of the sequences at the 
top of the output file. 

That is this file:

>dog
agatagatcgcatcga
>cat
acgcttcgatacgctagctta
>mouse
agatatacgggtt

is relly supposed to be:

3     22
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

The '3' represents the number of individual sequences in the file (i.e. 
dog, cat, mouse). And the 22 is the number of letters and dashes there 
are. The length is already in the script as $len. I am able to get the 
length listed at the top. However, I cannot find a way to have the 
number of sequences (the 3 in this case) printed to the top. 

Is there a way that I can just append to the outfile at the begining of 
a file?

Sorry, about this. I didn't realize I forgot to include this info. I 
guess I am to busy trying to learn PERL and I am not paying attention to 
what I need PERL to do for me!  :-)

-Thanks
-Mike


In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John W. Krahn) 
wrote:

> 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

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

Reply via email to