forked from berman-lab/ymap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hapmap.finalize_hapmap.php
executable file
·46 lines (38 loc) · 1.84 KB
/
hapmap.finalize_hapmap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
session_start();
$user = $_SESSION['user'];
error_reporting(E_ALL);
require_once 'constants.php';
ini_set('display_errors', 1);
// If the user is not logged on, redirect to login page.
if(!isset($_SESSION['logged_on'])){
header('Location: user.login.php');
}
$bad_chars = array(",", "\\", "/", " ");
$hapmap = str_replace($bad_chars,"_",trim( filter_input(INPUT_POST, "hapmap", FILTER_SANITIZE_STRING) ));
$user = filter_input(INPUT_POST, "user", FILTER_SANITIZE_STRING);
$key = filter_input(INPUT_POST, "key", FILTER_SANITIZE_STRING);
$dir1 = "users/".$user."/hapmaps";
$dir2 = "users/".$user."/hapmaps/".$hapmap;
$dir3 = "users/default/hapmaps/".$hapmap;
// figure out what user the hapmap is installed under.
$folder = "users/".$user."/hapmaps/".$hapmap."/";
// Re-initialize 'process_log.txt' file.
$logOutputName = "users/".$user."/hapmaps/".$hapmap."/process_log.txt";
$logOutput = fopen($logOutputName, 'a');
fwrite($logOutput, "Log file restarted for hapmap finalization.\n");
// Generate 'complete.txt' file to let the pipeline know that the haplotype map has been finalized.
$handleName = "users/".$user."/hapmaps/".$hapmap."/complete.txt";
$handle = fopen($handleName, 'w');
fwrite($handle, "complete");
fclose($handle);
// Run finalization python scripts to process Ymap-internal hapmap to final output versions.
// python [Ymap_root]/scripts_seqModules/scripts_hapmaps/process_hapmap.output_cleaned.py [raw_hapmap_file] > [cleaned_hapmap_file]
// python [Ymap_root]/scripts_seqModules/scripts_hapmaps/process_hapmap.output_errors.py [raw_hapmap_file] > [errors_hapmap_file]
fwrite($logOutput, "Haplotype map finalized.\n");
fclose($logOutput);
?>
<script type="text/javascript">
var ff = parent.parent.document.getElementById('panel_hapmap_iframe');
ff.src = ff.src;
</script>