[Bioperl-l] Errors in my script

nandini_bn nandini_bn at hotmail.com
Tue May 19 08:30:26 UTC 2009


Hi, I have written this script using Bioperl methods but it gives me a lot of
errors: the script is as follows
Could u please help me out?  
Thanks

 
#! /usr/bin/perl

use warnings;
use strict;

#Reading in an alignment file in msf format from the command line,
performing an analysis of the alignment
#Writing the original alignment in fasta format of sequences selected by
user
#Storing the consensus sequence as a new sequence object and it's annotation
in genebank format

#loading the necessary packages
use Bio::Perl;
use Bio::AlignIO;
use Bio::Seq;
use Bio::SeqIO;

#Reading in of msf file
my $in = Bio::AlignIO->new(-file => $ARGV[0] ,
                           -format => 'msf');

#The threshold value
my $t = $ARGV[1];
my $aln = $in -> next_aln();

#some descriptors
my $length = $aln->length();
my $residues = $aln->no_residues();
my $isflush = $aln->is_flush();
my $sequence = $aln->no_sequences();
my $identity = $aln->percentage_identity();
#Consensus sequence
my $consensus = $aln->consensus_string($t);

#Printing the details of the alignment
print "Length: $length \n";
print "Number of residues: $residues \n";
print "Is flush: $isflush \n";
print "Number of sequences: $sequence \n";
print "Percentage of identity: $identity \n";
print "Consensus string: $consensus \n";

#Writing out the file in fasta format
my $out = Bio::AlignIO->new(-file => ">$ARGV[2]",
                           -format => 'fasta');

$out -> write_aln($aln);

#All ? in the sequence replaced by a X.
$consensus =~s/\?/X/g;

print "\n$consensus\n";

#Making a sequence object with annotation
my $seqobj = Bio::PrimarySeq->new( -seq => $consensus,
                                -id => $identity,
                                -organism => $length,
                                -comment => $residues,
                                -alphabet => 'protein');

#Writing the consensus sequence in swissprot format
my $conin = Bio::SeqIO->new(-seq => $seqobj,
                       -format => 'txt');
my $conout = Bio::SeqIO->new(-file => ">$ARGV[3]",
                       -format => 'Genbank');

 while ( my $seq = $conin->next_seq() )
    { 
      $conout->write_seq($seq); 
    }






THE ERRORS ARE
Bio::SeqIO: txt cannot be found
Exception 
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Failed to load module Bio::SeqIO::txt. Can't locate Bio/SeqIO/txt.pm in
@INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at
/usr/share/perl5/Bio/Root/Root.pm line 425, <GEN0> line 82.

STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/share/perl5/Bio/Root/Root.pm:359
STACK: Bio::Root::Root::_load_module /usr/share/perl5/Bio/Root/Root.pm:427
STACK: Bio::SeqIO::_load_format_module /usr/share/perl5/Bio/SeqIO.pm:555
STACK: Bio::SeqIO::new /usr/share/perl5/Bio/SeqIO.pm:376
STACK: nb175hw4.pl:60
-----------------------------------------------------------

For more information about the SeqIO system please see the SeqIO docs.
This includes ways of checking for formats at compile time, not run time
Can't call method "next_seq" on an undefined value at nb175hw4.pl line 65,
<GEN0> line 82.



-- 
View this message in context: http://www.nabble.com/Errors-in-my-script-tp23611935p23611935.html
Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.




More information about the Bioperl-l mailing list