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.


-Thanks
-Mike



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

> Mike Robeson wrote:
> > 
> > Hello,
> 
> Hello,
> 
> > I am a relatively new PERL beginner and have been trying to work with
> > simple bioinformatics stuff. I have so far written some very useful but
> > simple bioinformatics scripts. However.... recently I have been trying
> > to work on a script to no avail. I have a text file whose contents are:
> > 
> >  >dog
> > agatagatcgcatcga
> >  >cat
> > acgcttcgatacgctagctta
> >  >mouse
> > agatatacgggt
> > 
> > .... and so on...
> > 
> > I would like to turn that into this:
> > 
> > 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
> > 
> > Notice that the sequence of letters varies however I need the lines in
> > the newly formed file to be equal in length by adding the appropriate
> > amount of dashes. For those in the know I am trying to convert a FASTA
> > file into a DCSE file.
> > 
> > I have been beating my head for the past 2 weeks and I cannot figure
> > out how to do this. I do not expect a complete answer (I would like to
> > try figuring this out on my own as much as possible) but rather some
> > guidance. Any detailed pseudo-code would be appreciated!!
> 
> 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
> 
> 
> 
> John

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

Reply via email to