forked from berman-lab/ymap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.create_window.php
executable file
·377 lines (374 loc) · 20 KB
/
project.create_window.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<?php
session_start();
if(!isset($_SESSION['logged_on'])){ ?> <script type="text/javascript"> parent.reload(); </script> <?php } else { $user = $_SESSION['user']; }
require_once 'constants.php';
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
?>
<html lang="en">
<HEAD>
<style type="text/css">
body {font-family: arial;}
.tab {margin-left: 1cm;}
</style>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>[Needs Title]</title>
</HEAD>
<BODY onload="UpdateHapmapList(); UpdateParentList()">
<div id="loginControls"><p>
</p></div>
<div id="projectCreationInformation"><p>
<form action="project.create_server.php" method="post">
<table><tr bgcolor="#CCFFCC"><td>
<label for="project">Dataset Name : </label><input type="text" name="project" id="project">
</td><td>
Unique name for this dataset.
</td></tr><tr bgcolor="#CCCCFF"><td>
<label for="ploidy">Ploidy of experiment : </label><input type="text" name="ploidy" id="ploidy" value="2.0"><br>
</td><td>
A ploidy estimate for the strain being analyzed.
</td></tr><tr bgcolor="#CCFFCC"><td>
<label for="ploidy">Baseline ploidy : </label><input type="text" name="ploidyBase" id="ploidyBase" value="2.0"><br>
</td><td>
The copy number to use as a baseline in drawing copy number variations.
</td></tr><tr bgcolor="#CCCCFF"><td>
<label for="showAnnotations">Generate figure with annotations?</label><select name="showAnnotations" id="showAnnotations">
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</td><td>
Genome annotations, such as rDNA locus, can be drawn at bottom of figures.
</td></tr><tr bgcolor="#CCFFCC"><td>
<label for="dataType">Data type : </label><select name="dataType" id="dataType" onchange="UpdateForm(); UpdateHapmap(); UpdateParentList()">
<option value="0">SnpCgh microarray </option>
<option value="1">Whole genome NGS </option>
<option value="2">ddRADseq </option>
<option value="3">RNAseq (testing) </option>
<option value="4">IonExpress-seq (testing) </option>
<!-- <option value="5">RADseq </option> --!>
</select>
</td><td>
The type of data to be processed.
</td></tr><tr bgcolor="#CCCCFF"><td valign="top">
<div id="hiddenFormSection1" style="display:none">
<label for="readType">Read type : </label><select name="readType" id="readType">
<option value="0">single-end reads; FASTQ/ZIP/GZ file.</option>
<option value="1">paired-end reads; FASTQ/ZIP/GZ files.</option>
<option value="2">SAM/BAM file.</option>
<option value="3">TXT file.</option>
</select><br>
</div>
</td><td>
<div id="hiddenFormSection2" style="display:none">
Single-end or paired-end reads in FASTQ format can be compressed into ZIP or GZ archives or in SAM/BAM alignment files.<br>
Tab-delimted TXT column format is described in 'About' tab of main page.
</div>
</td></tr><tr bgcolor="#CCFFCC"><td>
<div id="hiddenFormSection3" style="display:none">
<label for="genome">Reference genome : </label><select name="genome" id="genome" onchange="UpdateHapmap(); UpdateHapmapList(); UpdateParentList()">
<?php
$genomesMap = array(); // A mapping of folder names to display names, sorted by folder names.
foreach (array("default", $user) as $genomeUser) {
$genomesDir = "users/" . $genomeUser . "/genomes/";
foreach (array_diff(glob($genomesDir . "*"), array('..', '.')) as $genomeDir) {
// display genome only if processing finished
if (file_exists($genomeDir . "/complete.txt")) {
$genomeDirName = str_replace($genomesDir, "", $genomeDir);
$genomeDisplayName = file_get_contents($genomeDir . "/name.txt");
$genomesMap[$genomeDirName] = $genomeDisplayName;
}
}
}
ksort($genomesMap);
foreach ($genomesMap as $genomeDirName => $genomeDisplayName) {
echo "\n\t\t\t\t\t<option value='" . $genomeDirName . "'>" . $genomeDisplayName . "</option>";
}
?>
</select><br>
</div>
</td><td valign="top">
<div id="hiddenFormSection4" style="display:none">
</div>
</td></tr><tr bgcolor="#CCCCFF"><td>
<?php
// figure out which hapmaps have been defined for this species, if any.
$hapmapsDir1 = "users/default/hapmaps/";
$hapmapsDir2 = "users/".$user."/hapmaps/";
$hapmapFolders1 = array_diff(glob($hapmapsDir1."*"), array('..', '.'));
$hapmapFolders2 = array_diff(glob($hapmapsDir2."*"), array('..', '.'));
$hapmapFolders_raw = array_merge($hapmapFolders1,$hapmapFolders2);
// Go through each $hapmapFolder and look at 'genome.txt'; build javascript array of hapmapName:genome pairs.
?>
<div id="hiddenFormSection10" style="display:none">
Restriction enzymes :
<select id="selectRestrictionEnzymes" name="selectRestrictionEnzymes" onchange="UpdateParent();">
<option value="MfeI_MboI">MfeI & MboI</option>
<?php // <option value="BamHI_BclI">BamHI & BclI (testing)</option>
?>
</select>
</div>
</td><td valign="top">
<div id="hiddenFormSection11" style="display:none">
Analysis of ddRADseq data is limited to restriction fragments bound by both restriction enzymes.<br>
If your restriction enzyme pair is not listed, you can contact the system administrators about developing the option as a collaboration.
</div>
</td></tr><tr bgcolor="#CCCCFF"><td>
<?php
// figure out which hapmaps have been defined for this species, if any.
$hapmapsDir1 = "users/default/hapmaps/";
$hapmapsDir2 = "users/".$user."/hapmaps/";
$hapmapFolders1 = array_diff(glob($hapmapsDir1."*"), array('..', '.'));
$hapmapFolders2 = array_diff(glob($hapmapsDir2."*"), array('..', '.'));
$hapmapFolders_raw = array_merge($hapmapFolders1,$hapmapFolders2);
// Go through each $hapmapFolder and look at 'genome.txt'; build javascript array of hapmapName:genome pairs.
?>
<div id="hiddenFormSection5" style="display:none">
Haplotype map : <select id="selectHapmap" name="selectHapmap" onchange="UpdateParent();"><option>[choose]</option></select>
<script type="text/javascript">
var hapmapGenome_entries = [['hapmap','genome']<?php
foreach ($hapmapFolders_raw as $key=>$folder) {
$filename = $folder."/genome.txt";
if (!file_exists($filename)) {
continue;
}
$handle = fopen($filename, "r");
$genome_string = trim(fgets($handle));
fclose($handle);
$hapmapName = $folder;
$hapmapName = str_replace($hapmapsDir1,"",$hapmapName);
$hapmapName = str_replace($hapmapsDir2,"",$hapmapName);
echo ",['{$hapmapName}','{$genome_string}']";
}
?>];
</script>
</div>
</td><td valign="top">
<div id="hiddenFormSection6" style="display:none">
A haplotype map defines the phasing of heterozygous SNPs across the genome and must be matched to the background of the experiment for informative results.
SNP information from the hapmap will be used for SNP/LOH analsyses.
</div>
</td></tr><tr bgcolor="#CCFFCC"><td>
<?php
// figure out which hapmaps have been defined for this species, if any.
$projectsDir1 = "users/default/projects/";
$projectsDir2 = "users/".$user."/projects/";
$projectFolders1 = array_diff(glob($projectsDir1."*"), array('..', '.'));
$projectFolders2 = array_diff(glob($projectsDir2."*"), array('..', '.'));
$projectFolders_raw = array_merge($projectFolders1,$projectFolders2);
// Go through each $projectFolder and look at 'genome.txt' and 'dataType.txt'; build javascript array of prejectName:genome:datatype triplets.
?>
<div id="hiddenFormSection7" style="display:none">
Parental strain : <select id="selectParent" name="selectParent"><option>[choose]</option></select>
<script type="text/javascript">
var parentGenomeDatatype_entries = [['parent','genome','dataType']<?php
foreach ($projectFolders_raw as $key=>$folder) {
// display project only if processing finished
if (file_exists($folder . "/complete.txt")) {
$genome_filename = $folder."/genome.txt";
$genome_string = "";
if (file_exists($genome_filename)) {
// Some datasets don't have a reference genome (e.g., SnpCgh arrays).
$handle1 = fopen($genome_filename, "r");
$genome_string = trim(fgets($handle1));
fclose($handle1);
}
$handle2 = fopen($folder."/dataType.txt", "r");
$dataType_string = trim(fgets($handle2));
$dataType_string = explode(":",$dataType_string);
$dataType_string = $dataType_string[0];
fclose($handle2);
$parentName = $folder;
// reading name according to the folder the parent exist
if (file_exists($folder."/name.txt")) {
$projectNameString = file_get_contents($folder."/name.txt");
$parentName = str_replace($projectsDir1,"",$parentName);
} else {
$projectNameString = file_get_contents($folder."/name.txt");
}
$parentName = str_replace($projectsDir1,"",$parentName);
$parentName = str_replace($projectsDir2,"",$parentName);
echo ",['{$parentName}','{$genome_string}',{$dataType_string}, '{$projectNameString}']";
}
}
?>];
</script>
</div>
</td><td valign="top">
<div id="hiddenFormSection8a" style="display:none">
This strain will act as the SNP distribution control.
</div>
<div id="hiddenFormSection8b" style="display:none">
This strain will act as the CNV normalization control.
</div>
</td></tr><tr bgcolor="#CCFFCC"><td>
<div id="hiddenFormSection9a" style="display:inline">
<!-- SnpCgh array --!>
<input type="checkbox" name="0_bias2" value="True" checked>GC-content bias<br>
<input type="checkbox" name="0_bias4" value="True" >chromosome-end bias
</div>
<div id="hiddenFormSection9b" style="display:none">
<!-- WGseq --!>
<input type="checkbox" id="1_bias2" name="1_bias2" value="True" checked>GC-content bias<br>
<input type="checkbox" id="1_bias4" name="1_bias4" value="True" onchange="UpdateBiasWG();" >chromosome-end bias (forces using GC content bias)
</div>
<div id="hiddenFormSection9c" style="display:none">
<!-- ddRADseq --!>
<input type="checkbox" name="2_bias1" value="True" checked>fragment-length bias<br>
<input type="checkbox" name="2_bias2" value="True" checked>GC-content bias<br>
<input type="checkbox" name="2_bias4" value="True" >chromosome-end bias
</div>
<div id="hiddenFormSection9d" style="display:none">
<!-- RNAseq --!>
<input type="checkbox" name="3_bias1" value="True" checked>ORF-length bias<br>
<input type="checkbox" name="3_bias2" value="True" checked>GC-content bias<br>
<input type="checkbox" name="3_bias4" value="True" >chromosome-end bias
</div>
<div id="hiddenFormSection9e" style="display:none">
<!-- IonExpress-seq --!>
<input type="checkbox" name="4_bias2" value="True" checked>GC-content bias<br>
<input type="checkbox" name="4_bias4" value="True" >chromosome-end bias
</div>
</td><td>
Corrections applied.
</td></tr></table><br>
<input type="submit" value="Create New Dataset">
</form>
<script type="text/javascript">
UpdateParent = function() {
// if 'selectHapmap' isn't "[None defined]" then hide parental strain row.
var selectedHapmap = document.getElementById("selectHapmap").value;
if (selectedHapmap == 'none') {
document.getElementById("hiddenFormSection7" ).style.display = 'inline';
document.getElementById("hiddenFormSection8a").style.display = 'none';
document.getElementById("hiddenFormSection8b").style.display = 'inline';
} else {
if (document.getElementById("dataType").value == 2) { // ddRADseq.
document.getElementById("hiddenFormSection7" ).style.display = 'inline';
document.getElementById("hiddenFormSection8a").style.display = 'none';
document.getElementById("hiddenFormSection8b").style.display = 'inline';
} else {
document.getElementById("hiddenFormSection7" ).style.display = 'none';
document.getElementById("hiddenFormSection8a").style.display = 'none';
document.getElementById("hiddenFormSection8b").style.display = 'none';
}
}
}
UpdateHapmapList=function() {
var selectedGenome = document.getElementById("genome").value; // grab genome name.
var select = document.getElementById("selectHapmap"); // grab select list.
select.innerHTML = '';
var el = document.createElement("option");
el.textContent = '[None defined]';
el.value = 'none';
select.appendChild(el);
for (var i = 1; i < hapmapGenome_entries.length; i++) {
var item = hapmapGenome_entries[i];
if (selectedGenome == item[1]) {
var el = document.createElement("option");
el.textContent = item[0];
el.value = item[0];
select.appendChild(el);
}
}
}
UpdateParentList=function() {
var selectedGenome = document.getElementById("genome").value; // grab genome name.
var selectedDatatype = document.getElementById("dataType").value; // grab dataset type.
var select = document.getElementById("selectParent"); // grab select list.
select.innerHTML = '';
var el = document.createElement("option");
el.textContent = '[This strain is parental type.]';
el.value = 'none';
select.appendChild(el);
for (var i = 1; i < parentGenomeDatatype_entries.length; i++) {
var item = parentGenomeDatatype_entries[i];
if (selectedGenome == item[1] && selectedDatatype == item[2]) {
var el = document.createElement("option");
el.textContent = item[3];
el.value = item[0];
select.appendChild(el);
}
}
}
UpdateForm=function() {
if (document.getElementById("dataType").value == 0) { // SnpCgh Microarray.
document.getElementById("hiddenFormSection1").style.display = 'none';
document.getElementById("hiddenFormSection2").style.display = 'none';
document.getElementById("hiddenFormSection3").style.display = 'none';
document.getElementById("hiddenFormSection4").style.display = 'none';
document.getElementById("hiddenFormSection5").style.display = 'none';
document.getElementById("hiddenFormSection6").style.display = 'none';
document.getElementById("hiddenFormSection7").style.display = 'none';
document.getElementById("hiddenFormSection9a").style.display = 'inline';
document.getElementById("hiddenFormSection9b").style.display = 'none';
document.getElementById("hiddenFormSection9c").style.display = 'none';
document.getElementById("hiddenFormSection9d").style.display = 'none';
document.getElementById("hiddenFormSection9e").style.display = 'none';
document.getElementById("hiddenFormSection10").style.display = 'none';
document.getElementById("hiddenFormSection11").style.display = 'none';
} else { // WGseq or ddRADseq.
document.getElementById("hiddenFormSection1").style.display = 'inline';
document.getElementById("hiddenFormSection2").style.display = 'inline';
document.getElementById("hiddenFormSection3").style.display = 'inline';
document.getElementById("hiddenFormSection4").style.display = 'inline';
document.getElementById("hiddenFormSection5").style.display = 'inline';
document.getElementById("hiddenFormSection6").style.display = 'inline';
document.getElementById("hiddenFormSection7").style.display = 'inline';
document.getElementById("hiddenFormSection10").style.display = 'none';
document.getElementById("hiddenFormSection11").style.display = 'none';
if (document.getElementById("dataType").value == 1) { // WGseq
document.getElementById("hiddenFormSection9a").style.display = 'none';
document.getElementById("hiddenFormSection9b").style.display = 'inline';
document.getElementById("hiddenFormSection9c").style.display = 'none';
document.getElementById("hiddenFormSection9d").style.display = 'none';
document.getElementById("hiddenFormSection9e").style.display = 'none';
} else if (document.getElementById("dataType").value == 2) { // ddRADseq
document.getElementById("hiddenFormSection9a").style.display = 'none';
document.getElementById("hiddenFormSection9b").style.display = 'none';
document.getElementById("hiddenFormSection9c").style.display = 'inline';
document.getElementById("hiddenFormSection9d").style.display = 'none';
document.getElementById("hiddenFormSection9e").style.display = 'none';
document.getElementById("hiddenFormSection10").style.display = 'inline';
document.getElementById("hiddenFormSection11").style.display = 'inline';
} else if (document.getElementById("dataType").value == 3) { // RNAseq (tsting)
document.getElementById("hiddenFormSection9a").style.display = 'none';
document.getElementById("hiddenFormSection9b").style.display = 'none';
document.getElementById("hiddenFormSection9c").style.display = 'none';
document.getElementById("hiddenFormSection9d").style.display = 'inline';
document.getElementById("hiddenFormSection9e").style.display = 'none';
} else { // IonExpress (testing)
document.getElementById("hiddenFormSection9a").style.display = 'none';
document.getElementById("hiddenFormSection9b").style.display = 'none';
document.getElementById("hiddenFormSection9c").style.display = 'none';
document.getElementById("hiddenFormSection9d").style.display = 'none';
document.getElementById("hiddenFormSection9e").style.display = 'inline';
}
}
}
UpdateHapmap=function() {
if (document.getElementById("dataType").value == 0) { // SnpCgh microarray.
document.getElementById("hiddenFormSection8a").style.display = 'none';
document.getElementById("hiddenFormSection8b").style.display = 'none';
} else if (document.getElementById("dataType").value == 2) { // ddRADseq.
document.getElementById("hiddenFormSection8a").style.display = 'none';
document.getElementById("hiddenFormSection8b").style.display = 'inline';
} else { // WGseq
document.getElementById("hiddenFormSection8a").style.display = 'inline';
document.getElementById("hiddenFormSection8b").style.display = 'none';
}
}
UpdateBiasWG=function() {
if (document.getElementById("1_bias4").checked)
{
document.getElementById("1_bias2").disabled = true;
document.getElementById("1_bias2").checked = true;
}
else
{
document.getElementById("1_bias2").disabled = false;
document.getElementById("1_bias2").checked = true;
}
}
</script>
</p></div>
</body>
</html>