Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #270 from jaredbischof/develop

These changes require a version release.
  • Loading branch information...
commit 63ee59298a255a88b03c22f39787b55c801ba2c1 2 parents 3971ff7 + 1492c89
Travis Harrison teharrison authored
4 src/MGRAST/cgi/upload.cgi
@@ -297,13 +297,13 @@ if (scalar(@rest) && $rest[0] eq 'user_inbox') {
297 297 if($seqfile3 eq "") {
298 298 $command = "echo \"$fix_files_str $Conf::pairend_join -j -m 8 -p 10 -t $udir/.tmp -o $udir/$joinfile $udir/$seqfile1 $udir/$seqfile2 2>&1 | tee -a $udir/$seqfile1.error_log > $udir/$seqfile2.error_log; rm $lock_file1 $lock_file2 $lock_file3;\" | /usr/local/bin/qsub -q fast -j oe -N $jobid -l walltime=60:00:00 -m n -o $udir/.tmp";
299 299 } else {
300   - $command = "echo \"$fix_files_str $Conf::pairend_join -j -r -i $seqfile3 -m 8 -p 10 -t $udir/.tmp -o $udir/$joinfile $udir/$seqfile1 $udir/$seqfile2 2>&1 | tee -a $udir/$seqfile1.error_log > $udir/$seqfile2.error_log; rm $lock_file1 $lock_file2 $lock_file3;\" | /usr/local/bin/qsub -q fast -j oe -N $jobid -l walltime=60:00:00 -m n -o $udir/.tmp";
  300 + $command = "echo \"$fix_files_str $Conf::pairend_join -j -r -i $udir/$seqfile3 -m 8 -p 10 -t $udir/.tmp -o $udir/$joinfile $udir/$seqfile1 $udir/$seqfile2 2>&1 | tee -a $udir/$seqfile1.error_log > $udir/$seqfile2.error_log; rm $lock_file1 $lock_file2 $lock_file3;\" | /usr/local/bin/qsub -q fast -j oe -N $jobid -l walltime=60:00:00 -m n -o $udir/.tmp";
301 301 }
302 302 } else {
303 303 if($seqfile3 eq "") {
304 304 $command = "echo \"$fix_files_str $Conf::pairend_join -m 8 -p 10 -t $udir/.tmp -o $udir/$joinfile $udir/$seqfile1 $udir/$seqfile2 2>&1 | tee -a $udir/$seqfile1.error_log > $udir/$seqfile2.error_log; rm $lock_file1 $lock_file2 $lock_file3;\" | /usr/local/bin/qsub -q fast -j oe -N $jobid -l walltime=60:00:00 -m n -o $udir/.tmp";
305 305 } else {
306   - $command = "echo \"$fix_files_str $Conf::pairend_join -r -i $seqfile3 -m 8 -p 10 -t $udir/.tmp -o $udir/$joinfile $udir/$seqfile1 $udir/$seqfile2 2>&1 | tee -a $udir/$seqfile1.error_log > $udir/$seqfile2.error_log; rm $lock_file1 $lock_file2 $lock_file3;\" | /usr/local/bin/qsub -q fast -j oe -N $jobid -l walltime=60:00:00 -m n -o $udir/.tmp";
  306 + $command = "echo \"$fix_files_str $Conf::pairend_join -r -i $udir/$seqfile3 -m 8 -p 10 -t $udir/.tmp -o $udir/$joinfile $udir/$seqfile1 $udir/$seqfile2 2>&1 | tee -a $udir/$seqfile1.error_log > $udir/$seqfile2.error_log; rm $lock_file1 $lock_file2 $lock_file3;\" | /usr/local/bin/qsub -q fast -j oe -N $jobid -l walltime=60:00:00 -m n -o $udir/.tmp";
307 307 }
308 308 }
309 309 $jnum = `$command`;
12 src/MGRAST/html/js/pca.js
@@ -177,7 +177,17 @@ function min_max(items, c1, c2){
177 177 c1_max = (c1_max && c1_max > items[i][c1]) ? c1_max : items[i][c1];
178 178 c2_min = (c2_min && c2_min < items[i][c2]) ? c2_min : items[i][c2];
179 179 c2_max = (c2_max && c2_max > items[i][c2]) ? c2_max : items[i][c2];
180   - }
  180 + }
  181 + // If min == max for either axis, we want to artificially create a gap between
  182 + // them so that the axis has some span, otherwise the plot is messed up.
  183 + if(c1_min == c1_max) {
  184 + c1_min = c1_min - 0.5;
  185 + c1_max = c1_max + 0.5;
  186 + }
  187 + if(c2_min == c2_max) {
  188 + c2_min = c2_min - 0.5;
  189 + c2_max = c2_max + 0.5;
  190 + }
181 191 var c1_diff = Math.abs(c1_min - c1_max);
182 192 var c2_diff = Math.abs(c2_min - c2_max);
183 193 return [(c1_min-(c1_diff*0.1)),(c1_max+(c1_diff*0.1)), Math.abs((c1_max+(c1_diff*0.1))-(c1_min-(c1_diff*0.1))),(c2_min-(c2_diff*0.1)),(c2_max+(c2_diff*0.1)), Math.abs((c2_max+(c2_diff*0.1))-(c2_min-(c2_diff*0.1)))];
20 src/MGRAST/lib/WebPage/Analysis.pm
@@ -1914,17 +1914,9 @@ sub single_visual {
1914 1914 } else {
1915 1915 $mgs .= "metagenome ".$mgnames->[0];
1916 1916 }
1917   - my $sorcs = "";
1918   - my @sources = $cgi->param('source');
1919   - foreach my $source (@sources) {
1920   - $settings_preserve .= "<input type='hidden' name='source' value='".$source."'>";
1921   - }
1922   - if (scalar(@sources) > 1) {
1923   - my $last = pop(@sources);
1924   - $sorcs = join(", ", @sources)." and $last";
1925   - } else {
1926   - $sorcs = $sources[0];
1927   - }
  1917 + my $source = $cgi->param('source');
  1918 + $settings_preserve .= "<input type='hidden' name='source' value='".$source."'>";
  1919 +
1928 1920 my $cutoffs = "a maximum e-value of 1e-" . ($cgi->param('evalue') || '0') . ", ";
1929 1921 $cutoffs .= "a minimum identity of " . ($cgi->param('identity') || '0') . " %, ";
1930 1922 $cutoffs .= "and a minimum alignment length of " . ($cgi->param('alength') || '1') . ' measured in aa for protein and bp for RNA databases';
@@ -1946,7 +1938,7 @@ sub single_visual {
1946 1938 $settings_preserve .= "<input type='hidden' name='alength' value='" . ($cgi->param('alength') || '1') . "'>";
1947 1939 my $fid = $cgi->param('fid') || int(rand(1000000));
1948 1940
1949   - my $settings = "<i>This data was calculated for $mgs. The data was compared to $sorcs using $cutoffs.$pset</i><br/>";
  1941 + my $settings = "<i>This data was calculated for $mgs. The data was compared to $source using $cutoffs.$pset</i><br/>";
1950 1942
1951 1943 ## determine if any metagenomes missing from results
1952 1944 my $missing_txt = "";
@@ -2014,7 +2006,7 @@ sub single_visual {
2014 2006 { name => 'align len std dev', visible => 0, sortable => 1, tooltip => 'standard deviation of<br>the alignment length of the hits' },
2015 2007 { name => 'md5s', visible => 0 },
2016 2008 { name => '# hits', visible => 1, sortable => 1, filter => 1, operators => ['less','more'], tooltip => 'number of unique hits in protein or rna database' },
2017   - { name => "<input type='button' onclick='buffer_data(\"table\", \"".$t->id."\", \"18\", \"16\", \"0\", \"-\", \"9\");' value='to workbench'>", input_type => 'checkbox', tooltip => 'check to select features<br>to add to workbench' } ];
  2009 + { name => "<input type='button' onclick='buffer_data(\"table\", \"".$t->id."\", \"18\", \"16\", \"0\", \"".$source."\", \"9\");' value='to workbench'>", input_type => 'checkbox', tooltip => 'check to select features<br>to add to workbench' } ];
2018 2010
2019 2011 #### do the pivoting
2020 2012 unless (defined $cgi->param('group_by')) {
@@ -2297,7 +2289,7 @@ sub single_visual {
2297 2289 }
2298 2290 }
2299 2291 }
2300   - return clear_progress_image()."<h3 style='margin-top: 0px;'>".$header_names->{$level}." Distribution (".$cgi->param('single_bar_sel').") <input type='button' value='download' title='click to download tabular data' onclick='myWindow=window.open(\"\",\"\",\"width=600,height=500\");myWindow.document.write(\"<pre>$download_data_string</pre>\");myWindow.focus();'> <input type='button' value='to workbench' onclick='buffer_data(\"barchart\", \"$level$fid\", \"$sorcs phylogenetic\", \"".$cgi->param('single_bar_sel')."\", \"0\", \"".join(";",$cgi->param('source'))."\");'></h3></a>".$dom_v->output."<br><input type='hidden' id='$level$fid\_md5s' value='".join(";", keys(%$md5s))."'><input type='hidden' id='$level$fid\_mgids' value='".join(";", @comp_mgs)."'><div id='".(int($level)+1)."_$fid'></div>";
  2292 + return clear_progress_image()."<h3 style='margin-top: 0px;'>".$header_names->{$level}." Distribution (".$cgi->param('single_bar_sel').") <input type='button' value='download' title='click to download tabular data' onclick='myWindow=window.open(\"\",\"\",\"width=600,height=500\");myWindow.document.write(\"<pre>$download_data_string</pre>\");myWindow.focus();'> <input type='button' value='to workbench' onclick='buffer_data(\"barchart\", \"$level$fid\", \"$source phylogenetic\", \"".$cgi->param('single_bar_sel')."\", \"0\", \"".join(";",$cgi->param('source'))."\");'></h3></a>".$dom_v->output."<br><input type='hidden' id='$level$fid\_md5s' value='".join(";", keys(%$md5s))."'><input type='hidden' id='$level$fid\_mgids' value='".join(";", @comp_mgs)."'><div id='".(int($level)+1)."_$fid'></div>";
2301 2293 }
2302 2294 }
2303 2295
53 src/MGRAST/lib/WebPage/MetagenomeOverview.pm
@@ -383,7 +383,18 @@ sub output {
383 383 if ($source_chart) {
384 384 $html .= "<li><a href='#source_ref'>Source Distribution</a></li>";
385 385 }
386   - $html .= "<li><a href='#len_ref'>Sequence Length Histogram</a></li>";
  386 +
  387 + # sequence length histogram
  388 + my @len_raw_hist = sort {$a->[0] <=> $b->[0]} @{ $mgdb->get_histogram_nums($job->job_id, 'len', 'raw') };
  389 + my @len_qc_hist = sort {$a->[0] <=> $b->[0]} @{ $mgdb->get_histogram_nums($job->job_id, 'len', 'qc') };
  390 + my $len_min = (@len_raw_hist && @len_qc_hist) ? min($len_raw_hist[0][0], $len_qc_hist[0][0]) : (@len_raw_hist ? $len_raw_hist[0][0] : (@len_qc_hist ? $len_qc_hist[0][0] : 0));
  391 + my $len_max = (@len_raw_hist && @len_qc_hist) ? max($len_raw_hist[-1][0], $len_qc_hist[-1][0]) : (@len_raw_hist ? $len_raw_hist[-1][0] : (@len_qc_hist ? $len_qc_hist[-1][0] : 0));
  392 + my $len_raw_bins = @len_raw_hist ? &get_bin_set(\@len_raw_hist, $len_min, $len_max, $self->data('bin_size')) : [];
  393 + my $len_qc_bins = @len_qc_hist ? &get_bin_set(\@len_qc_hist, $len_min, $len_max, $self->data('bin_size')) : [];
  394 +
  395 + unless($len_max == $len_min) {
  396 + $html .= "<li><a href='#len_ref'>Sequence Length Histogram</a></li>";
  397 + }
387 398 $html .= "<li><a href='#gc_ref'>Sequence GC Distribution</a></li>";
388 399 $html .= "</ul></ul></div></td></tr></table><br>";
389 400
@@ -666,15 +677,8 @@ $drisee_boilerplate
666 677 <div id='alpha_div'></div>
667 678 </div>~;
668 679
669   - # sequence length histogram
670   - my @len_raw_hist = sort {$a->[0] <=> $b->[0]} @{ $mgdb->get_histogram_nums($job->job_id, 'len', 'raw') };
671   - my @len_qc_hist = sort {$a->[0] <=> $b->[0]} @{ $mgdb->get_histogram_nums($job->job_id, 'len', 'qc') };
672   - my $len_min = (@len_raw_hist && @len_qc_hist) ? min($len_raw_hist[0][0], $len_qc_hist[0][0]) : (@len_raw_hist ? $len_raw_hist[0][0] : (@len_qc_hist ? $len_qc_hist[0][0] : 0));
673   - my $len_max = (@len_raw_hist && @len_qc_hist) ? max($len_raw_hist[-1][0], $len_qc_hist[-1][0]) : (@len_raw_hist ? $len_raw_hist[-1][0] : (@len_qc_hist ? $len_qc_hist[-1][0] : 0));
674   - my $len_raw_bins = @len_raw_hist ? &get_bin_set(\@len_raw_hist, $len_min, $len_max, $self->data('bin_size')) : [];
675   - my $len_qc_bins = @len_qc_hist ? &get_bin_set(\@len_qc_hist, $len_min, $len_max, $self->data('bin_size')) : [];
676   -
677   - $html .= qq~<a name='len_ref'></a>
  680 + unless($len_max == $len_min) {
  681 + $html .= qq~<a name='len_ref'></a>
678 682 <h3>Sequence Length Histogram
679 683 <a style='cursor:pointer;clear:both;font-size:small;padding-left:10px;' onclick='
680 684 if (this.innerHTML=="show") {
@@ -687,10 +691,10 @@ $drisee_boilerplate
687 691 <div id='len_show'>
688 692 <p>The histograms below show the distribution of sequence lengths in basepairs for this metagenome. Each position represents the number of sequences within a length bp range.</p><p>The data used in these graphs are based on raw upload and post QC sequences.</p>~;
689 693
690   - if (@$len_raw_bins > 1) {
691   - my $len_raw_data = join("~", map { $_->[0] .";;" . $_->[1] } @$len_raw_bins);
692   - my $len_raw_link = $self->chart_export_link($len_raw_bins, 'upload_len_hist');
693   - $html .= qq~<p>$len_raw_link</p>
  694 + if (@$len_raw_bins > 1) {
  695 + my $len_raw_data = join("~", map { $_->[0] .";;" . $_->[1] } @$len_raw_bins);
  696 + my $len_raw_link = $self->chart_export_link($len_raw_bins, 'upload_len_hist');
  697 + $html .= qq~<p>$len_raw_link</p>
694 698 <div id='static2'>
695 699 The image is currently dynamic. To be able to right-click/save the image, please click the static button
696 700 <input type='button' value='static' onclick='
@@ -710,13 +714,13 @@ The image is currently dynamic. To be able to right-click/save the image, please
710 714 <div><div id='length_hist_raw'></div></div>
711 715 <input type='hidden' id='len_data_raw' value='$len_raw_data'>
712 716 <img src='./Html/clear.gif' onload='draw_histogram_plot("len_data_raw", "length_hist_raw", "bps", "Number of Reads Uploaded");'>~;
713   - } else {
714   - $html .= "<p><em>Raw sequence length histogram " . (@$len_raw_bins ? "has insufficient data" : "not yet computed") . ".</em></p>";
715   - }
716   - if (@$len_qc_bins > 1) {
717   - my $len_qc_data = join("~", map { $_->[0] .";;" . $_->[1] } @$len_qc_bins);
718   - my $len_qc_link = $self->chart_export_link($len_qc_bins, 'postqc_len_hist');
719   - $html .= qq~<p>$len_qc_link</p>
  717 + } else {
  718 + $html .= "<p><em>Raw sequence length histogram " . (@$len_raw_bins ? "has insufficient data" : "not yet computed") . ".</em></p>";
  719 + }
  720 + if (@$len_qc_bins > 1) {
  721 + my $len_qc_data = join("~", map { $_->[0] .";;" . $_->[1] } @$len_qc_bins);
  722 + my $len_qc_link = $self->chart_export_link($len_qc_bins, 'postqc_len_hist');
  723 + $html .= qq~<p>$len_qc_link</p>
720 724 <div id='static3'>
721 725 The image is currently dynamic. To be able to right-click/save the image, please click the static button
722 726 <input type='button' value='static' onclick='
@@ -736,10 +740,11 @@ The image is currently dynamic. To be able to right-click/save the image, please
736 740 <div><div id='length_hist_qc'></div></div>
737 741 <input type='hidden' id='len_data_qc' value='$len_qc_data'>
738 742 <img src='./Html/clear.gif' onload='draw_histogram_plot("len_data_qc", "length_hist_qc", "bps", "Number of Reads Post QC");'>~;
739   - } else {
740   - $html .= "<p><em>QC sequence length histogram " . (@$len_qc_bins ? "has insufficient data" : "not yet computed") . ".</em></p>";
  743 + } else {
  744 + $html .= "<p><em>QC sequence length histogram " . (@$len_qc_bins ? "has insufficient data" : "not yet computed") . ".</em></p>";
  745 + }
  746 + $html .= "</div>";
741 747 }
742   - $html .= "</div>";
743 748
744 749 # sequence gc distribution
745 750 my @gc_raw_hist = sort {$a->[0] <=> $b->[0]} @{ $mgdb->get_histogram_nums($job->job_id, 'gc', 'raw') };

0 comments on commit 63ee592

Please sign in to comment.
Something went wrong with that request. Please try again.