-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiment.php
379 lines (347 loc) · 18.8 KB
/
experiment.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
<?php
require "../phplib/genlibraries.php";
redirectOutside();
$exp = array();
foreach (array_values(iterator_to_array($GLOBALS['studiesCol']->find(array('_id'=>strtoupper($_GET['id'])),array('experimenttype'=>1, 'releasedate'=>1, 'accession'=>1, 'organism'=>1, 'name'=>1, 'assays'=>1, 'samples'=>1, 'arraydesign'=>1, 'protocol'=>1, 'description'=>1, 'lastupdatedate'=>1, 'provider'=>1, 'bibliography'=>1, 'files'=>1, 'secondaryaccession'=>1, 'mug_repository'=>1))->sort(array('releasedate'=>1)))) as $v)
$exp[$v['_id']] = array($v['experimenttype'], $v['releasedate'], $v['accession'], $v['organism'], $v['name'], $v['assays'], $v['samples'], $v['arraydesign'], $v['protocol'], $v['description'], $v['lastupdatedate'], $v['provider'], $v['bibliography'], $v['files'], $v['secondaryaccession'], $v['mug_repository']);
$experiment = array();
$experiment = $exp[$_GET['id']];
?>
<?php require "../htmlib/header.inc.php"; ?>
<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white page-container-bg-solid page-sidebar-fixed">
<div class="page-wrapper">
<?php require "../htmlib/top.inc.php"; ?>
<?php require "../htmlib/menu.inc.php"; ?>
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<!-- BEGIN PAGE BAR -->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<a href="home/">Home</a>
<i class="fa fa-circle"></i>
</li>
<li>
<span>Get Data</span>
<i class="fa fa-circle"></i>
</li>
<li>
<a href="repository/repositoryList.php">From Repository List</a>
<i class="fa fa-circle"></i>
</li>
<li>
<span><?php echo $experiment[2]; ?></span>
</li>
</ul>
</div>
<!-- END PAGE BAR -->
<!-- BEGIN PAGE TITLE-->
<h1 class="page-title">Experiment <?php echo $experiment[2]; ?></h1>
<!-- END PAGE TITLE-->
<!-- END PAGE HEADER-->
<div class="row">
<div class="col-md-12">
<?php
$error_data = false;
if ($_SESSION['errorData']){
$error_data = true;
?>
<?php if ($_SESSION['errorData']['Info']) { ?>
<div class="alert alert-info">
<?php } else { ?>
<div class="alert alert-danger">
<?php } ?>
<?php
foreach($_SESSION['errorData'] as $subTitle=>$txts){
print "<strong>$subTitle</strong><br/>";
foreach($txts as $txt){
print "<div>$txt</div>";
}
}
unset($_SESSION['errorData']);
?>
</div>
<?php } ?>
</div>
</div>
<div class="mt-element-step">
<div class="row step-line">
<div class="mt-step-desc">
Please select any data of this experiment and it will be automatically uploaded to your workspace.
</div>
<?php require "../htmlib/stepsup.inc.php"; ?>
</div>
</div>
<input type="hidden" id="base-url" value="<?php echo $GLOBALS['BASEURL']; ?>"/>
<div class="row">
<div class="col-md-12">
<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet light portlet-fit bordered">
<div class="portlet-title">
<div class="caption">
<i class="icon-share font-red-sunglo hide"></i>
<span class="caption-subject font-dark bold uppercase"><?php echo $experiment[2].' - '.$experiment[4]; ?></span>
</div>
</div>
<div class="portlet-body">
<table class="table table-striped" id="table-experiment">
<tbody>
<tr>
<td class="col-1-te">Status</td>
<?php
$d1 = date_create($experiment[1]);
$d2 = date_create($experiment[10]);
?>
<td style="font-style:italic;">Released on <?php echo date_format($d1,"j F Y"); ?>, last updated on <?php echo date_format($d2,"j F Y"); ?></td>
</tr>
<tr>
<?php if(sizeof($experiment[3]) > 1){ ?>
<td class="col-1-te">Organisms</td>
<td>
<?php
foreach($experiment[3] as $k => $v):
echo $v.', ';
endforeach;
?>
</td>
<?php } else { ?>
<td class="col-1-te">Organism</td>
<td><?php echo $experiment[3]; ?> </td>
<?php } ?>
</tr>
<tr>
<td class="col-1-te">Samples <!--(<?php echo $experiment[6]; ?>)--></td>
<td><a href="https://www.ebi.ac.uk/arrayexpress/experiments/<?php echo $experiment[2]; ?>/samples/" target="_blank">Click for detailed sample information and links to data</a></td>
</tr>
<?php if(isset($experiment[7])){ ?>
<tr>
<?php if(is_multi_array($experiment[7])){ ?>
<td class="col-1-te">
Arrays (<?php echo count($experiment[7]); ?>)</td>
<td>
<?php foreach($experiment[7] as $k => $v): ?>
<a href="https://www.ebi.ac.uk/arrayexpress/arrays/<?php echo $v['accession']; ?>/?ref=<?php echo $experiment[2]; ?>" target="_blank"><?php echo $v['name']; ?></a><br>
<?php endforeach; ?>
</td>
<?php } else { ?>
<td class="col-1-te">
Array (1)</td>
<td><a href="https://www.ebi.ac.uk/arrayexpress/arrays/<?php echo $experiment[7]['accession']; ?>/?ref=<?php echo $experiment[2]; ?>" target="_blank"><?php echo $experiment[2].' - '.$experiment[7]['name']; ?></a></td>
<?php } ?>
</tr>
<?php } ?>
<tr>
<td class="col-1-te">Protocols (<?php echo sizeof($experiment[8]); ?>)</td>
<td><a href="https://www.ebi.ac.uk/arrayexpress/experiments/<?php echo $experiment[2]; ?>/protocols/" target="_blank">Click for detailed protocol information</a></td>
</tr>
<tr>
<td class="col-1-te">Description</td>
<td><?php echo $experiment[9]; ?></td>
</tr>
<tr>
<?php if(sizeof($experiment[0]) > 1 ){ ?>
<td class="col-1-te">Experiment types</td>
<td>
<?php foreach($experiment[0] as $k => $v):
echo $v.', ';
endforeach; ?>
</td>
<?php } else { ?>
<td class="col-1-te">Experiment type</td>
<td><?php echo $experiment[0]; ?></td>
<?php } ?>
</tr>
<?php if(isset($experiment[11])){ ?>
<tr>
<?php if(is_multi_array($experiment[11])){ ?>
<td class="col-1-te">
Contacts</td>
<td>
<?php foreach($experiment[11] as $k => $v): ?>
<?php if(($v['role'] == 'submitter') && (isset($v['email']))) { ?>
<a href="mailto:<?php echo $v['email']; ?>"> <i class="fa fa-envelope"></i> <?php echo $v['contact']; ?></a>,
<?php }else{ ?>
<?php echo $v['contact']; ?>,
<?php } ?>
<?php endforeach; ?>
</td>
<?php } else { ?>
<td class="col-1-te">
Contact</td>
<td><a href="mailto:<?php echo $experiment[11]['email']; ?>"> <i class="fa fa-envelope"></i> <?php echo $experiment[11]['contact']; ?></a></td>
<?php } ?>
</tr>
<?php } ?>
<?php if(isset($experiment[12])){ ?>
<tr>
<td class="col-1-te">
Citation</td>
<td>
<a href="http://europepmc.org/abstract/MED/<?php echo $experiment[12][0]['accession']; ?>" target="_blank"><?php echo $experiment[12][0]['title']; ?></a> <?php echo $experiment[12][0]['authors']; ?>
</td>
</tr>
<?php } ?>
<?php if(isset($experiment[13])){ ?>
<tr>
<?php if(is_multi_array($experiment[13])){ ?>
<td class="col-1-te">
Files</td>
<td>
<?php
$files = array();
$files['idf'] = array();
$files['processed'] = array();
$files['raw'] = array();
$files['sdrf'] = array();
$files['adf'] = array();
$files['twocolumns'] = array();
$files['biosamples'] = array();
$files['mageml'] = array();
$files['additional'] = array();
foreach($experiment[13] as $k => $v):
$aux['name'] = $v['name'];
$aux['url'] = $v['url'];
if(gettype($v['kind']) != 'NULL') {
if(gettype($v['kind']) != 'array') array_push($files[$v['kind']], $aux);
else if(in_array('processed', $v['kind'])) array_push($files['processed'], $aux);
}else{
array_push($files['additional'], $aux);
}
endforeach; ?>
<table>
<tbody>
<?php if(!empty($files['idf'])){ ?>
<tr>
<td class="col-1-subt">Investigation description <?php if(sizeof($files['idf']) > 1) echo '('.sizeof($files['idf']).')'; ?></td>
<td class="col-2-subt">
<?php foreach($files['idf'] as $k => $v): ?>
<a href="<?php echo $v['url']; ?>" target="_blank"><i class="fa fa-download"></i> <?php echo $v['name']; ?></a>
<?php endforeach; ?>
</td>
</tr>
<?php } ?>
<?php if(!empty($files['sdrf'])){ ?>
<tr>
<td class="col-1-subt">Sample and data relationship <?php if(sizeof($files['sdrf']) > 1) echo '('.sizeof($files['sdrf']).')'; ?></td>
<td class="col-2-subt">
<?php foreach($files['sdrf'] as $k => $v): ?>
<!--<a href="applib/getData.php?uploadType=repository&url=<?php echo $v['url'];?>&repo=<?php echo $experiment[15];?>" target="_blank"><i class="fa fa-cloud-upload"></i></a> -->
<a href="<?php echo $v['url']; ?>" target="_blank"><i class="fa fa-download"></i> <?php echo $v['name']; ?></a>
<?php endforeach; ?>
<td>
</tr>
<?php } ?>
<?php if(!empty($files['raw'])){ ?>
<tr>
<td class="col-1-subt">Raw data <?php if(sizeof($files['raw']) > 1) echo '('.sizeof($files['raw']).')'; ?></td>
<td class="col-2-subt">
<?php foreach($files['raw'] as $k => $v): ?>
<a href="<?php echo $v['url']; ?>" target="_blank"><i class="fa fa-download"></i> <?php echo $v['name']; ?></a>
<?php endforeach; ?>
<td>
</tr>
<?php } ?>
<?php if(!empty($files['processed'])){ ?>
<tr>
<td class="col-1-subt">Processed data <?php if(sizeof($files['processed']) > 1) echo '('.sizeof($files['processed']).')'; ?></td>
<td class="col-2-subt">
<?php if(sizeof($files['processed']) <= 6) { ?>
<?php foreach($files['processed'] as $k => $v): ?>
<a href="<?php echo $v['url']; ?>" target="_blank"><i class="fa fa-download"></i> <?php echo $v['name']; ?></a>
<?php endforeach; ?>
<?php }else{ ?>
<a href="https://www.ebi.ac.uk/arrayexpress/experiments/<?php echo $experiment[2]; ?>/files/processed/" target="_blank"><i class="fa fa-folder"></i> Click to browse processed data</a>
<?php } ?>
<td>
</tr>
<?php } ?>
<?php if(!empty($files['biosamples'])){ ?>
<tr>
<td class="col-1-subt">Experiment design <?php if(sizeof($files['biosamples']) > 1) echo '('.sizeof($files['biosamples']).')'; ?></td>
<td class="col-2-subt">
<?php foreach($files['biosamples'] as $k => $v): ?>
<a href="<?php echo $v['url']; ?>" target="_blank"><i class="fa fa-download"></i> <?php echo $v['name']; ?></a>
<?php endforeach; ?>
<td>
</tr>
<?php } ?>
<?php if(!empty($files['adf'])){ ?>
<tr>
<td class="col-1-subt">Array design <?php if(sizeof($files['adf']) > 1) echo '('.sizeof($files['adf']).')'; ?></td>
<td class="col-2-subt">
<?php foreach($files['adf'] as $k => $v): ?>
<a href="<?php echo $v['url']; ?>" target="_blank"><i class="fa fa-download"></i> <?php echo $v['name']; ?></a>
<?php endforeach; ?>
<td>
</tr>
<?php } ?>
<?php if(!empty($files['additional'])){ ?>
<tr>
<td class="col-1-subt">Additional data <?php if(sizeof($files['additional']) > 1) echo '('.sizeof($files['additional']).')'; ?></td>
<td class="col-2-subt">
<?php foreach($files['additional'] as $k => $v): ?>
<a href="<?php echo $v['url']; ?>" target="_blank"><i class="fa fa-download"></i> <?php echo $v['name']; ?></a>
<?php endforeach; ?>
<td>
</tr>
<?php } ?>
</tbody>
</table>
</td>
<?php } else { ?>
<td class="col-1-te">
File</td>
<td>One File!</td>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if(isset($experiment[14])){ ?>
<tr>
<td class="col-1-te">
Links</td>
<td><a href="http://www.ncbi.nlm.nih.gov/projects/geo/query/acc.cgi?acc=<?php echo $experiment[14]; ?>" target="_blank">GEO - <?php echo $experiment[14]; ?></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<!-- END EXAMPLE TABLE PORTLET-->
<div class="form-actions">
<div id="bottom-validated-files">
<div id=""><a href="javascript:openFilesList('<?php echo $_GET['id']; ?>');" class="btn green tooltips" aria-hidden="true" data-container="body" data-html="true" data-placement="right" data-original-title="<p align='left' style='margin:0'>Click here to select the file from this experiment you want to import to workspace</p>"><i class="fa fa-cloud-upload"></i> IMPORT EXPERIMENT TO WORKSPACE </a></div>
<div id="" style="margin-top:20px"><a href="repository/JSONexperiment.php?id=<?php echo$_GET['id']; ?>" class="btn green" target="_blank"><i class="fa fa-file-code-o"></i> OPEN IN JSON FORMAT </a></div>
<div id="go-out-uploadform"><input type="button" class="btn default" value="BACK TO REPOSITORY LIST" onclick="location.href='/repository/repositoryList.php';" /></div>
</div>
</div>
</div>
</div>
</div>
<!-- END CONTENT BODY -->
</div>
<!-- END CONTENT -->
<div class="modal fade bs-modal" id="modalFilesList" tabindex="-1" role="basic" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Experiment list of files</h4>
</div>
<div class="modal-body table-responsive">
<div id="meta-container" style="max-height: calc(100vh - 255px);">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php
require "../htmlib/footer.inc.php";
require "../htmlib/js.inc.php";
?>