[Bioperl-l] Problem in Bio-Perl parser , while running on XML-RPC environment
deep shingan
deep.shingan at gmail.com
Thu Aug 3 06:25:07 UTC 2006
Hi all,
I have written a bio-perl parser which parse the blast result file and
return the output array containg all the separate blast values.
This parser runs very fine on the local machine and the result output array
also contains all the details I have.
But when I try to run the method in xmlrpc environment, where a xml-rpc cpp
client sends a request to the perl xml-rpc server and calls this method.
For the very first request , the parser method executes and set/assign
values in output array but does not execute the return statement..and at the
same time I can see the containt of the output array on the client side. but
I cant see that, the return statement is executed(I checked this several
times through log file).
The interesting thing is that, when I again send another request to the
server, the server returns the blank output array to the client and then
call the blast parser method.
I am very badly stucked here, I checked each n every statement I have writen
in log file, for perl server and cpp client. I am not getting any clue on
this.
So ...please , please I anyone has encounterd same problem and have some
Idea where the problem lies..please help ,me.
I am sending the source code here.
Thanks
Deepak
#rintable form.
# This script was used to create the table in the SearchIO HOWTO,
# found at http://bioperl.open-bio.org/wiki/HOWTO:SearchIO
use strict;
use Bio::SearchIO;
use Bio::SimpleAlign;
use Bio::AlignIO;
use Error qw(:try);
use Frontier::Daemon;
#logic
#we are taking number of hits that user want to look as input parameter
#to the blastParser method. and parsing the file that is copied by
#ftp, to the directory in which this script is running.
# we are returning the output array which contains all parsed data.
use lib 'lib/perl5/site_perl/5.8.5/';
use Config::Simple;
use Log::Log4perl;
Log::Log4perl::init('log4perl.conf');
my $logger = Log::Log4perl->get_logger('rootLogger');
$logger->debug("Logger Initialised");
#&blastParser();
sub blastParser
{
try{
print "\nInside...";
$logger->debug("\nInside Method blastParser");
my @outputArray;
my $arrayCntr = 0;
#This is the file that is transfered by ftp to the current working
#directory
my $file = "tempBlastFile";
print "\n$file";
my $recordCounts = 10;
my $in = new Bio::SearchIO(-format => 'blast',
# comment out the next line to read STDIN
-file => $file );
while ( my $result = $in->next_result )
{
print "\nInside result..";
$logger->debug("\nAnalysing result...");
my @stats = $result->available_statistics;
my @params = $result->available_parameters;
while ( my $hit = $result->next_hit and $recordCounts)
{
print "\n\nRecordcount ::\t$recordCounts\n\n";
$logger->debug("\nAnalysing hit");
$logger->debug("\nRecordCount $recordCounts");
$recordCounts--;
my $id = $hit->matches('id');
my $cons = $hit->matches('cons');
my @accs = $hit->each_accession_number;
my @qidentical = $hit->seq_inds('query','identical');
my @qconserved = $hit->seq_inds('query','conserved');
my @hidentical = $hit->seq_inds('hit','identical');
my @hconserved = $hit->seq_inds('hit','conserved');
$outputArray[$arrayCntr] = $hit->name;
$arrayCntr++;
$outputArray[$arrayCntr] = $hit->accession;
$arrayCntr++;
$outputArray[$arrayCntr] = $hit->raw_score;
$arrayCntr++;
$outputArray[$arrayCntr] = $hit->bits;
$arrayCntr++;
$outputArray[$arrayCntr] = $hit->gaps;
$arrayCntr++;
$logger->debug("\nHit Name : ".$hit->name);
$logger->debug("\nHit Accession".$hit->accession);
$logger->debug("\nHit Row score :".$hit->raw_score);
$logger->debug("\nHit Bits :".$hit->bits);
$logger->debug("\nHit Gaps :".$hit->gaps);
#while ( my $hsp = $hit->next_hsp )
my $hsp = $hit->next_hsp;
# {
$logger->debug("Analysing Hsp");
my ($qid,$qcons) = $hsp->matches('hit');
my ($id,$cons) = $hsp->matches('query');
@qidentical = $hsp->seq_inds('query','identical');
@qconserved = $hsp->seq_inds('query','conserved');
@hidentical = $hsp->seq_inds('hit','identical');
@hconserved = $hsp->seq_inds('hit','conserved');
my @hrange = $hsp->range('hit');
my @qrange = $hsp->range('query');
my $aln = $hsp->get_aln;
my $alnIO =
Bio::AlignIO->new(-format=>"clustalw",-file=>'>tempHitFile');
$outputArray[$arrayCntr] = $hsp->evalue;
$arrayCntr++;
$outputArray[$arrayCntr] = $hsp->percent_identity;
$arrayCntr++;
$logger->debug("Evalue".$hsp->evalue);
$logger->debug("Percent Identity".$hsp->percent_identity);
$alnIO->write_aln($aln);
open hitFile, "tempHitFile" or die "Can't read file";
undef $/;
my $allignMent = <hitFile>;
$outputArray[$arrayCntr] = $allignMent;
$arrayCntr++;
close hitFile; $logger->debug("Allignment :",$allignMent);
# }#hsp while ends
}#hit while ends
}#result while end
print "\nReturning Output Array...";
return \@outputArray;
} catch Error with
{
my $ex = shift;
print "Exception...!";
}
}
my $methods = {'blastParser' => \&blastParser};
Frontier::Daemon->new(LocalPort => 9012, methods => $methods)or die
"Couldn't start HTTP server: $!";
More information about the Bioperl-l
mailing list