-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.php
2085 lines (1847 loc) · 116 KB
/
index.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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// =============================================================================
// _____ _ _
// / ____(_) | |
// | | __ _ _ __ | | ____ _ ___
// | | |_ | | '_ \| |/ / _` |/ _ \
// | |__| | | | | | < (_| | (_) |
// \_____|_|_| |_|_|\_\__, |\___/
// __/ |
// |___/ 1.0
//
// =============================================================================
// =============================================================================
// == Configuration ============================================================
// =============================================================================
include "bootstrap.php";
// =============================================================================
// == Parse user query =========================================================
// =============================================================================
$query = explode("/", $_GET['q']);
// Extract page
$GINKGO_PAGE = $query[0];
if(!$GINKGO_PAGE)
$GINKGO_PAGE = 'home';
// Extract user ID
$GINKGO_USER_ID = $query[1];
if(!$GINKGO_USER_ID)
$GINKGO_USER_ID = generateID(20);
// Security patch: don't allow user IDs that aren't alphanumerical
// e.g. could use "a; echo b" as user ID; will create file "a" and write "b" to it
if(preg_match('/[^A-Za-z0-9_-]/', $GINKGO_USER_ID))
exit;
// Don't allow users to modify demo analyses
if($GINKGO_USER_ID[0] == '_' && ($GINKGO_PAGE == "home" || $GINKGO_PAGE == "dashboard")) {
header("Location: ?q=results/" . $GINKGO_USER_ID);
exit;
}
// =============================================================================
// == Page-specific configuration ==============================================
// =============================================================================
// Step 1 (choose cells), Step 2 (job name, genome, etc), Step 3 (specify email)
if($GINKGO_PAGE == "dashboard")
$MY_CELLS = getMyFiles($GINKGO_USER_ID);
// Step 4 (results)
if($GINKGO_PAGE == "results")
$CURR_CELL = $query[2];
// =============================================================================
// == Session management =======================================================
// =============================================================================
$_SESSION["user_id"] = $GINKGO_USER_ID;
// Define user directories
$userDir = DIR_UPLOADS . '/' . $GINKGO_USER_ID;
$userUrl = URL_ROOT . '/uploads/' . $GINKGO_USER_ID;
$permalink = URL_ROOT . '?q=results/' . $GINKGO_USER_ID;
if(file_exists($descFile = $userDir . '/description.txt'))
setcookie("ginkgo[$GINKGO_USER_ID]", file_get_contents($descFile), time()+36000000);
// =============================================================================
// == Template configuration ===================================================
// =============================================================================
// -- Panel for info -----------------------------------------------------------
if($GINKGO_PAGE == "results" || $GINKGO_PAGE == "analyze-subset")
{
$configFile = $userDir . "/config";
if(file_exists($configFile)) {
$f = file($configFile);
$config = array();
foreach($f as $index => $val) {
$values = explode("=", $val, 2);
$config[$values[0]] = str_replace("'", "", trim($values[1]));
}
}
}
$tmpBinMeth = split('_', $config['binMeth']);
$binInfo = $tmpBinMeth[0] . ' bins of ' . $tmpBinMeth[1]/1000 . 'kb size <small><small>(' . $tmpBinMeth[3] . '/' . $tmpBinMeth[2] . 'bp reads)</small></small>';
$clusteringInfo = $config['clustMeth'] . ' linkage, ' . str_replace('euclidian','euclidean',$config['distMeth']) . ' distance';
$segInfo = 'normalized read counts';
if($config['segMeth'] == '1')
$segInfo = 'sample with lowest IOD';
if($config['segMeth'] == '2')
$segInfo = 'uploaded reference sample';
$genome = $config['chosen_genome'];
$PANEL_INFO = <<<PANEL
<!-- Panel: Summary of parameters used -->
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-list-alt"></span> Analysis Parameters</h3></div>
<div class="panel-body">
<b>Genome:</b> $genome<br/>
<b>Binning:</b> $binInfo<br/>
<b>Segmentation:</b> using $segInfo<br/>
<b>Clustering:</b> $clusteringInfo<br/>
</div>
</div>
PANEL;
// -- Panel for permalink ------------------------------------------------------
$PANEL_LATER = <<<PANEL
<!-- Panel: Save for later -->
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-time"></span> View analysis later</h3></div>
<div class="panel-body">Access your results later at the following address:<br/><br/><textarea class="input-sm permalink">{$permalink}</textarea></div>
</div>
PANEL;
// -- Panel to show user's last analysis, if any -------------------------------
if(file_exists(DIR_UPLOADS . '/' . $GINKGO_USER_ID . '/status.xml'))
{
$PANEL_PREVIOUS = <<<PANEL
<!-- Panel: View previous analysis results -->
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-stats"></span> Previous analysis results</h3></div>
<div class="panel-body">See your <a href="?q=results/$GINKGO_USER_ID">previous analysis results</a>.<br/><br/><strong>Note</strong>: Running another analysis will overwrite previous results.</div>
</div>
PANEL;
}
// -- Panel for downloading tree -----------------------------------------------
$dloadFileSizes = array(
'SegStats' => humanFileSize("{$userDir}/SegStats"),
'SegBreaks' => humanFileSize("{$userDir}/SegBreaks"),
'SegCopy' => humanFileSize("{$userDir}/SegCopy"),
'SegNorm' => humanFileSize("{$userDir}/SegNorm"),
'SegFixed' => humanFileSize("{$userDir}/SegFixed"),
'CNV1' => humanFileSize("{$userDir}/CNV1"),
'CNV2' => humanFileSize("{$userDir}/CNV2"),
);
$rnd = rand(1e6,2e6);
$PANEL_DOWNLOAD = <<<PANEL
<!-- Panel: Download results -->
<div id="results-download" class="panel panel-default" style="display:none;">
<div class="panel-heading"><span class="glyphicon glyphicon-tree-deciduous"></span> Tree display</div>
<!-- Table -->
<table class="table" style="font-size:12.5px;">
<tr class="active"><td><input type="radio" name="results-tree-view" onclick="javascript:drawTree('clust.xml');" checked> <strong>Normalized read counts</strong> (<a target="_blank" href="{$userUrl}/clust.newick">newick</a> | <a target="_blank" href="{$userUrl}/clust.xml">xml</a> | <a target="_blank" href="{$userUrl}/clust.pdf">pdf</a> | <a target="_blank" href="{$userUrl}/clust.jpeg">jpeg</a>)</td></tr>
<tr class="active"><td><input type="radio" name="results-tree-view" onclick="javascript:drawTree('clust2.xml');"> <strong>Copy-number</strong> (<a target="_blank" href="{$userUrl}/clust2.newick">newick</a> | <a target="_blank" href="{$userUrl}/clust2.xml">xml</a> | <a target="_blank" href="{$userUrl}/clust2.pdf">pdf</a> | <a target="_blank" href="{$userUrl}/clust2.jpeg">jpeg</a>)</td></tr>
<tr class="active"><td><input type="radio" name="results-tree-view" onclick="javascript:drawTree('clust3.xml');"> <strong>Correlations</strong> (<a target="_blank" href="{$userUrl}/clust3.newick">newick</a> | <a target="_blank" href="{$userUrl}/clust3.xml">xml</a> | <a target="_blank" href="{$userUrl}/clust3.pdf">pdf</a> | <a target="_blank" href="{$userUrl}/clust3.jpeg">jpeg</a>)</td></tr>
</table>
</div>
<div id="results-download2" class="panel panel-default" style="display:none;">
<div class="panel-heading"><span class="glyphicon glyphicon-file"></span> Download processed data</div>
<!-- Table -->
<table class="table" style="font-size:12.5px;">
<tr class="active"><td><a target="_blank" href="{$userUrl}/SegStats?uniq={$rnd}"><strong>Statistics</strong></a>: Bin count statistics for each cell <strong>({$dloadFileSizes['SegStats']})</strong>.</span></td></tr>
<tr class="active"><td><a target="_blank" href="{$userUrl}/SegBreaks?uniq={$rnd}"><strong>Breakpoints</strong></a>: Matrix that encodes whether a cell has a breakpoint at a bin position; 1 = breakpoint present, 0 = no breakpoint at that position; rows = bins, columns = cells <strong>({$dloadFileSizes['SegBreaks']}).</strong></span></td></tr>
<tr class="active"><td><a target="_blank" href="{$userUrl}/SegCopy?uniq={$rnd}"><strong>Copy Number</strong></a>: Integer coopy-number state for each cell at every bin position; rows = bins, columns = cells <strong>({$dloadFileSizes['SegCopy']}).</strong></span></td></tr>
<tr class="active"><td><a target="_blank" href="{$userUrl}/SegNorm?uniq={$rnd}"><strong>Normalized Counts</strong></a>: Normalized bin counts for each cell at every bin position; rows = bins, columns = cells <strong>({$dloadFileSizes['SegNorm']}).</strong></span></td></tr>
<tr class="active"><td><a target="_blank" href="{$userUrl}/SegFixed?uniq={$rnd}"><strong>Normalized and Segmented Counts</strong></a>: Normalized and segmented bin counts for each cell at every bin position; rows = bins, columns = cells <strong>({$dloadFileSizes['SegFixed']}).</strong></span></td></tr>
<tr class="active"><td><a target="_blank" href="{$userUrl}/CNV1?uniq={$rnd}"><strong>Copy number events</strong></a>: List of regions with copy number events <strong>({$dloadFileSizes['CNV1']}).</strong></span></td></tr>
<tr class="active"><td><a target="_blank" href="{$userUrl}/CNV2?uniq={$rnd}"><strong>Copy number regions</strong></a>: List of regions of amplifications (+1) and deletions (-1) <strong>({$dloadFileSizes['CNV2']}).</strong></span></td></tr>
</table>
</div>
PANEL;
// =============================================================================
// == Upload facs / binning file ===============================================
// =============================================================================
if($GINKGO_PAGE == 'admin-upload')
{
// Create user directory if doesn't exist
@mkdir($userDir);
$result = "";
// FACS file
if(!empty($_FILES['params-facs-file']))
// Upload facs file
if(is_uploaded_file($_FILES['params-facs-file']['tmp_name']))
{
move_uploaded_file($_FILES['params-facs-file']['tmp_name'], $userDir . "/user-facs.txt");
$result .= "facs";
}
// Segmentation file
if(!empty($_FILES['params-segmentation-file']))
// Upload binning file
if(is_uploaded_file($_FILES['params-segmentation-file']['tmp_name']))
{
move_uploaded_file($_FILES['params-segmentation-file']['tmp_name'], $userDir . "/user-segmentation.txt");
$result .= "segmentation";
}
die($result);
}
// =============================================================================
// == Launch analysis ==========================================================
// =============================================================================
if(isset($_POST['analyze']))
{
// Create user directory if doesn't exist
@mkdir($userDir);
// Sanitize user input (see bootstrap.php)
array_walk_recursive($_POST, 'sanitize');
$user = $GINKGO_USER_ID;
sanitize($user);
// Defaults for new analysis
$init = 1;
$process = 1;
$fix = 0;
// Did the user change the analysis parameters from the last time?
// Load previous configuration
$configFile = $userDir . "/config";
if(file_exists($configFile))
{
//
$f = file($configFile);
$oldParams = array();
foreach($f as $index => $val)
{
$values = explode("=", $val, 2);
$oldParams[$values[0]] = str_replace("", "", trim($values[1]));
}
// Defaults for old analysis (do nothing)
$init = 0;
$process = 0;
$fix = 0;
// Do we need to remap? This sets init to 1 if yes, 0 if not
$newBinParams = ($oldParams['binMeth'] != $_POST['binMeth']) ||
($oldParams['binList'] != $_POST['binList']) ||
($oldParams['rmbadbins']!= $_POST['rmbadbins']) ||
($oldParams['rmpseudoautosomal']!= $_POST['rmpseudoautosomal']);
$newFacs = ($oldParams['facs'] != $_POST['facs']);
$newSegParams = ($oldParams['segMeth'] != $_POST['segMeth']) || ($_POST['segMethCustom'] != '');
$newClustering = ($oldParams['clustMeth'] != $_POST['clustMeth']);
$newDistance = ($oldParams['distMeth'] != $_POST['distMeth']);
$newColor = ($oldParams['color'] != $_POST['color']);
$sexChange = ($oldParams['sex'] != $_POST['sex']);
// Different cells to analyze than last time?
$cells = '';
foreach($_POST['cells'] as $cell)
$cells .= str_replace("'", "", $cell) . "\n";
if($cells != file_get_contents($userDir . '/list'))
$newBinParams = 1;
// -- Set new variable values
// Redo the mapping for all files
if($newBinParams)
$init = 1;
// Redo binning stuff
if($newBinParams || $newSegParams || $newColor || $newFacs)
$process = 1;
// Redraw dendrogams
// Only need to run fix when not running process.R
if(!$process && !$init && ($newClustering || $newDistance || $sexChange))
$fix = 1;
// When redirect, if status file isn't changed quickly enough, will show up as 100% completed
// However, only delete status file if we need to redo at least 1 part of the analysis
if($init || $process || $fix) {
$statusFile = DIR_UPLOADS . '/' . $GINKGO_USER_ID . '/status.xml';
unlink($statusFile);
}
}
// Make sure have enough cells for analysis
if(count($_POST['cells']) < $GINKGO_MIN_NB_CELLS)
die("Please select at least " . $GINKGO_MIN_NB_CELLS . " cells for your analysis.");
// Create list-of-cells-to-analyze file
$cells = '';
foreach($_POST['cells'] as $cell)
$cells .= str_replace("'", "", $cell) . "\n";
file_put_contents($userDir . '/list', $cells);
// Create config file
$config = '#!/bin/bash' . "\n";
$config.= 'user=' . $user . "\n";
$config.= 'email=' . $_POST['email'] . "\n";
$config.= 'permalink=\'' . URL_ROOT . '/?q=results/' . str_replace("'", "", $user) . "'\n";
//
$config.= 'segMeth=' . $_POST['segMeth'] . "\n";
$config.= 'binMeth=' . $_POST['binMeth'] . "\n";
$config.= 'clustMeth=' . $_POST['clustMeth'] . "\n";
$config.= 'distMeth=' . $_POST['distMeth'] . "\n";
//
$config.= 'f=' . $_POST['f'] . "\n";
$config.= 'facs=' . $_POST['facs'] . "\n";
$config.= 'chosen_genome=' . $_POST['chosen_genome'] . "\n";
//
$config.= 'init=' . $init . "\n";
$config.= 'process=' . $process . "\n";
$config.= 'fix=' . $fix . "\n";
//
$config.= 'ref=' . $_POST['segMethCustom'] . "\n";
//
$config.= 'color=' . $_POST['color'] . "\n";
$config.= 'sex=' . $_POST['sex'] . "\n";
$config.= 'rmbadbins=' . $_POST['rmbadbins'] . "\n";
$config.= 'rmpseudoautosomal=' . $_POST['rmpseudoautosomal'] . "\n";
//
file_put_contents($userDir . '/config', $config);
// Start analysis
$cmd = "./scripts/analyze.sh $GINKGO_USER_ID >> $userDir/ginkgo.out 2>&1 &";
session_regenerate_id(TRUE);
$handle = popen($cmd, 'r');
pclose($handle);
// Save to cookie and file
setcookie("ginkgo[$GINKGO_USER_ID]", $_POST['job_name'], time()+36000000);
file_put_contents($userDir . '/description.txt', $_POST['job_name']);
// Return OK status
echo "OK";
exit;
}
// =============================================================================
// == Launch analysis **on subset of cells** ===================================
// =============================================================================
if(isset($_POST['analyze-subset']))
{
// Job settings
$selectedCells = $_POST['selectedCells'];
$analysisType = $_POST['analysisType'];
//
$analysisID = generateID(10);
// Save job settings
$configTxt = $analysisType . "\n";
foreach($selectedCells as $cell)
$configTxt .= $cell . "\n";
file_put_contents($userDir . '/' . $analysisID . '.config', $configTxt);
// Start analysis
$PAR = 'original';
if($config['rmpseudoautosomal'] == '1')
$PAR = 'pseudoautosomal';
$cmd = "./scripts/analyze-subset.R $GINKGO_USER_ID $analysisID $genome {$config['binMeth']} $PAR >> $userDir/ginkgo-" . $analysisID . ".out 2>&1 &";
session_regenerate_id(TRUE);
$handle = popen($cmd, 'r');
pclose($handle);
echo $analysisID;
exit;
}
if($GINKGO_PAGE == "results-subset")
{
if(file_exists('uploads/' . $GINKGO_USER_ID . '/' . $query[2] . '.done'))
echo '<img src="./uploads/' . $GINKGO_USER_ID . '/' . $query[2] . '.jpeg?uniq=' . rand(1e6,2e6) . '">';
else
echo 'Generating figure...<meta http-equiv="refresh" content="1">';
exit;
}
// =============================================================================
// == Prepare file for UCSC custom track =======================================
// =============================================================================
if(isset($_POST['ucsc']))
{
// Job settings
$cell = $_POST['cell'];
$range = $_POST['range'];
//
$analysisID = generateID(10);
// Save job settings
$configTxt = "browser position {$range}\n";
$CMD = <<<CM
awk -v CELL='{$cell}' 'BEGIN{ print "track name=Amplifications description="CELL" color=0,0,255,"; }{ if(NR==1){ for(i=1;i<=NF;i++){if(\$i==CELL)cellID=i;} }else{ if(\$cellID>2)print \$1"\t"\$2"\t"\$3; } }' ./uploads/{$GINKGO_USER_ID}/SegCopy;
awk -v CELL='{$cell}' 'BEGIN{ print "track name=Deletions description="CELL" color=255,0,0,"; }{ if(NR==1){ for(i=1;i<=NF;i++){if(\$i==CELL)cellID=i;} }else{ if(\$cellID<2)print \$1"\t"\$2"\t"\$3; } }' ./uploads/{$GINKGO_USER_ID}/SegCopy;
CM;
file_put_contents($userDir . '/' . $analysisID . '.ucsc', "browser position {$range}\n".shell_exec($CMD));
echo $analysisID;
exit;
}
// =============================================================================
// == If analysis under way, redirect to status page ===========================
// =============================================================================
// Load status.xml if exists and check if analysis under way
if($GINKGO_PAGE == "" || $GINKGO_PAGE == "home" || $GINKGO_PAGE == "dashboard") {
$statusFile = DIR_UPLOADS . '/' . $GINKGO_USER_ID . '/status.xml';
if(file_exists($statusFile)) {
$status = simplexml_load_file($statusFile);
if($status->step < 3 && $status->percentdone < 100) {
header("Location: ?q=results/" . $GINKGO_USER_ID);
exit;
}
}
}
// Load current settings
$configFile = $userDir . "/config";
if(file_exists($configFile)) {
$f = file($configFile);
$config = array();
foreach($f as $index => $val) {
$values = explode("=", $val, 2);
$config[$values[0]] = str_replace("'", "", trim($values[1]));
}
}
//
if($GINKGO_PAGE == 'admin-search')
{
$file = DIR_ROOT . '/genomes/' . $config['chosen_genome'] . '/' . ($config['rmpseudoautosomal'] == '1' ? 'pseudoautosomal' : 'original') . '/genes_' . $config['binMeth'];
$gene = escapeshellarg($_GET['gene']);
$bin = escapeshellarg($_GET['binNumber']);
//
if(isset($_GET['gene']))
die(`grep -i -w $gene $file | head -n 1 | cut -f3`);
//
if(isset($_GET['binNumber']))
die(`awk '{if($3==$bin) print $2}' $file | sort | uniq`);
}
// =============================================================================
// == HTML template ============================================================
// =============================================================================
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Ginkgo</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
<!-- Custom styles -->
<style>
html, body { height:100%; }
td { vertical-align:middle !important; }
code input { border:none; color:#c7254e; background-color:#f9f2f4; width:100%; }
code textarea { border:none; color:#c7254e; background-color:#f9f2f4; width:100%; resize:none; }
svgCanvas { fill:none; pointer-events:all; }
.jumbotron { padding:50px 30px 15px 30px; }
.glyphicon { vertical-align:top; }
.badge { vertical-align:top; margin-top:5px; }
.permalink { border:1px solid #DDD; width:100%; color:#666; background:transparent; font-family:"courier"; resize:none; height:50px; }
.sorting_asc { background: url('includes/datatables/images/sort_asc.png') no-repeat center right; }
.sorting_desc { background: url('includes/datatables/images/sort_desc.png') no-repeat center right; }
.sorting { background: url('includes/datatables/images/sort_both.png') no-repeat center right; }
.sorting_asc_disabled { background: url('includes/datatables/images/sort_asc_disabled.png') no-repeat center right; }
.sorting_desc_disabled { background: url('includes/datatables/images/sort_desc_disabled.png') no-repeat center right; }
/* callout */
.bs-callout { margin:20px 0; padding:15px 30px 15px 15px; border-left:5px solid #eee; }
.bs-callout h4 { margin-top:0; }
.bs-callout p:last-child { margin-bottom:0; }
.bs-callout code, .bs-callout .highlight { background-color:#fff; }
/* */
.bs-callout-danger { background-color:#fcf2f2; border-color:#dFb5b4; }
.bs-callout-warning { background-color:#fefbed; border-color:#f1e7bc; }
.bs-callout-info { background-color:#f0f7fd; border-color:#d0e3f0; }
/* */
#results-QA-table tr td:first-child { text-align: center; }
#results-QA-table tr td:first-child:before { content: "\f096"; font-family: FontAwesome; }
#results-QA-table tr.selected td:first-child:before { content: "\f046"; }
/* */
.codesample { background-color:#f9f2f4; font-family:Monaco, monospace, serif; font-size:90%; color:#C7254E; padding:10px; }
/* */
.graph-annotations { font-size: 11px !important; color: #fff !important; background-color: #c73030; }
</style>
<!-- Tinycon styles/javascript -->
<script type="text/javascript" src="includes/tinycon/tinycon.min.js"></script>
<link rel="icon" href="includes/tinycon/ginkgo.ico" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-31249083-2', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<!-- Navigation bar -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<ul class="nav navbar-nav">
<li>
<a class="navbar-brand dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-tree-deciduous"></span> Ginkgo <span class="caret" style="border-top-color:#ccc !important; border-bottom-color:#ccc !important;"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="?q=">Home</a></li>
<li><a href="https://github.com/robertaboukhalil/ginkgo">Code on Github</a></li>
<li><a href="http://www.nature.com/nmeth/journal/v12/n11/full/nmeth.3578.html">Our Paper</a></li>
<li class="divider"></li>
<li><a href="?q=results/_t10breast_navin"><small><small style="color:#bdc3c7">DOP-PCR</small></small> Polygenomic breast tumor — <i>Navin et al, 2011</i></a></li>
<li><a href="?q=results/_t16breast_liver_met_navin"><small><small style="color:#bdc3c7">DOP-PCR</small></small> Breast cancer + liver metastasis — <i>Navin et al, 2011</i></a></li>
<li><a href="?q=results/_neuron_mcconnell"><small><small style="color:#bdc3c7">DOP-PCR</small></small> Neurons — <i>McConnell et al, 2013</i></a></li>
<li><a href="?q=results/_ctc_ni"><small><small style="color:#bdc3c7">MALBAC </small></small> Circulating lung tumor cells — <i>Ni et al, 2013</i></a></li>
<li><a href="?q=results/_oocyte_hou"><small><small style="color:#bdc3c7">MALBAC </small></small> Oocytes — <i>Hou et al, 2013</i></a></li>
<li><a href="?q=results/_sperm_lu"><small><small style="color:#bdc3c7">MALBAC </small></small> Sperm — <i>Lu et al, 2012</i></a></li>
<li><a href="?q=results/_sperm_kirkness"><small><small style="color:#bdc3c7">MDA </small></small> Sperm — <i>Kirkness et al, 2013</i></a></li>
<li><a href="?q=results/_sperm_wang"><small><small style="color:#bdc3c7">MDA </small></small> Sperm — <i>Wang et al, 2012</i></a></li>
<li><a href="?q=results/_neuron_evrony"><small><small style="color:#bdc3c7">MDA </small></small> Neurons — <i>Evrony et al, 2012</i></a></li>
<?php if(count($_COOKIE['ginkgo']) > 0): ?>
<li class="divider"></li>
<?php foreach($_COOKIE['ginkgo'] as $id => $name): ?>
<?php if($id != "sample"): ?>
<li><a href="?q=dashboard/<?php echo $id;?>"><?php echo str_replace("'", "", $name);?></a></li>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</li>
</ul>
</div>
</div>
</div>
<!-- Welcome message -->
<div class="jumbotron">
<div class="container">
<h1><a style="text-decoration:none; color:#000" href="?q=/<?php echo $GINKGO_USER_ID; ?>">Ginkgo</a> <small><?php echo str_replace("'", "", @file_get_contents($userDir.'/description.txt')); ?></small></h1>
<div id="status" style="margin-top:20px;">
<?php if($GINKGO_PAGE == 'home'): ?>
A web tool for analyzing single-cell sequencing data.
<br>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Sample analyses <span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
<li><a href="?q=results/_t10breast_navin"><small><small style="color:#bdc3c7">DOP-PCR</small></small> Polygenomic breast tumor — <i>Navin et al, 2011</i></a></li>
<li><a href="?q=results/_t16breast_liver_met_navin"><small><small style="color:#bdc3c7">DOP-PCR</small></small> Breast cancer + liver metastasis — <i>Navin et al, 2011</i></a></li>
<li><a href="?q=results/_neuron_mcconnell"><small><small style="color:#bdc3c7">DOP-PCR</small></small> Neurons — <i>McConnell et al, 2013</i></a></li>
<li><a href="?q=results/_ctc_ni"><small><small style="color:#bdc3c7">MALBAC </small></small> Circulating lung tumor cells — <i>Ni et al, 2013</i></a></li>
<li><a href="?q=results/_oocyte_hou"><small><small style="color:#bdc3c7">MALBAC </small></small> Oocytes — <i>Hou et al, 2013</i></a></li>
<li><a href="?q=results/_sperm_lu"><small><small style="color:#bdc3c7">MALBAC </small></small> Sperm — <i>Lu et al, 2012</i></a></li>
<li><a href="?q=results/_bonemarrow_hou"><small><small style="color:#bdc3c7">MDA </small></small> Bone marrow — <i>Hou et al, 2012</i></a></li>
<li><a href="?q=results/_kidney_xu"><small><small style="color:#bdc3c7">MDA </small></small> Kidney — <i>Xu et al, 2012</i></a></li>
<li><a href="?q=results/_neuron_evrony"><small><small style="color:#bdc3c7">MDA </small></small> Neurons — <i>Evrony et al, 2012</i></a></li>
</ul>
</div>
<?php if(count($_COOKIE['ginkgo']) > 0): ?>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Load previous analysis <span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
<li class="divider"></li>
<?php foreach($_COOKIE['ginkgo'] as $id => $name): ?>
<?php if($id != "sample"): ?>
<li><a href="?q=dashboard/<?php echo $id;?>"><?php echo str_replace("'", "", $name);?></a></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php elseif($GINKGO_PAGE == 'dashboard'): ?>
<div class="status-box">Your files are uploaded. Now let's do some analysis:</div>
<?php elseif($GINKGO_PAGE == 'results'): ?>
<div class="status-box" id="results-status">
<span id="results-status-text">Updating status...</span><br />
<div class="progress progress-striped active"><div id="results-progress" class="progress-bar" role="progressbar" style="width: 0%"></div></div>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Main container -->
<div class="container">
<?php // ================================================================ ?>
<?php // == Home: Upload files ========================================== ?>
<?php // ================================================================ ?>
<?php if($GINKGO_PAGE == 'home'): ?>
<!-- Upload files -->
<?php if($GINKGO_USER_ID != 'sample' && $GINKGO_USER_ID != 'sample2'): ?>
<div class="row" style="height:100%;">
<div class="col-lg-8">
<h3 style="margin-top:-5px;"><span class="badge">STEP 0</span> Upload your .bed files <small><strong>(We accept *.bed and *.bed.gz, max 1GB/file, min 3 cells)</strong></small></h3>
<iframe id="upload-iframe" style="width:100%; height:100%; border:0;" src="includes/fileupload/?user_id=<?php echo $GINKGO_USER_ID; ?>"></iframe>
<p>
<div style="float:right">
<a id="fileupload-next-step" class="btn btn-lg btn-primary" href="?q=dashboard/<?php echo $GINKGO_USER_ID; ?>">Next step <span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</p>
</div>
<div class="col-lg-4">
<?php echo $PANEL_PREVIOUS; ?>
<?php echo $PANEL_LATER; ?>
<!-- Panel: Help -->
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-question-sign"></span> Help</h3></div>
<div class="panel-body">
<div class="panel-group" id="help-bedfmt">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title"><a class="accordion-toggle" data-toggle="collapse" data-parent="#help-bedfmt" href="#help-bedfmt-content">Sample .bed file</a></h4></div>
<div id="help-bedfmt-content" class="panel-collapse collapse in"><div class="panel-body">
<table class="table">
<thead><tr><th>chrom</th><th>chromStart</th><th>chromEnd</th></tr></thead>
<tbody><tr><td>chr1</td><td>555485</td><td>555533</td></tr><tr><td>chr1</td><td>676584</td><td>676632</td></tr><tr><td>chr1</td><td>745136</td><td>745184</td></tr></tbody>
</table>
</div></div>
</div>
</div>
<br/>
<div class="panel-group" id="help-makebed">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title"><a class="accordion-toggle" data-toggle="collapse" data-parent="#help-makebed" href="#help-makebed-content">How to make .bed files</a></h4></div>
<div id="help-makebed-content" class="panel-collapse collapse in">
<div class="panel-body">
<p>If your mapped reads are saved in the file <strong>reads.bam</strong>:</p>
<div class="codesample">bamToBed -i reads.bam > reads.bed</div>
</div>
</div>
</div>
</div>
<br/>
<div class="panel-group" id="help-details">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title"><a class="accordion-toggle" data-toggle="collapse" data-parent="#help-details" href="#help-details-content">Detailed instructions</a></h4></div>
<div id="help-details-content" class="panel-collapse collapse out">
<div class="panel-body">
<p>
<strong>Step 1</strong><br/>
If you do not have a reference genome index (e.g. hg19), download it from the <a href="http://bowtie-bio.sourceforge.net/bowtie2/index.shtml" target="_blank">Bowtie2 website</a> (menu on right, under <i>Indexes</i>).
Then, map your reads (in <strong>reads.fastq</strong>) to the genome, and output the results to <strong>reads.sam</strong>:</p>
<div class="codesample">bowtie2 -x hg19 -U reads.fastq -S reads.sam</div>
<br/>
<p>If you have paired-end reads, use the following command instead:</p>
<div class="codesample">bowtie2 -x hg19 -1 reads_r1.fastq -2 reads_r2.fastq -S reads.sam</div>
<br/>
<p>
<strong>Step 2</strong><br/>
Convert <strong>reads.sam</strong> to <strong>reads.bam</strong>:</p>
<div class="codesample">samtools view -Sb reads.sam -q 20 -o reads.bam</div>
<br/><p>
<strong>Step 3</strong><br/>
Convert <strong>reads.bam</strong> to <strong>reads.bed</strong>:</p>
<div class="codesample">bamToBed -i reads.bam > reads.bed</div>
</div>
</div>
</div>
</div>
</div>
<?php else: ?>
<script>
window.location = '?q=results/<?php echo $GINKGO_USER_ID; ?>';
</script>
<?php endif; ?>
<?php // ================================================================ ?>
<?php // == Dashboard: Analysis settings ================================ ?>
<?php // ================================================================ ?>
<?php elseif($GINKGO_PAGE == 'dashboard'): ?>
<!-- Dashboard -->
<div class="row">
<div id="dashboard" class="col-lg-8">
<form id="form-dashboard">
<!-- Choose cells of interest -->
<h3 style="margin-top:-5px;"><span class="badge">STEP 1</span> Choose cells for analysis</h3>
<?php if($GINKGO_USER_ID != 'sample' && $GINKGO_USER_ID != 'sample2'): ?>
<button id="dashboard-toggle-cells" class="btn btn-info" style="margin:20px;">Select all cells</button>
<br/>
<div id="params-cells" style="max-height:200px; overflow:auto">
<?php $previouslySelected = file(DIR_UPLOADS . '/' . $GINKGO_USER_ID . '/list', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); ?>
<?php $selected = array(); ?>
<?php foreach($MY_CELLS as $currCell): ?>
<?php
// Was the current cell previously selected in an analysis?
$selected[$currCell] = "";
if(in_array($currCell, $previouslySelected))
$selected[$currCell] = " checked";
?>
<label><div class="input-group" style="margin:20px;"><span class="input-group-addon"><input type="checkbox" name="dashboard_cells[]" value="<?php echo $currCell; ?>"<?php echo $selected[$currCell];?>></span><span class="form-control"><?php echo $currCell; ?></span></div></label>
<?php endforeach; ?>
</div>
<!-- Which genome? -->
<br/><br/><h3 style="margin-top:-5px;"><span class="badge">STEP 2</span> Set analysis options <small></small></h3>
<div id="params-genome" style="margin:20px;">
<table class="table table-striped">
<tr>
<td width="20%">Job name:</td>
<td>
<input id="param-job-name" class="form-control" type="text" placeholder="Single-cells from tissue X" value="<?php echo str_replace("'", "", file_get_contents($userDir . '/description.txt')); ?>">
</td>
</tr>
<tr>
<td width="20%">Genome:</td>
<td>
<select id="param-genome" class="input-mini" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<optgroup label="Latest genomes">
<!--<option value="hg20">Human (hg20)</option>-->
<?php $selected = array(); $selected[$config['chosen_genome']] = ' selected'; ?>
<option value="hg19"<?php echo $selected['hg19']; ?>>Human (hg19)</option>
<option value="panTro4"<?php echo $selected['panTro4']; ?>>Chimpanzee (panTro4)</option>
<option value="mm10"<?php echo $selected['mm10']; ?>>Mus musculus (mm10)</option>
<option value="rheMac8"<?php echo $selected['rheMac8']; ?>>Rhesus macaque (rheMac8)</option>
<option value="rn5"<?php echo $selected['rn5']; ?>>R. norvegicus (rn5)</option>
<option value="dm3"<?php echo $selected['dm3']; ?>>D. Melanogaster (dm3)</option>
</optgroup>
<optgroup label="Older genomes">
<option value="hg18"<?php echo $selected['hg18']; ?>>Human (hg18)</option>
<option value="panTro3"<?php echo $selected['panTro3']; ?>>Chimpanzee (panTro3)</option>
<option value="rheMac7"<?php echo $selected['rheMac7']; ?>>Rhesus macaque (rheMac7)</option>
</optgroup>
</select>
</td>
</tr>
</table>
</div>
<!-- Get informed by email when done? -->
<br/><br/><h3 style="margin-top:-5px;"><span class="badge">STEP 3</span> E-mail notification <small></small></h3>
<div id="params-email" style="margin:20px;">
<p>If you want to be notified once the analysis is done, enter your e-mail here:<br/></p>
<div class="input-group">
<?php if($config['email'] != '') $email = $config['email']; ?>
<span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></span>
<input id="email" class="form-control" type="text" placeholder="[email protected]" value="<?php echo $email; ?>">
</div>
</div>
<br/><br/>
<!-- Set parameters -->
<h3 style="margin-top:-5px;"><span class="badge">OPTIONAL</span> <a href="#parameters" onClick="javascript:$('#params-table').toggle();">Advanced parameters</a></h3>
<table class="table" id="params-table">
<tbody>
<tr class="active"><td colspan="2"><strong>Sample Parameters</strong></td></tr>
<tr>
<td>CNV Profile Color Scheme</td>
<?php $selected = array(); $selected[$config['color']] = ' selected'; ?>
<td>
Use <select id="param-color-scheme" class="input-mini" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option value="3"<?php echo $selected['3']; ?>>dark blue / red</option>
<option value="1"<?php echo $selected['1']; ?>>light blue / orange</option>
<option value="2"<?php echo $selected['2']; ?>>magenta / gold</option>
</select> color scheme.
</td>
</tr>
<tr>
<td>General Binning Options</td>
<?php
if(empty($config))
$config['binMeth'] = 'variable_500000_101_bowtie';
$binMeth = split('_', $config['binMeth']);
?>
<td>
<?php $selected = array(); $selected[$binMeth[0]] = ' selected'; ?>
Use a <select id="param-bins-type" class="input-mini" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option value="variable_"<?php echo $selected['variable']; ?>>variable</option>
<option value="fixed_"<?php echo $selected['fixed']; ?>>fixed</option>
</select> bin size of
<?php $selected = array(); $selected[$binMeth[1]] = ' selected'; ?>
<select id="param-bins-value" class="input-mini" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option class="param-bins-value-hg19" value="10000000_"<?php echo $selected['10000000']; ?>>10Mb</option>
<option class="param-bins-value-hg19" value="5000000_"<?php echo $selected['5000000']; ?>>5Mb</option>
<option class="param-bins-value-hg19" value="2500000_"<?php echo $selected['2500000']; ?>>2.5Mb</option>
<option class="param-bins-value-hg19" value="1000000_"<?php echo $selected['1000000']; ?>>1Mb</option>
<!-- <option class="param-bins-value-hg19" value="800000_"<?php echo $selected['800000']; ?>>800kb</option> -->
<option value="500000_"<?php echo $selected['500000']; ?>>500kb</option>
<option value="250000_"<?php echo $selected['250000']; ?>>250kb</option>
<option value="175000_"<?php echo $selected['175000']; ?>>175kb</option>
<option value="100000_"<?php echo $selected['100000']; ?>>100kb</option>
<option value="50000_"<?php echo $selected['50000']; ?>>50kb</option>
<option value="25000_"<?php echo $selected['25000']; ?>>25kb</option>
<option value="10000_"<?php echo $selected['10000']; ?>>10kb</option>
</select> size.
</td>
</tr>
<tr id="param-binning-sim-options">
<td>Binning Simulation Options</td>
<td>
<?php $selected = array(); $selected[$binMeth[2]] = ' selected'; ?>
Bins based on simulations of <select id="param-bins-sim-rlen" class="input-mini" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option value="150_"<?php echo $selected['150']; ?>>150</option>
<option value="101_"<?php echo $selected['101']; ?>>101</option>
<option value="76_"<?php echo $selected['76']; ?>>76</option>
<option value="48_"<?php echo $selected['48']; ?>>48</option>
</select> bp reads, mapped with
<?php $selected = array(); $selected[$binMeth[3]] = ' selected'; ?>
<select id="param-bins-sim-mapper" class="input-mini" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option value="bowtie"<?php echo $selected['bowtie']; ?>>bowtie</option>
<option value="bwa"<?php echo $selected['bwa']; ?>>bwa</option>
</select>.
</td>
</tr>
<tr>
<td>Segmentation</td>
<?php $selected = array(); $selected[$config['segMeth']] = ' selected'; ?>
<td>Use <select id="param-segmentation" class="input-medium" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option value="0"<?php echo $selected[0]; ?>>Independent (normalized read counts)</option>
<option value="1"<?php echo $selected[1]; ?>>Global (sample with lowest IOD)</option>
<option value="2"<?php echo $selected[2]; ?>>Custom (using uploaded reference sample)</option>
</select> method to segment.</td>
</tr>
<tr style="display:none" id="param-segmentation-custom">
<td>Custom segmentation<br/><i><small>Upload the .bed file of a cell to normalize your data by</small></i></td>
<td style="height:45px;">
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input span3">
<i class="glyphicon glyphicon-upload"></i>
<span class="fileupload-preview"></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new btn btn-success">Select .bed file</span>
<span class="fileupload-exists btn btn-success">Change</span>
<input type="file" name="params-segmentation-file" />
</span>
<a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</td>
</tr>
<tr id="param-segmentation-maskbadbins"> <!-- style="display:none" -->
<td>Mask bad bins <i><small>(experimental)</small></i><br/><i><small>Removes bins with consistent read pileups from the analysis (e.g. at chromosome boundaries)</small></i></td>
<td>
<?php /* Uncomment this later */ $checked = " "; if($config['rmbadbins'] == '0') $checked=""; ?>
<input type="checkbox" id="dashboard-rmbadbins"<?php echo $checked;?>>
</td>
</tr>
<tr id="param-segmentation-pseudoautosomal"> <!-- style="display:none" -->
<td>Mask Y-chr pseudoautosomal regions <i><small>(experimental)</small></i><br/><i><small>Description</small></i></td>
<td>
<?php /* Uncomment this later */ $checked = " "; if($config['rmpseudoautosomal'] == '0') $checked=""; ?>
<input type="checkbox" id="dashboard-rmpseudoautosomal"<?php echo $checked;?>>
</td>
</tr>
<tr class="active"><td colspan="2"><strong>Clustering Parameters</strong></td></tr>
<tr>
<td>Clustering</td>
<td>
<?php $selected = array(); $selected[$config['clustMeth']] = ' selected'; ?>
Use <select id="param-clustering" class="input-small" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option value="ward"<?php echo $selected['ward']; ?>>ward linkage</option>
<option value="single"<?php echo $selected['single']; ?>>single linkage</option>
<option value="complete"<?php echo $selected['complete']; ?>>complete linkage</option>
<option value="average"<?php echo $selected['average']; ?>>average linkage</option>
<option value="NJ"<?php echo $selected['NJ']; ?>>neighbor-joining</option>
</select>.
</td>
</tr>
<tr>
<td>Distance metric</td>
<td>
<?php $selected = array(); $selected[$config['distMeth']] = ' selected'; ?>
Use <select id="param-distance" class="input-small" style="margin-top:8px; font-size:11px; padding-top:3px; padding-bottom:0; height:25px; ">
<option value="euclidian"<?php echo $selected['euclidian']; ?>>Euclidean</option>
<option value="maximum"<?php echo $selected['maximum']; ?>>maximum</option>
<option value="manhattan"<?php echo $selected['manhattan']; ?>>Manhattan</option>
<option value="canberra"<?php echo $selected['canberra']; ?>>Canberra</option>
<option value="binary"<?php echo $selected['binary']; ?>>binary</option>
<option value="minkowski"<?php echo $selected['minkowski']; ?>>Minkowski</option>
</select> distance.
</td>
</tr>
<tr>
<td>Include sex chromosomes?<br/><i><small>Uncheck this box for mixed-gender samples</small></i></td>
<td>
<?php $checked = " checked"; if($config['sex'] == '0') $checked=""; ?>
<input type="checkbox" id="dashboard-include-sex"<?php echo $checked;?>>
</td>
</tr>
<tr class="active"><td colspan="2"><strong>FACS File</strong></td></tr>
<tr>
<td>FACS file:<br/><i><small>Upload a file with 2 columns: first column is cell name, second column is estimated ploidy by FACS (by DAPI stain)</small></i></td>
<td>
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input span3">
<i class="glyphicon glyphicon-upload"></i>
<span class="fileupload-preview"></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new btn btn-success">Select .txt file</span>
<span class="fileupload-exists btn btn-success">Change</span>
<input type="file" name="params-facs-file" />
</span>
<a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<?php else: ?>
<script>
window.location = '?q=results/<?php echo $GINKGO_USER_ID; ?>';
</script>
<?php endif; ?>
<br/>
<a name="parameters"></a>
<!-- Buttons: back or next -->
<?php
$btnCaption = 'Start Analysis';
if(file_exists($configFile))
$btnCaption = 'View Results';
?>
<hr><br/>
<div style="float:left"><a class="btn btn-lg btn-primary" href="?q=/<?php echo $GINKGO_USER_ID; ?>"><span class="glyphicon glyphicon-chevron-left"></span> Manage Files </a></div>
<div style="float:right"><a id="analyze" class="btn btn-lg btn-primary" href="javascript:void(0);"><?php echo $btnCaption; ?> <span class="glyphicon glyphicon-chevron-right"></span></a></div><br/><br/><br/>
</form>
</div>
<div class="col-lg-4">
<?php echo $PANEL_PREVIOUS; ?>
<?php echo $PANEL_LATER; ?>
</div>
</div>
<?php // ================================================================ ?>
<?php // == Dashboard: Results/Main ===================================== ?>
<?php // ================================================================ ?>
<?php elseif($GINKGO_PAGE == 'results' && $CURR_CELL == ""): ?>
<!-- Results -->
<div class="row">
<div id="results" class="col-lg-8">
<h3 style="margin-top:-5px;"><span class="badge">STEP 3</span> View results</h3>
<div id="results-tree" class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-tree-deciduous"></span> Tree</h3></div>
<div class="panel-body" style="border:0px solid green; ">
<div id="svgCanvas" class="row-fluid" style="border:0px solid red; ">
Loading tree... <img src="loading.gif" />
</div>
</div>
</div>
<br/>
<!-- Panel: Summary -->
<div id="results-summary" class="panel panel-default">
<div class="panel-heading"><span class="glyphicon glyphicon-certificate"></span> Summary</div>
<div style="height:350px; overflow:auto;">
<table class="table" id="results-QA-table" style="display:none;"></table>