Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Hi Experts Please help :: Problem in Bio-Parser....with XML-RPC call

Reply
Thread Tools

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

 
 
deep
Guest
Posts: n/a
 
      07-30-2006
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:aemon;

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:aemon->new(LocalPort => 9011, methods => $methods) or die
"Couldn't start HTTP server : $!";

 
Reply With Quote
 
 
 
 
deep
Guest
Posts: n/a
 
      07-30-2006
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

deep wrote:
> 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:aemon;
>
> 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:aemon->new(LocalPort => 9011, methods => $methods) or die
> "Couldn't start HTTP server : $!";


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using CSS for best layout - experts help please HTML 5 12-02-2007 07:43 PM
Data layer experts - Please Help! William Buchanan ASP .Net 10 06-13-2006 03:48 AM
HTML experts please help Smooth Operator Computer Support 2 04-01-2006 11:09 PM
Re: EXPERTS please HELP! Modem connected but webpages are unavailable!! #! Computer Support 0 04-05-2005 08:07 AM
All Experts, please HELP!! P.D. ASP .Net 2 10-29-2003 07:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57