
Untitled
By: a guest on
Mar 22nd, 2010 | syntax:
Perl | size: 1.16 KB | hits: 75 | expires: Never
#!/usr/bin/perl -w
#Divide the sequences file into segment sequence.
#Usage: seq_seg.pl <sequences_file>
use warnings;
use strict;
####################
#
#Load Bio::SeqIO module for handling input/output of sequences and processing sequences.
#
####################
use Bio::SeqIO;
####################
#
#Initializing variables.
#
####################
my $file = $ARGV[0];
####################
#
#Gain access to sequences file.
#
####################
my $seqIOobj = Bio::SeqIO->new(-file=>"$ARGV[0]");
####################
#
#The main part of the program.
#
####################
while((my $seqobj = $seqIOobj->next_seq()))
{
####################
#
#Acquire the induvidual sequence information by using Bio::SeqIO module.
#
####################
my $seq = $seqobj->seq();
my $seq_id = $seqobj->primary_id();
open my $FILE_OUT, '>', "$seq_id";
####################
#
#Change the default file handle to $FILE_OUT.
#
####################
select $FILE_OUT;
####################
#
#Print the last result to $FILE_OUT handle.
#
####################
print ">$seq_id\n$seq\n";
close $FILE_OUT;
}