-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstr_viewer.php
126 lines (109 loc) · 4.5 KB
/
str_viewer.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
<?php
include_once 'php/_config.php';
$stmt = $db->prepare("SELECT locus, allele, `value`, value_str
FROM str_profile WHERE str_id = ?
");
$stmt->execute([$str_id]);
$str = $stmt->fetchAll(PDO::FETCH_GROUP);
$stmt = $db->prepare("SELECT MAX(allele)
FROM str_profile WHERE str_id = ?
");
$stmt->execute([$str_id]);
$str_count = $stmt->fetch(PDO::FETCH_COLUMN);
?>
<script>
const STR_ID = 0;
</script>
<div class="content">
<a href="<?= ROOTPATH ?>/documentation#str" class="btn btn-help float-right"><i class="far fa-lg fa-book mr-5"></i> <span class="d-none d-md-inline">Help</span></a>
<h1>STR Profile Viewer</h1>
</div>
<div class="row card-deck">
<div class="col-md-6">
<div class="card" id="meta-form">
<h2 class="card-title">Metadata</h2>
<div class="card-content">
<table class="table table-sm w-auto" id="META-input">
<tbody>
<tr>
<td>Cell line</td>
<td>
<?php if (!empty($meta['cell_id'])) { ?>
<a href='<?= ROOTPATH ?>/cellline/ACC-<?= $meta['cell_id'] ?>'><?= $meta['cellline'] ?></a>
<?php } else {
echo $meta['cellline'];
} ?>
</td>
</tr>
<tr>
<td>ACC</td>
<td>
<?php if (is_numeric($meta['cell_id'])) { ?>
<a href='https://www.dsmz.de/collection/catalogue/details/culture/ACC-<?= $meta['ACC'] ?>' target='_blank' rel='noopener noreferrer'>ACC-<?= $meta['ACC'] ?></a>
<?php } else {
echo $meta['ACC'];
} ?>
</td>
</tr>
<tr>
<td>Date</td>
<td><?= format_date($meta['date']) ?></td>
</tr>
<!-- <tr>
<td>Gender</td>
<td><?= $meta['gender'] ?></td>
</tr> -->
<!-- <tr>
<td>EBV</td>
<td><?= $meta['EBV'] ?></td>
</tr>
<tr>
<td>largeT</td>
<td><?= $meta['largeT'] ?></td>
</tr> -->
<tr>
<td>MMR</td>
<td><?= $meta['MMR'] ?></td>
</tr>
</tbody>
</table>
</div>
<?php if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) { ?>
<div>
<a href="<?= ROOTPATH ?>/str/edit/<?= $str_id ?>" class="btn btn-primary mt-20"><i class="fas fa-edit"></i> Edit</a>
</div>
<?php } ?>
</div>
</div>
<div class="col-md-6">
<div class="card" id="profile-form">
<h2 class="card-title">Profile</h2>
<div class="card-content">
<table class="table table-sm w-auto">
<thead>
<tr>
<th>Locus</th>
<?php
foreach (range(1, $str_count) as $number) {
echo "<th>Allele $number</th>";
}
?>
</tr>
</thead>
<?php foreach ($str as $locus => $allele) { ?>
<tr>
<td><?= $locus ?></td>
<!-- <td><?= $row['allele'] ?></td> -->
<?php foreach ($allele as $row) { ?>
<td><?= str_val($row['value'], $locus) ?></td>
<?php } ?>
</tr>
<?php } ?>
</table>
</div>
<div>
<a href="<?= ROOTPATH ?>/str/search?str_id=<?= $str_id ?>" class="btn btn-primary mt-20"><i class="fas fa-search"></i> STR Search</a>
</div>
</div>
</div>
</div>