How to Add FASTA Description to Multiple Sequences
|
So you have a multi-fasta file like this
and want to add FASTA description to all of your sequences like this
How to save perl script
Easiest Way To Install Perl on Windows
So you can use two simple PERL scripts given below to add FASTA description to all sequence of your multi-fasta file
Script1
Uses
Script2
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
Related Posts Perl Script,
Sequence analysis
|
Was This Post Useful? Add This To Del.icio.us Share on Facebook StumbleUpon This Add to Technorati Share on Twitter |
Labels:
Perl Script,
Sequence analysis
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Have Problem ?? Drop a comments here!