Skip to content

Commit

Permalink
remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayBirkett committed Mar 30, 2017
1 parent 4c05f4d commit 5339981
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2,056 deletions.
13 changes: 7 additions & 6 deletions analyze/histo.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

require_once 'config.php';
require $config['root_dir'].'includes/bootstrap.inc';
require $config['root_dir'] . 'downloads/downloads_class2.php';
require $config['root_dir'] . 'downloads/downloads_class.php';

$mysqli = connecti();

Expand All @@ -26,9 +26,7 @@

/** Using a PHP class to display histogram
*
* @category PHP
* @package T3
* @author Clay Birkett <[email protected]>
* @author Clay Birkett <[email protected]>
* @license http://triticeaetoolbox.org/wheat/docs/LICENSE Berkeley-based
* @link http://triticeaetoolbox.org/wheat/histo.php
*
Expand Down Expand Up @@ -199,9 +197,12 @@ private function runHisto()
fclose($h);
}
if (file_exists("/tmp/tht/$filename4")) {
print "<img src=\"/tmp/tht/$filename4\" /><br>";
print "<img src=\"/tmp/tht/$filename4\"/>";
print "<form method=\"get\" action=\"/tmp/tht/$filename4\">";
print "<button type=\"submit\">Download Image</button>";
print "</form>";
} else {
echo "Error in R script R/GShisto.R<br>\n";
echo "Error in R script R/GShisto.R<br>\n";
}
}

Expand Down
2 changes: 1 addition & 1 deletion analyze/outlier.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

require_once 'config.php';
require $config['root_dir'] . 'includes/bootstrap2.inc';
require $config['root_dir'] . 'downloads/downloads_class2.php';
require $config['root_dir'] . 'downloads/downloads_class.php';

$mysqli = connecti();

Expand Down
7 changes: 4 additions & 3 deletions analyze/training.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
require_once 'config.php';
require $config['root_dir'] . 'includes/bootstrap2.inc';
require $config['root_dir'] . 'downloads/marker_filter.php';
require $config['root_dir'] . 'downloads/downloads_class2.php';
require $config['root_dir'] . 'downloads/downloads_class.php';
set_time_limit(0);

$mysqli = connecti();
Expand Down Expand Up @@ -238,6 +238,7 @@ private function type1Checksession()
<option value="AOPT"> AOPT
</select>
</table>
<img alt="spinner" id="spinner" src="images/ajax-loader.gif" style="display:none;" />
</div>
<?php
} elseif (isset($_SESSION['selected_lines'])) {
Expand Down Expand Up @@ -365,9 +366,9 @@ private function type1Session()
$dtype = "qtlminer";
$h = fopen("$dir/$filename", "w");
if ($typeGE == "true") {
$output = type4BuildMarkersDownload($experiment_uid, $min_maf, $max_missing, $dtype, $h);
type4BuildMarkersDownload($experiment_uid, $min_maf, $max_missing, $dtype, $h);
} else {
$output = $dObj->type3BuildMarkersDownload($lines, $markers, $dtype, $h);
$dObj->type3BuildMarkersDownload($lines, $markers, $dtype, $h);
}
fclose($h);
$estimate = count($lines) + count($markers);
Expand Down
6 changes: 5 additions & 1 deletion downloads/downloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@
require_once $config['root_dir'].'downloads/vcf_class.php';
require 'downloads_class.php';

new Downloads($_GET['function']);
if (isset($_GET['function'])) {
new Downloads($_GET['function']);
} else {
new Downloads("web");
}
6 changes: 3 additions & 3 deletions downloads/downloads_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct($function = null)
case 'verifyLines':
$this->verifyLines();
break;
default:
case 'web':
$this->type1Select();
break;
}
Expand Down Expand Up @@ -1050,7 +1050,7 @@ private function cmp($a, $b) {
*
* @return NULL
*/
function type1_build_traits_download($experiments, $traits, $datasets)
public function type1_build_traits_download($experiments, $traits, $datasets)
{
global $mysqli;
$delimiter = "\t";
Expand Down Expand Up @@ -1133,7 +1133,7 @@ function type1_build_traits_download($experiments, $traits, $datasets)
* @param string $dtype
* @return string
*/
private function type1_build_tassel_traits_download($experiments, $traits, $datasets, $subset, $dtype)
public function type1_build_tassel_traits_download($experiments, $traits, $datasets, $subset, $dtype)
{
global $mysqli;
$delimiter = "\t";
Expand Down
Loading

0 comments on commit 5339981

Please sign in to comment.