Hi Junjun and all, Thank you very very much. It really helped. Regards, Manjula
On Thu, Jul 28, 2011 at 3:22 AM, Junjun Zhang <[email protected]>wrote: > Hi Manjula, > > They are two different issues for timeout error and Can't call method > "getDisplayNames" on an undefined value. > > You can easily fix the problem with timeout by setting the limit to a > larger value in the code: lib/BioMart/Configuration/URLLocation.pm, looking > for the following line: > > $ua->timeout(20); > > That means any query that takes longer than 20 seconds will be timed out. > You may want to set it to something like 180 (3 minutes) so it won't easily > time out slow queries. > > > The second problem is caused by the fact that 'count query' and 'data > query' can not run one after the other without re-set the 'count' flag in > the query object. > > Your script should work fine if you re-set count to '0' before executing > the data query as below: > > ############################## GET COUNT ############################ > $query->count(1); > $query_runner->execute($query); > > print $query_runner->getCount(); > > > ##################################################################### > > > ############################## GET RESULTS ########################## > # to obtain unique rows only > print "Getting unique rows\n"; > > *$query->count(0);* > > $query_runner->uniqueRowsOnly(1); > > $query_runner->execute($query); > $query_runner->printHeader(); > $query_runner->printResults(); > $query_runner->printFooter(); > ##################################################################### > > Hope this helps, > > Let me know if you have any further questions. > > Cheers, > Junjun > > > > From: Manjula Dharmawardhana <[email protected]> > Date: Wed, 27 Jul 2011 01:36:38 -0400 > > To: jzhang <[email protected]> > Cc: "[email protected]" <[email protected]> > Subject: Re: [BioMart Users] Any solution for connect:timeout > > Hi Junjun and all, > Thank you for the quick reply. > I have tried many times and now I am getting; > Can't call method "getDisplayNames" on an undefined value at > /home/manjula/biomart-perl/lib/BioMart/QueryRunner.pm line 281. > > This error occurs before setting the Attributes and filters. Strange thing > is that, it does not occur if I turn off getting the count and ask only for > the data. > > Regards, > Manjula > > On Wed, Jul 27, 011 at 7:17 AM, Junjun Zhang <[email protected]>wrote: > >> Hi Manjula, >> >> Thanks for providing the information, we will test it here and update you >> what we found out. >> >> Best regards, >> Junjun >> >> >> From: Manjula Dharmawardhana <[email protected]> >> Date: Tue, 26 Jul 2011 10:14:20 -0400 >> To: jzhang <[email protected]> >> Cc: "[email protected]" <[email protected]> >> Subject: Re: [BioMart Users] Any solution for connect:timeout >> >> Hi All, >> I am getting the timeout error, >> "Problems with the web server: 500 Can't connect to >> www.sanger.ac.uk:80<http://www.sanger.ac.uk/>(connect: timeout)" >> most of the time. Here is my Registry file; >> >> <?xml version="1.0" encoding="UTF-8"?> >> <!-- <!DOCTYPE MartRegistry> --> >> <MartRegistry> >> <MartURLLocation >> database="cosp" >> default="1" >> displayName="COSMIC (SANGER UK)" >> host="www.sanger.ac.uk" >> includeDatasets="" >> martUser="" >> name="CosmicMart" >> path="/genetics/CGP/cosmic/biomart/martservice" >> port="80" >> redirect="1" >> serverVirtualSchema="default" >> visible="1" >> /> >> </MartRegistry> >> >> >> >> >> >> >> Here is my code >> >> #!/usr/local/bin/perl >> >> use strict; >> use lib '/home/manjula/biomart-perl/lib'; >> use BioMart::Initializer; >> use BioMart::Query; >> use BioMart::QueryRunner; >> >> my $confFile ="/home/manjula/TestMart/cosmicRegistry.xml"; >> print "Starting API\n"; >> >> print "using cached registry build\n"; >> my $action='cached'; >> my $initializer = BioMart::Initializer->new('registryFile'=>$confFile, >> 'action'=>$action); >> my $registry = $initializer->getRegistry; >> >> my $query = >> BioMart::Query->new('registry'=>$registry,'virtualSchemaName'=>'default'); >> >> >> $query->setDataset("COSMIC54"); >> $query->addFilter("samp_gene_mutated", ["y"]); >> $query->addFilter("site_primary", ["liver"]); >> $query->addFilter("tumour_source", ["recurrent"]); >> $query->addAttribute("sample_name"); >> $query->addAttribute("sample_source"); >> $query->addAttribute("tumour_source"); >> $query->addAttribute("gene_name"); >> $query->addAttribute("accession_number"); >> $query->addAttribute("site_primary"); >> $query->addAttribute("hist_primary"); >> $query->addAttribute("pubmed_pmid"); >> >> $query->formatter("TSV"); >> >> my $query_runner = BioMart::QueryRunner->new(); >> ############################## GET COUNT ############################ >> $query->count(1); >> $query_runner->execute($query); >> #my $resultNo= >> print $query_runner->getCount(); >> #if ($resultNo>0) { >> #print "Count is $resultNo\n"; >> #} else { >> #print "No results\n"; >> #} >> ##################################################################### >> >> >> ############################## GET RESULTS ########################## >> # to obtain unique rows only >> print "Getting unique rows\n"; >> $query_runner->uniqueRowsOnly(1); >> >> $query_runner->execute($query); >> $query_runner->printHeader(); >> $query_runner->printResults(); >> $query_runner->printFooter(); >> ##################################################################### >> >> >> Strange thing is that, I get the timeout error when I use a clean registry >> build. When I use the cached registry I get this error, >> 1Getting unique rows >> Can't call method "getDisplayNames" on an undefined value at >> /home/manjula/biomart-perl/lib/BioMart/QueryRunner.pm line 281. >> Here 1 is the number of rows, then my print, after that the error. But I >> do not get it all the time. Only getting it most of the time. >> How can make this more reliable >> Any help is greatly appreciated. >> >> Thanking in advance >> Manjula >> >> >>
_______________________________________________ Users mailing list [email protected] https://lists.biomart.org/mailman/listinfo/users
