Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: file header change

by Kenosis (Priest)
on Feb 05, 2013 at 15:26 UTC ( #1017205=note: print w/ replies, xml ) Need Help??


in reply to file header change

Try the following:

use strict; use warnings; my $i = 1; while (<>) { s/>\K.+/$i++/e; print; }

Output from your data:

>1 MNLTFDYTKEPSRDVLCIDVKSFYASVECVERG LDPLKTMLVVMSNSENSGGLVLAASPM >2 MKQNRKEFSSYFSRSIKQNKPLYLLLMSSETNPF PRPVIGTFRGYVEENKIIIGEDSYSI

Usage: perl script.pl inFile >outFile

As the fasta inFile is read line-by-line, the regex will substitute all past the > with the value of $i. The >outFile notation directs the printing to the file outFile.

Hope this helps!


Comment on Re: file header change
Select or Download Code
Re^2: file header change
by utpalmtbi (Acolyte) on Feb 05, 2013 at 16:36 UTC
    it works.. thank u very much..

      You're most welcome, utpalmtbi!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2014-09-18 09:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls