Bio-KBase
view release on metacpan or search on metacpan
scripts/get_abundance_profile view on Meta::CPAN
my $url = $base_url . "abundance_profile/".$mgid."?format=".$format."&type=".$type."&source=".$source;
my $req = HTTP::Request->new(GET => "$url");
my $res = $ua->request($req);
if ($res->is_success){
if ($res->header('Content-Type') eq "application/json") {
my $json = JSON->new->allow_nonref;
my $biom = $json->decode( $res->decoded_content );
# transform biom into plain list
if ($biom->{matrix_type} eq "dense" and $format eq "plain"){
my $counter = 0;
foreach my $data_row ( @{$biom->{data}}){
# features have multiple source IDs , return all source IDs for given md5
if ($type eq "feature"){
scripts/get_abundance_profile view on Meta::CPAN
print join "\t" , $biom->{rows}->[$counter]->{id} , @{$biom->{rows}->[$counter]->{metadata}->{ontology}} , @$data_row , "\n";
}
else{
print join "\t" , $biom->{rows}->[$counter]->{id} , @$data_row , "\n";
}
$counter++;
exit if ($debug and $counter == 20) ;
}
}
else{
print $res->decoded_content , "\n";
}
}
else{
print $res->decoded_content , "\n";
}
}
( run in 0.739 second using v1.01-cache-2.11-cpan-26ccb49234f )