So you have a multi-fasta file like this
GGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
AGCTGCTGTAGGGTATGGCGAGCCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
TGGATAATGGACGAGTACCGCCTGGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
GGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
AGCTGCTGTAGGGTATGGCGAGCCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
TGGATAATGGACGAGTACCGCCTGGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
GGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
AGCTGCTGTAGGGTATGGCGAGCCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
TGGATAATGGACGAGTACCGCCTGGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
and want to add FASTA description to all of your sequences like this
seq_1
GGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_2
AGCTGCTGTAGGGTATGGCGAGCCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_3
TGGATAATGGACGAGTACCGCCTGGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_4
GGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_5
AGCTGCTGTAGGGTATGGCGAGCCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_6
TGGATAATGGACGAGTACCGCCTGGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_7
GGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_8
AGCTGCTGTAGGGTATGGCGAGCCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
seq_9
TGGATAATGGACGAGTACCGCCTGGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATCGGCGGATGTAGCCACGTGGATC
So you can use two simple PERL scripts given below to add FASTA description to all sequence of your multi-fasta file
Script1
#!/usr/bin/perl
# downloaded from www.bioinformatics-made-simple.com
open (INPUT, $ARGV[0]) or die $!;
open (OUTPUT, ">Output.txt");
while (<INPUT>){
chomp;
($seq) = split("\t");
print ">seq_$.\n$seq\n";
}
close (OUTPUT);
close (INPUT);
Uses
script-name.pl input.txt >result.txt
Script2
#!/usr/bin/perl -w
# downloaded from www.bioinformatics-made-simple.com
use strict;
use warnings;
while (<>) {
print "seq_$.\n" . (/(\S+)/)[0] . "\n";
}
Uses
script-name.pl input.txt >result.txt
Post a Comment