Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fixes / updates to api2 #123

Merged
merged 3 commits into from

2 participants

@teharrison
Owner

No description provided.

@jaredbischof jaredbischof merged commit 0f47782 into MG-RAST:develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 4, 2012
  1. fixed typos

    Travis Harrison authored
  2. fixed typos in links, added project as id / url tuple

    Travis Harrison authored
  3. make return data consistant with attributes in info

    Travis Harrison authored
This page is out of date. Refresh to see the latest.
View
2  src/MGRAST/lib/resources2/library.pm
@@ -248,7 +248,7 @@ sub check_pagination {
next if ($param eq 'offset');
$additional_params .= $param."=".$cgi->param($param)."&";
}
- if (length($additional_params) {
+ if (length($additional_params)) {
chop $additional_params;
}
my $prev_offset = $offset - $limit;
View
39 src/MGRAST/lib/resources2/metagenome.pm
@@ -108,10 +108,9 @@ sub attributes {
return { "id" => [ 'string', 'unique object identifier' ],
"name" => [ 'string', 'human readable identifier' ],
"sequence_type" => [ 'string', 'sequencing type' ],
- "file_size" => [ 'integer', 'sequence file size in bytes' ],
"library" => [ 'reference library', 'reference to the related library object' ],
"sample" => [ 'reference sample', 'reference to the related sample object' ],
- "primary_project" => [ 'reference project', 'reference to the primary project object' ],
+ "project" => [ 'reference project', 'reference to the project object' ],
"metadata" => [ 'hash', 'key value pairs describing metadata' ],
"created" => [ 'date', 'time the object was first created' ],
"version" => [ 'integer', 'version of the object' ],
@@ -194,37 +193,25 @@ sub prepare_data {
my $objects = [];
foreach my $job (@$data) {
my $obj = {};
- $obj->{id} = "mgm".$job->{metagenome_id};
- $obj->{name} = $job->{name};
- $obj->{url} = $cgi->url.'/metagenome/'.$obj->{id};
- $obj->{created} = $job->{created_on};
+ $obj->{id} = "mgm".$job->{metagenome_id};
+ $obj->{name} = $job->{name};
+ $obj->{url} = $cgi->url.'/metagenome/'.$obj->{id};
+ $obj->{created} = $job->{created_on};
if ($cgi->param('verbosity')) {
if ($cgi->param('verbosity') eq 'full') {
- $obj->{metadata} = $jobdata->{$job->{metagenome_id}};
+ $obj->{metadata} = $jobdata->{$job->{metagenome_id}};
}
if ($cgi->param('verbosity') eq 'verbose' || $cgi->param('verbosity') eq 'full') {
- if ($jobdata->{$job->{metagenome_id}}) {
- if ($jobdata->{$job->{metagenome_id}}->{project}) {
- $obj->{project_name} = $jobdata->{$job->{metagenome_id}}->{project}->{name} || "";
- if ($jobdata->{$job->{metagenome_id}}->{project}->{data}) {
-
- $obj->{PI} = ($jobdata->{$job->{metagenome_id}}->{project}->{data}->{PI_firstname} || "")." ".($jobdata->{$job->{metagenome_id}}->{project}->{data}->{PI_lastname} || "");
- }
- }
- if ($jobdata->{$job->{metagenome_id}}->{sample} && $jobdata->{$job->{metagenome_id}}->{sample}->{data}) {
- $obj->{country} = $jobdata->{$job->{metagenome_id}}->{sample}->{data}->{country} || "";
- $obj->{biome} = $jobdata->{$job->{metagenome_id}}->{sample}->{data}->{biome} || "";
- $obj->{location} = $jobdata->{$job->{metagenome_id}}->{sample}->{data}->{location} || "";
- }
- }
- $obj->{sample} = $job->{sample} ? [ "mgs".$job->sample->ID, $cgi->url."sample/mgs".$job->sample->ID ] : undef;
- $obj->{library} = $job->{library} ? [ "mgl".$job->library->ID, $cgi->url."/library/mgl".$job->library->ID ] : undef;
+ $obj->{version} = 1;
+ $obj->{sequence_type} = $job->{sequence_type};
+ $obj->{project} = $job->{primary_project} ? [ "mgp".$job->primary_project->id, $cgi->url."/project/mgp".$job->primary_project->id ] : undef;
+ $obj->{sample} = $job->{sample} ? [ "mgs".$job->sample->ID, $cgi->url."/sample/mgs".$job->sample->ID ] : undef;
+ $obj->{library} = $job->{library} ? [ "mgl".$job->library->ID, $cgi->url."/library/mgl".$job->library->ID ] : undef;
} elsif ($cgi->param('verbosity') ne 'minimal') {
- return_data({ "ERROR" => "invalid value for option verbosity", 400);
+ return_data({ "ERROR" => "invalid value for option verbosity" }, 400);
}
}
-
push(@$objects, $obj);
}
@@ -262,7 +249,7 @@ sub check_pagination {
next if ($param eq 'offset');
$additional_params .= $param."=".$cgi->param($param)."&";
}
- if (length($additional_params) {
+ if (length($additional_params)) {
chop $additional_params;
}
my $prev_offset = $offset - $limit;
View
2  src/MGRAST/lib/resources2/project.pm
@@ -251,7 +251,7 @@ sub check_pagination {
next if ($param eq 'offset');
$additional_params .= $param."=".$cgi->param($param)."&";
}
- if (length($additional_params) {
+ if (length($additional_params)) {
chop $additional_params;
}
my $prev_offset = $offset - $limit;
View
2  src/MGRAST/lib/resources2/sample.pm
@@ -250,7 +250,7 @@ sub check_pagination {
next if ($param eq 'offset');
$additional_params .= $param."=".$cgi->param($param)."&";
}
- if (length($additional_params) {
+ if (length($additional_params)) {
chop $additional_params;
}
my $prev_offset = $offset - $limit;
View
2  src/MGRAST/lib/resources2/sequences.pm
@@ -230,7 +230,7 @@ sub check_pagination {
next if ($param eq 'offset');
$additional_params .= $param."=".$cgi->param($param)."&";
}
- if (length($additional_params) {
+ if (length($additional_params)) {
chop $additional_params;
}
my $prev_offset = $offset - $limit;
View
2  src/MGRAST/lib/resources2/sequenceset.pm
@@ -259,7 +259,7 @@ sub check_pagination {
next if ($param eq 'offset');
$additional_params .= $param."=".$cgi->param($param)."&";
}
- if (length($additional_params) {
+ if (length($additional_params)) {
chop $additional_params;
}
my $prev_offset = $offset - $limit;
Something went wrong with that request. Please try again.