Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/MGRAST/lib/Analysis.pm
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,9 @@ sub get_taxa_stats {
my ($self, $mgid, $taxa) = @_;
my $stats = $self->_mg_stats($mgid);
if (exists $stats->{taxonomy}) {
return exists($stats->{taxonomy}{$taxa}) ? $stats->{taxonomy}{$taxa} : {};
return exists($stats->{taxonomy}{$taxa}) ? $stats->{taxonomy}{$taxa} : [];
} else {
return {};
return [];
}
# [ name, abundance ]
}
Expand All @@ -465,17 +465,17 @@ sub get_ontology_stats {
my ($self, $mgid, $source) = @_;
my $stats = $self->_mg_stats($mgid);
if (exists $stats->{ontology}) {
return exists($stats->{ontology}{$source}) ? $stats->{ontology}{$source} : {};
return exists($stats->{ontology}{$source}) ? $stats->{ontology}{$source} : [];
} else {
return {};
return [];
}
# [ top level name, abundance ]
}

sub get_rarefaction_coords {
my ($self, $mgid) = @_;
my $stats = $self->_mg_stats($mgid);
return exists($stats->{rarefaction}) ? $stats->{rarefaction} : {};
return exists($stats->{rarefaction}) ? $stats->{rarefaction} : [];
# [ x, y ]
}

Expand All @@ -502,7 +502,7 @@ sub get_histogram_nums {
} elsif ($type eq 'gc' && exists($stats->{gc_histogram}) && exists($stats->{gc_histogram}{$stage})) {
return $stats->{gc_histogram}{$stage};
} else {
return {};
return [];
}
# [ value, count ]
}
Expand Down
11 changes: 5 additions & 6 deletions src/MGRAST/lib/WebPage/MetagenomeOverview.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1332,13 +1332,12 @@ sub get_drisee_chart {
}

# data = [ pos, A, T, C, G, N, X, total ]
my $data = $drisee->{percents}{data};
my @down_data = @$data;
unshift @down_data, $drisee->{percents}{columns};
my @values_data = ($drisee->{counts}{columns}, @{$drisee->{counts}{data}});
my @down_data = ($drisee->{percents}{columns}, @{$drisee->{percents}{data}});

my $values_link = $self->chart_export_link($drisee, 'drisee_values', 'Download DRISEE values');
my $values_link = $self->chart_export_link(\@values_data, 'drisee_values', 'Download DRISEE values');
my $drisee_link = $self->chart_export_link(\@down_data, 'drisee_plot', 'Download DRISEE plot');
my $drisee_rows = join(",\n", map { "[".join(',', @$_)."]" } @$data);
my $drisee_rows = join(",\n", map { "[".join(',', @$_)."]" } @{$drisee->{percents}{data}});
my $html = qq~
<p>$values_link</p>
<p>$drisee_link</p>
Expand Down Expand Up @@ -1764,7 +1763,7 @@ sub chart_export {

sub chart_export_link {
my ($self, $data, $name, $text) = @_;

$text = $text || "Download chart data";
$name =~ s/\s+/_/g;
$name =~ s/\W//g;
Expand Down