[InterMine Dev] errors using perl API

Givan, Scott A. givans at missouri.edu
Thu Aug 8 21:49:15 BST 2013


Hi,

I've created a short Gene list on the mousemine website and I'm trying to access it locally via the perl API. I adapted the perl script from the "Get Code" pull-down menu:

#!/usr/bin/env perl

use 5.010; # Require at least Perl version 5.8
use strict;
use autodie;
use Getopt::Long; # use GetOptions function to for CL args
use Webservice::InterMine;

# Set the output field separator as tab
$, = "\t";
# Print unicode to standard out
binmode(STDOUT, 'utf8');
# Silence warnings when printing null fields
no warnings ('uninitialized');

# The following import statement sets MouseMine as your default
# You must also supply your login details here to access this query
use Webservice::InterMine 0.9904 'http://www.mousemine.org/mousemine', 'M1R4W0S5Yfk6y7913eW1';

my $query = new_query(class => 'Gene');

# The view specifies the output columns
$query->add_view(qw/
primaryIdentifier
symbol
name
sequenceOntologyTerm.name
chromosome.primaryIdentifier
chromosomeLocation.id
description
/);

$query->add_constraint(
path => 'Gene',
op => 'IN',
value => '25genes',
code => 'A',
);

## Use an iterator to avoid having all rows in memory at once.
#my $it = $query->iterator();
#while (my $row = <$it>) {
# print $row->{'primaryIdentifier'}, $row->{'symbol'}, $row->{'name'},
# $row->{'sequenceOntologyTerm.name'}, $row->{'chromosome.primaryIdentifier'},
# $row->{'chromosomeLocation.id'}, $row->{'description'}, "\n";
#}

my $results = $query->results(as => 'arrayrefs');

for my $row (@$results) {
say $row->[0];
}


I get the following error:

Bad Request (400): Incomplete result set received at constructor Webservice::InterMine::ResultIterator::new (defined at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/ResultIterator.pm line 535) line 177.
at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/ResultIterator.pm line 408, <GEN2> line 49.
Webservice::InterMine::ResultIterator::get_all('Webservice::InterMine::ResultIterator=HASH(0x7a36cd0)') called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/ResultIterator.pm line 321
eval {...} called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/ResultIterator.pm line 321
Webservice::InterMine::ResultIterator::_find_real_error_message('Webservice::InterMine::ResultIterator=HASH(0x7a36cd0)') called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/ResultIterator.pm line 314
Webservice::InterMine::ResultIterator::set_headers('Webservice::InterMine::ResultIterator=HASH(0x7a36cd0)') called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/ResultIterator.pm line 27
Webservice::InterMine::ResultIterator::BUILD('Webservice::InterMine::ResultIterator=HASH(0x7a36cd0)', 'HASH(0x5733b78)') called at constructor Webservice::InterMine::ResultIterator::new (defined at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/ResultIterator.pm line 535) line 177
Webservice::InterMine::ResultIterator::new('Webservice::InterMine::ResultIterator', 'url', 'URI::http=SCALAR(0x5143de0)', 'parameters', 'HASH(0x50910e8)', 'row_parser', 'Webservice::InterMine::Parser::JSON::ArrayRefs=HASH(0x7a45398)', 'authorization', undef, ...) called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/Service.pm line 770
Webservice::InterMine::Service::get_results_iterator('Webservice::InterMine::Service=HASH(0x44526e0)', 'URI::http=SCALAR(0x5143de0)', 'HASH(0x50910e8)', 'ARRAY(0x480f8a0)', 'arrayrefs', 'perl', undef) called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/Query/Roles/Runnable.pm line 196
Webservice::InterMine::Query::Roles::Runnable::results_iterator('Webservice::InterMine::Query=HASH(0x4a87ab8)', 'as', 'arrayrefs') called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/Query/Roles/Runnable.pm line 275
Webservice::InterMine::Query::Roles::Runnable::results('Webservice::InterMine::Query=HASH(0x4a87ab8)', 'as', 'arrayrefs') called at /home/sgivan/projects/RNAseq/bin/cuffdiff_InterMine.pl line 48
at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/Service.pm line 777, <GEN2> line 49.
Webservice::InterMine::Service::get_results_iterator('Webservice::InterMine::Service=HASH(0x44526e0)', 'URI::http=SCALAR(0x5143de0)', 'HASH(0x50910e8)', 'ARRAY(0x480f8a0)', 'arrayrefs', 'perl', undef) called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/Query/Roles/Runnable.pm line 196
Webservice::InterMine::Query::Roles::Runnable::results_iterator('Webservice::InterMine::Query=HASH(0x4a87ab8)', 'as', 'arrayrefs') called at /opt/perl/lib/site_perl/5.14.2/Webservice/InterMine/Query/Roles/Runnable.pm line 275
Webservice::InterMine::Query::Roles::Runnable::results('Webservice::InterMine::Query=HASH(0x4a87ab8)', 'as', 'arrayrefs') called at /home/sgivan/projects/RNAseq/bin/cuffdiff_InterMine.pl line 48

Neither the iterator or arrayrefs for results works. Can you see if this script works on your end?

Scott A. Givan
Associate Director
Informatics Research Core Facility
240e Bond Life Sciences Center
Research Assistant Professor
Molecular Microbiology and Immunology
University of Missouri, Columbia

TEL 573-882-2948
FAX 573-884-9676
@sgivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.intermine.org/pipermail/dev/attachments/20130808/fbea8d40/attachment.html>


More information about the dev mailing list