Permalink
Browse files

Merge pull request #215 from MG-RAST/master

hotfix back to develop
  • Loading branch information...
jaredbischof committed Dec 20, 2012
2 parents bc9c838 + 18ed6d5 commit bc478e94fd55da8c56d23d59710d80f528c6b836
Showing with 19 additions and 11 deletions.
  1. +17 −9 src/MGRAST/lib/Analysis.pm
  2. +2 −2 src/MGRAST/lib/WebPage/Analysis.pm
View
@@ -1606,10 +1606,14 @@ sub get_md5_data {
my $data = {};
my $jobs = [];
- while ( my ($mg, $j) = each %{$self->_job_map} ) {
- my $c = $self->_memd->get($mg.$cache_key);
- if ($c) { $data->{$mg} = $c; }
- else { push @$jobs, $j; }
+ if ($md5s && (@$md5s > 0)) {
+ $jobs = $self->_jobs;
+ } else {
+ while ( my ($mg, $j) = each %{$self->_job_map} ) {
+ my $c = $self->_memd->get($mg.$cache_key);
+ if ($c) { $data->{$mg} = $c; }
+ else { push @$jobs, $j; }
+ }
}
unless (@$jobs) { return [ map { @$_ } values %$data ]; }
@@ -1618,7 +1622,7 @@ sub get_md5_data {
$alen = (defined($alen) && ($alen =~ /^\d+$/)) ? "j.len_avg >= $alen" : "";
my %umd5s = ($md5s && (@$md5s > 0)) ? map {$_, 1} @$md5s : {};
- my $qmd5s = ($md5s && (@$md5s > 0)) ? "j.md5 IN (" . join(",", map {"'$_'"} keys %umd5s) . ")" : "";
+ my $qmd5s = ($md5s && (@$md5s > 0)) ? "j.md5 IN (" . join(",", keys %umd5s) . ")" : "";
my $qseek = $ignore_sk ? "" : "j.seek IS NOT NULL AND j.length IS NOT NULL";
my $qrep = $rep_org_src ? "j.md5=r.md5 AND r.source=".$self->_src_id->{$rep_org_src} : "";
my $where = $self->_get_where_str(['j.'.$self->_qver, "j.job IN (".join(",", @$jobs).")", $qrep, $qmd5s, $eval, $ident, $alen, $qseek]);
@@ -1650,10 +1654,14 @@ sub get_md5_abundance {
my $data = {};
my $jobs = [];
- while ( my ($mg, $j) = each %{$self->_job_map} ) {
- my $c = $self->_memd->get($mg.$cache_key);
- if ($c) { $data->{$mg} = $c; }
- else { push @$jobs, $j; }
+ if ($md5s && (@$md5s > 0)) {
+ $jobs = $self->_jobs;
+ } else {
+ while ( my ($mg, $j) = each %{$self->_job_map} ) {
+ my $c = $self->_memd->get($mg.$cache_key);
+ if ($c) { $data->{$mg} = $c; }
+ else { push @$jobs, $j; }
+ }
}
unless (@$jobs) { return $data; }
@@ -1577,7 +1577,7 @@ sub workbench_hits_table {
my $md5_type = $self->{mgdb}->type_for_md5s(\@md5s, 1); # id => [md5, type]
my $source_data = {}; # md5 => [ source, id, function ]
if (@ach_srcs > 0) {
- map { $source_data->{$_->[1]} = [ @$_[4,0,2] ] } grep { $_->[2] } @{$self->{mgdb}->annotation_for_md5s(\@md5s, \@ach_srcs)};
+ map { push @{$source_data->{$_->[1]}}, [ @$_[4,0,2] ] } grep { $_->[2] } @{$self->{mgdb}->annotation_for_md5s(\@md5s, \@ach_srcs)};
}
my $html = "<p>Hits for " . scalar(@md5s) . " unique sequences within ";
@@ -1604,7 +1604,7 @@ sub workbench_hits_table {
$html .= "source ".$srcs[0];
}
$html .= "</p>";
-
+
my @table_data = ();
foreach my $row ( @$analysis_data ) {
my ($mg, $md5, $num, $seek, $len) = @$row[0,1,2,9,10];

0 comments on commit bc478e9

Please sign in to comment.