Hi Experts Please help :: Problem in Bio-Parser....with XML-RPC call

D

deep

Hi All,
I have a bio-parser written in perl which separate outs the contents of
the blast result file.
I am using this module in an XML-RPC environment , where I have a CPP
client which send the Blast-Result-file to perl XML-RPC server ...which
calls the blast parser method
when the perl server is started, the first request he is getting from
the client is fullfilled ..that means I am getting expecting output
say number of hit counts and score..etc.

But the problem arises when client sends the next request..
I checked that
The client sends request with the blast_result input file
perfectly...
Even server accepts the new request call and sends the
parameteried input file to the blast parser method..but second time the
method does not execute perfectly...It accepts input file and give the
blank output....without any error...
I checked the logger files and I found that blast parser method is not
executed completely..but when i tried to execute the method separately
(Not in XML-RPC environment)I got the expected output.

I don't know why this is happening...????
I am giving the complete code here...If you ppl have time...please help
me.I will be greateful to you always....

Thanks
Deepak




use strict;
use Bio::SearchIO;
use Bio::SimpleAlign;
use Bio::AlignIO;
use Frontier::Daemon;

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");
sub blastParser()
{

$logger->debug("\nNew Call");

print "\n Inside blastParser";

my $fileContent = shift;
my $tempFileName = 'TEMP_BLAST_RESULT_FILE';

$logger->debug("\nBlast File :::\n".$fileContent);

open BLASTFILE, ">$tempFileName" or die "Can't create File...!";
#writting file content into the tempBlastFile
print BLASTFILE "$fileContent";
#Closing fileName
close BLASTFILE;

#Destroying the fileContent
$fileContent = undef;
print "\n Copied Input File Succsefully..";

my $hitCount = shift;
$logger->debug("\nHitCount from client: $hitCount");
my $in = new Bio::SearchIO(-format => 'blast',
# comment out the next line to read STDIN
-file => $tempFileName );

my @outputArray;
my $arrayCnt = 0;

while ( my $result = $in->next_result )
{
print "\nAnalysing the result...";
my @stats = $result->available_statistics;
my @params = $result->available_parameters;

# $logger->debug("\nBlast File :::\n".$fileContent);
$logger->debug("\nNumber of Hits Found :".$result->num_hits);
print "\nNumber of hits fount :".$result->num_hits;

while ( my $hit = $result->next_hit and $hitCount)
{
$hitCount--;

print "\nAnalysing Hit Count :".$hitCount;

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');
#return start
$outputArray[$arrayCnt++] = $hit->name;
$outputArray[$arrayCnt++] = $hit->accession;
$outputArray[$arrayCnt++] = $hit->raw_score;
$outputArray[$arrayCnt++] = $hit->bits;
$outputArray[$arrayCnt++] = $hit->gaps;

$logger->debug("\nHitName :".$hit->name);
$logger->debug("\nAccession :".$hit->accession);
$logger->debug("\nRaw Score :".$hit->raw_score);
$logger->debug("\nBits :".$hit->bits);
$logger->debug("\ngaps :".$hit->gaps);
#return stop
#return gaps

while ( my $hsp = $hit->next_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");

#return evalue
$logger->debug("\neValue :".$hsp->evalue);
$logger->debug("\nPercent Identity
:".$hsp->percent_identity);
$outputArray[$arrayCnt++] = $hsp->evalue;
#return gaps
$outputArray[$arrayCnt++] = $hsp->percent_identity;
#return alignment
#write_aln function writes the sequence allignment to the
#specified file (here tempHitFile)
#so we are stoaring the actual hit allignment to the file
#and again recollecting it into the a string
$alnIO->write_aln($aln);
open hitFile, "tempHitFile" or die "Can't read file";

undef $/;
#getting the whole file into the outputArray
my $allignMent = <hitFile>;
$outputArray[$arrayCnt++] = $allignMent;
$logger->debug("\nAllignments :".$allignMent);
close hitFile;
$hsp = undef;
}
$hit = undef;
}
$result = undef;
}
# my $cmd = "rm $tempFileName";
# system ($cmd);
# print "\nDeleting input file...$tempFileName and returning
# outputArray @outputArray";
return \@outputArray;
}

my $methods = {'blastParser' => \&blastParser};
$logger->debug("Starting XMLRPC Server...");
Frontier::Daemon->new(LocalPort => 9011, methods => $methods) or die
"Couldn't start HTTP server : $!";
 
D

deep

Hi All,
I Got the answer but with one problem....
Now when I send the first request....
I got the expected output but without executing
return \@outputArray;
statement..in the blastparser method...
I don't know why...???
but when I send the second request, It executes the return
\@outputArray; statement..
and then calls the blastParser Method.
But as now outputArray is blank i m getting blank output at client end.

But the problem still remain...!!! why it is not executing return
statement in the request itself..?? And if return statement is not
executing ?? Then how i m getting the data at client side..when i send
the request first time...!!

I have defiantely checked the things in logger file. And believe me
....its working same as I mentioned above,,,!

Thanks
Deepak
Hi All,
I have a bio-parser written in perl which separate outs the contents of
the blast result file.
I am using this module in an XML-RPC environment , where I have a CPP
client which send the Blast-Result-file to perl XML-RPC server ...which
calls the blast parser method
when the perl server is started, the first request he is getting from
the client is fullfilled ..that means I am getting expecting output
say number of hit counts and score..etc.

But the problem arises when client sends the next request..
I checked that
The client sends request with the blast_result input file
perfectly...
Even server accepts the new request call and sends the
parameteried input file to the blast parser method..but second time the
method does not execute perfectly...It accepts input file and give the
blank output....without any error...
I checked the logger files and I found that blast parser method is not
executed completely..but when i tried to execute the method separately
(Not in XML-RPC environment)I got the expected output.

I don't know why this is happening...????
I am giving the complete code here...If you ppl have time...please help
me.I will be greateful to you always....

Thanks
Deepak




use strict;
use Bio::SearchIO;
use Bio::SimpleAlign;
use Bio::AlignIO;
use Frontier::Daemon;

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");
sub blastParser()
{

$logger->debug("\nNew Call");

print "\n Inside blastParser";

my $fileContent = shift;
my $tempFileName = 'TEMP_BLAST_RESULT_FILE';

$logger->debug("\nBlast File :::\n".$fileContent);

open BLASTFILE, ">$tempFileName" or die "Can't create File...!";
#writting file content into the tempBlastFile
print BLASTFILE "$fileContent";
#Closing fileName
close BLASTFILE;

#Destroying the fileContent
$fileContent = undef;
print "\n Copied Input File Succsefully..";

my $hitCount = shift;
$logger->debug("\nHitCount from client: $hitCount");
my $in = new Bio::SearchIO(-format => 'blast',
# comment out the next line to read STDIN
-file => $tempFileName );

my @outputArray;
my $arrayCnt = 0;

while ( my $result = $in->next_result )
{
print "\nAnalysing the result...";
my @stats = $result->available_statistics;
my @params = $result->available_parameters;

# $logger->debug("\nBlast File :::\n".$fileContent);
$logger->debug("\nNumber of Hits Found :".$result->num_hits);
print "\nNumber of hits fount :".$result->num_hits;

while ( my $hit = $result->next_hit and $hitCount)
{
$hitCount--;

print "\nAnalysing Hit Count :".$hitCount;

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');
#return start
$outputArray[$arrayCnt++] = $hit->name;
$outputArray[$arrayCnt++] = $hit->accession;
$outputArray[$arrayCnt++] = $hit->raw_score;
$outputArray[$arrayCnt++] = $hit->bits;
$outputArray[$arrayCnt++] = $hit->gaps;

$logger->debug("\nHitName :".$hit->name);
$logger->debug("\nAccession :".$hit->accession);
$logger->debug("\nRaw Score :".$hit->raw_score);
$logger->debug("\nBits :".$hit->bits);
$logger->debug("\ngaps :".$hit->gaps);
#return stop
#return gaps

while ( my $hsp = $hit->next_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");

#return evalue
$logger->debug("\neValue :".$hsp->evalue);
$logger->debug("\nPercent Identity
:".$hsp->percent_identity);
$outputArray[$arrayCnt++] = $hsp->evalue;
#return gaps
$outputArray[$arrayCnt++] = $hsp->percent_identity;
#return alignment
#write_aln function writes the sequence allignment to the
#specified file (here tempHitFile)
#so we are stoaring the actual hit allignment to the file
#and again recollecting it into the a string
$alnIO->write_aln($aln);
open hitFile, "tempHitFile" or die "Can't read file";

undef $/;
#getting the whole file into the outputArray
my $allignMent = <hitFile>;
$outputArray[$arrayCnt++] = $allignMent;
$logger->debug("\nAllignments :".$allignMent);
close hitFile;
$hsp = undef;
}
$hit = undef;
}
$result = undef;
}
# my $cmd = "rm $tempFileName";
# system ($cmd);
# print "\nDeleting input file...$tempFileName and returning
# outputArray @outputArray";
return \@outputArray;
}

my $methods = {'blastParser' => \&blastParser};
$logger->debug("Starting XMLRPC Server...");
Frontier::Daemon->new(LocalPort => 9011, methods => $methods) or die
"Couldn't start HTTP server : $!";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top