-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
493 lines (446 loc) · 20.1 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
<?php
/*
Copyright © 2014 The Regents of the University of Michigan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
For more information, questions, or permission requests, please contact:
Yongqun “Oliver” He - yongqunh@med.umich.edu
Unit for Laboratory Animal Medicine, Center for Computational Medicine & Bioinformatics
University of Michigan, Ann Arbor, MI 48109, USA
He Group: http://www.hegroup.org
*/
/*
Author: Zuoshuang (Allen) Xiang, Yongqun (Oliver) He
The University Of Michigan
He Group
Date: July 2011 - December 2014
*/
include_once('inc/Classes.php');
$vali=new Validation($_REQUEST);
$settings_file_url = $vali->getInput('settings_file_url', 'Settings File URL', 0, 100);
$target_owl_url='';
$data_file_url = '';
$cls_col = '';
$anno_tpl = '';
$equi_tpl = '';
$sup_tpl = '';
$extra_terms = '';
$term_uri_start_with = '';
$auto_id = '';
$data_start_row = '';
$term_id_prefix = '';
$term_id_digits = '';
$term_id_start = '';
$section_values=array();
$str_input='';
if (isset($_FILES['settings_file']) && is_uploaded_file($_FILES['settings_file']['tmp_name'])){
$str_input = trim(file_get_contents($_FILES['settings_file']['tmp_name']));
}
elseif($settings_file_url!='') {
$str_input=file_get_contents($settings_file_url);
}
if ($str_input!='') {
$lines = preg_split('/[\r\n]+/', $str_input);
$current_tag = '';
foreach ($lines as $line) {
$line = trim($line);
if (strpos($line, '[')===0) {
foreach($section_tags as $section_tag_var => $section_tag_txt){
if (strpos($line, $section_tag_txt)===0) {
$current_tag = $section_tag_var;
$section_values[$current_tag] = '';
}
}
}
elseif (strpos($line, '#')===0) {
//ignore comments
}
else {
if (strpos($line, ' #')!==false) {
$line = trim(substr($line, 0, strpos($line, ' #')));
}
if ($current_tag!='' && $line!='') {
$section_values[$current_tag] .= $line."\n";
}
}
}
$target_owl_url = $section_values['target_owl_url'] ;
$data_file_url = $section_values['data_file_url'] ;
$cls_col = $section_values['cls_col'] ;
$anno_tpl = $section_values['anno_tpl'] ;
$equi_tpl = $section_values['equi_tpl'] ;
$sup_tpl = $section_values['sup_tpl'] ;
$extra_terms = $section_values['extra_terms'];
$term_uri_start_with = $section_values['term_uri_start_with'] ;
$auto_id = $section_values['auto_id'] ;
}
if ($data_file_url!='') {
$lines = preg_split('/[\r\n]+/', $data_file_url);
$data_file_url='';
foreach($lines as $line) {
$line=trim($line);
if (strpos($line, 'Actual data starts from row:')!==false) {
$data_start_row=trim(str_replace('Actual data starts from row:', '', $line));
}
elseif ($line!='') {
$data_file_url=$line;
}
}
}
if ($auto_id!='') {
$lines = preg_split('/[\r\n]+/', $auto_id);
foreach($lines as $line) {
$line=trim($line);
if (strpos($line, 'Prefix:')!==false) {
$term_id_prefix=trim(str_replace('Prefix:', '', $line));
}
elseif (strpos($line, 'Number of digits:')!==false) {
$term_id_digits=trim(str_replace('Number of digits:', '', $line));
}
elseif (strpos($line, 'Start from:')!==false) {
$term_id_start=trim(str_replace('Start from:', '', $line));
}
}
}
if ($settings_file_url=='' && $extra_terms=='') $extra_terms = 'AnnotationProperty:
Class:
ObjectProperty:
DataProperty:
';
$cls_col=trim(str_replace('edit existing classes with term IDs defined in column', '', $cls_col));
if ($settings_file_url=='' && $term_id_prefix=='') $term_id_prefix = 'O_';
if ($settings_file_url=='' && $term_id_digits=='') $term_id_digits = 7;
if ($settings_file_url=='' && $term_id_start=='') $term_id_start = 1;
if ($settings_file_url=='' && $term_uri_start_with=='' ) $term_uri_start_with = 'http://purl.obolibrary.org/obo/';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="Templates/default.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Ontorat</title>
<!-- InstanceEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="shortcut icon" href="/favicon.ico" />
<link href="css/styleMain.css" rel="stylesheet" type="text/css">
<!-- InstanceBeginEditable name="head" -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" language="javascript">
<!--
function alertboxAnnotation(msg){
$("#messageBoxAnnotation").removeClass().addClass("errorbox").html(msg).fadeIn(1000).fadeOut(5000);
}
function alertboxSuperclass(msg){
$("#messageBoxSuperclass").removeClass().addClass("errorbox").html(msg).fadeIn(1000).fadeOut(5000);
}
function alertboxExtraTerms(msg){
$("#messageBoxExtraTerms").removeClass().addClass("errorbox").html(msg).fadeIn(1000).fadeOut(5000);
}
-->
</script>
<script language="JavaScript" type="text/javascript">
String.prototype.trim = function () {
return this.replace(/^\s*/, "").replace(/\s*$/, "");
}
function add_anno() {
anno_term=document.getElementById("anno_term").value;
anno_col=document.getElementById("anno_col").value;
anno_tpl=document.getElementById("anno_tpl").value.trim();
if (anno_tpl.indexOf(anno_col)==-1) {
if (anno_tpl!='') {
anno_tpl = anno_tpl + ", \r\n";
}
document.getElementById("anno_tpl").value = anno_tpl + anno_term + " \"" + anno_col + "\"";
}
else {
alertboxAnnotation(anno_col + " is already used!");
}
}
function add_sup() {
sup_col=document.getElementById("sup_col").value;
sup_col_type=document.getElementById("sup_col_type").value;
sup_tpl=document.getElementById("sup_tpl").value.trim();
if (sup_tpl.indexOf(sup_col)==-1) {
if (sup_tpl!='') {
sup_tpl = sup_tpl + ",\r\n";
}
if (sup_col_type=='uri') {
document.getElementById("sup_tpl").value = sup_tpl + "<" + sup_col + ">";
}
else {
document.getElementById("sup_tpl").value = sup_tpl + "'" + sup_col + "'";
}
}
else {
alertboxSuperclass(sup_col + " is already used!");
}
}
function add_extra() {
extra_term_uri=document.getElementById("extra_term_uri").value.trim();
extra_term_type=document.getElementById("extra_term_type").value;
extra_term_label=document.getElementById("extra_term_label").value;
add_extra_eg(extra_term_type, extra_term_label , extra_term_uri);
}
function add_extra_eg(extra_term_type, extra_term_label , extra_term_uri) {
extra_terms=document.getElementById("extra_terms").value.trim();
if (extra_term_label.trim() == '') {
alertboxExtraTerms("Term label cannot be empty!");
}
else if(extra_term_uri.indexOf('http://')){
alertboxExtraTerms("Incorrect URI format!");
}
else {
if (extra_terms.indexOf("<"+extra_term_uri+">")==-1) {
if (extra_terms.indexOf(extra_term_type)==-1) {
if (extra_terms!='') {
extra_terms = extra_terms + "\r\n\r\n";
}
document.getElementById("extra_terms").value = extra_terms + extra_term_type + ": \r\n'"+extra_term_label+"': <" + extra_term_uri + ">";
}
else {
document.getElementById("extra_terms").value = extra_terms.replace(extra_term_type+":", extra_term_type + ": \r\n'"+extra_term_label+"': <" + extra_term_uri + ">");
}
}
else {
alertboxExtraTerms(extra_term_uri + " is already defined!");
}
}
}
</script>
<!-- InstanceEndEditable -->
<?php include_once('inc/googleanalytics.php') ?>
</head>
<body>
<div id="topbanner"><a href="/index.php" style="font-size:36px; color:#111144; text-decoration:none"><img src="images/logo.gif" alt="Logo" width="280" height="49" border="0"></a></div>
<div id="topnav"><a href="index.php" class="topnav">Home</a><a href="intro.php" class="topnav">Introduction</a><a href="tutorial/index.php" class="topnav">Tutorial</a><a href="designtemplates/index.php" class="topnav">Templates</a><a href="faqs.php" class="topnav">FAQs</a><a href="refs.php" class="topnav">References</a><a href="links.php" class="topnav">Links</a><a href="contactus.php" class="topnav">Contact Us</a><a href="ack.php" class="topnav">Acknowledge</a><a href="news.php" class="topnav">News</a></div>
<div id="mainbody">
<!-- InstanceBeginEditable name="Main" -->
<h3 class="header_darkred">Ontorat: Ontology Representation of Axioms using Templates and Design Patterns</h3>
<p>Ontorat is a web server that automatically generates and annotates ontology terms and axioms based on user-provided templates and specific design patterns. The development of Ontorat is inspired by the OBI project <a href="http://obi-ontology.org/page/Quick_Term_Templates">QTT</a> (Quick Term Templates) and supported by the Ontology Design Patterns (<a href="http://ontologydesignpatterns.org/">ODPs</a>) engineering. Ontorat implements the QTT procedure. Ontorat is relatively easy to use through an interactive web interface. </p>
<p><strong>Example (licensed animal vaccines): </strong><a href="index.php?settings_file_url=http://ontorat.hegroup.org/examples/eg1_settings.txt" target="_blank">Example page</a> (Note: using this <a href="examples/vo.owl">target ontology (VO)</a>, the <a href="examples/eg1_data_file.xlsx">input Excel template file</a> (or <a href="examples/eg1_data_file.txt">input text file</a>), and the <a href="examples/eg1_settings.txt">settings design pattern file</a>; after Ontorat execution, getting this <a href="examples/eg1_output.owl">output OWL file</a>). </p>
<form method="post" enctype="multipart/form-data">
<table border="0">
<tr>
<td>
<span style="font-weight:bold; font-size:16px; color:#2A1F55">Load settings from an Ontorat setting file (optional):</span></td>
</tr>
<tr>
<td style="padding-left:16px">Online URL:
<input name="settings_file_url" id="settings_file_url" value="<?php echo $settings_file_url?>" size="70"></td>
</tr>
<tr>
<td style="padding-left:16px">Or file upload:
<input name="settings_file" type="file" id="settings_file" size="60"></td>
</tr>
<tr>
<td align="center" style="padding-top:12px"><input type="submit" name="Submit1" value="Load Settings File" />
<input type="reset" name="Submit3" value="Reset" style="margin-left:40px;"></td>
</tr>
</table>
</form>
<form action="domapping1.php" method="post" enctype="multipart/form-data" target="_blank" id="formMain">
<table border="0">
<tr>
<td>
<p><span style="font-weight:bold; font-size:16px; color:#2A1F55">Manually generate Ontorat settings from web form:</span></p>
<strong style="margin-left:16px;">(1) Specify target OWL file (<span class="darkred">RDF/XML format</span>):</strong></td>
</tr>
<tr>
<td style="padding-left:32px">Online URL:
<input name="target_owl_url" id="target_owl_url" value="<?php echo $target_owl_url?>" size="70"></td>
</tr>
<tr>
<td style="padding-left:32px">Or: File upload:
<input name="target_owl" type="file" id="target_owl" size="60"></td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(2) Specify input data file (<span class="darkred">Only Excel file (.xls, .xlsx) or tab-delimited text file (.txt) is accepted</span>):</strong></td>
</tr>
<tr>
<td style="padding-left:32px">Online URL:
<input name="data_file_url" id="data_file_url" value="<?php echo $data_file_url?>" size="70"></td>
</tr>
<tr>
<td style="padding-left:32px">
Or: File upload:
<input name="data_file" type="file" id="data_file" size="60"></td>
</tr>
<tr>
<td style="padding-left:32px">
<strong>Actual data starts from row:</strong>
<select name="data_start_row" id="data_start_row">
<option value="">Please select a row number</option>
<?php
for ($i=1; $i<=5; $i++) {
?>
<option value="<?php echo $i?>" <?php if ($data_start_row==$i) {?> selected <?php }?>><?php echo $i?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(3) Purpose: New axioms will be used to:</strong></td>
</tr>
<tr>
<td style="padding-left:32px"><select name="cls_col" id="cls_col">
<option value="generate new classes" <?php if ($cls_col=='generate new classes') {?> selected <?php }?>>generate new classes</option>
<?php
for ($i=1; $i<=26; $i++) {
?>
<option value="{$column<?php echo strtoupper(convertIntToAlphabet($i))?>}" <?php if ($cls_col==strtoupper(convertIntToAlphabet($i))) {?> selected <?php }?>>edit existing classes with term IDs defined in column
<?php echo strtoupper(convertIntToAlphabet($i))?> </option>
<?php
}
?>
</select> </td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(4) Annotations (<span class="darkred">use comma to separate annotations</span>):</strong></td>
</tr>
<tr>
<td style="padding-left:32px">
<div><select name="anno_col" id="anno_col">
<?php
for ($i=1; $i<=26; $i++) {
?>
<option value="{$column<?php echo strtoupper(convertIntToAlphabet($i))?>}">column
<?php echo strtoupper(convertIntToAlphabet($i))?> </option>
<?php
}
?>
</select>
as
<select name="anno_term" id="anno_term">
<optgroup label="RDF schema annotations">
<option value="'label'">label</option>
<option value="'comment'">comment</option>
<option value="'seeAlso'">seeAlso</option>
</optgroup>
<optgroup label="IAO annotations">
<option value="'editor preferred term'">editor preferred term</option>
<option value="'example of usage'">example of usage</option>
<option value="'has curation status'">has curation status</option>
<option value="'definition'">definition</option>
<option value="'editor note'">editor note</option>
<option value="'definition editor'">definition editor</option>
<option value="'alternative term'">alternative term</option>
<option value="'definition source'">definition source</option>
</optgroup>
</select>
<input type="button" name="button_anno" id="button_anno" value="Add annotaion" onClick="add_anno();">
<br>
Note: All the listed annotation
terms will be recognized in Ontorat, so no need to add them to Section 7 again. </div>
<div class="messagebox" id="messageBoxAnnotation" style="display:none"></div> </td>
</tr>
<tr>
<td style="padding-left:32px"><textarea name="anno_tpl" cols="90" rows="5" id="anno_tpl" wrap="off"><?php echo $anno_tpl?></textarea></td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(5) Equivalent classes (<span class="darkred">use comma to separate classes</span>):</strong></td>
</tr>
<tr>
<td style="padding-left:32px"><textarea name="equi_tpl" cols="90" rows="5" id="equi_tpl"><?php echo $equi_tpl?></textarea></td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(6) Superclasses (<span class="darkred">use comma to separate classes</span>):</strong></td>
</tr>
<tr>
<td style="padding-left:32px">
<div><select name="sup_col" id="sup_col">
<?php
for ($i=1; $i<=26; $i++) {
?>
<option value="{$column<?php echo strtoupper(convertIntToAlphabet($i))?>}">column <?php echo strtoupper(convertIntToAlphabet($i))?></option>
<?php
}
?>
</select>
as
<select name="sup_col_type" id="sup_col_type">
<option value="uri">full or partial term URI</option>
<option value="label">term label</option>
</select>
<input type="button" name="button_sup" id="button_sup" value="Add parent class" onClick="add_sup();"></div>
<div class="messagebox" id="messageBoxSuperclass" style="display:none"></div> </td>
</tr>
<tr>
<td style="padding-left:32px"><textarea name="sup_tpl" cols="90" rows="6" id="sup_tpl" wrap="off"><?php echo $sup_tpl?></textarea></td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(7) Terms used to define anntoations, equivalent classes, and superclasses (<span class="darkred">one line per term</span>):</strong></td>
</tr>
<tr>
<td style="padding-left:32px">Examples: <a href="javascript:add_extra_eg('AnnotationProperty', 'label', 'http://www.w3.org/2000/01/rdf-schema#label')">rdfs:label</a>, <a href="javascript:add_extra_eg('AnnotationProperty', 'preferred term', 'http://purl.obolibrary.org/obo/IAO_0000111')">iao:preferredTerm</a>, <a href="javascript:add_extra_eg('AnnotationProperty', 'definition', 'http://purl.obolibrary.org/obo/IAO_0000115')">iao:definition</a>, <a href="javascript:add_extra_eg('AnnotationProperty', 'alternative term', 'http://purl.obolibrary.org/obo/IAO_0000118')">iao:alternative term</a>. </td>
</tr>
<tr>
<td style="padding-left:32px">
<select name="extra_term_type" id="extra_term_type">
<option value="Class">Class</option>
<option value="ObjectProperty">ObjectProperty</option>
<option value="AnnotationProperty">AnnotationProperty</option>
<option value="DataProperty">DataProperty</option>
</select>
<input name="extra_term_label" id="extra_term_label" size="30">
has
URI
<input name="extra_term_uri" id="extra_term_uri" value="http://purl.obolibrary.og/obo/" size="50">
<input type="button" name="button_sup2" id="button_sup2" value="Add" onClick="add_extra();">
<div class="messagebox" id="messageBoxExtraTerms" style="display:none"></div> </td>
</tr>
<tr>
<td style="padding-left:32px"><textarea name="extra_terms" cols="90" rows="8" id="extra_terms" wrap="off"><?php echo $extra_terms?></textarea></td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(8) Term URIs:</strong></td>
</tr>
<tr>
<td style="padding-left:32px">Start with:
<input name="term_uri_start_with" id="term_uri_start_with" value="<?php echo $term_uri_start_with?>" size="80"></td>
</tr>
<tr>
<td style="padding-left:16px; padding-top:10px"><strong>(9) Auto-generated term ID:</strong></td>
</tr>
<tr>
<td style="padding-left:32px">Prefix:
<input name="term_id_prefix" id="term_id_prefix" value="<?php echo $term_id_prefix?>" size="10">
, number of digits:
<select name="term_id_digits" id="term_id_digits">
<?php
for ($i=1; $i<=16; $i++) {
?>
<option value="<?php echo $i?>" <?php if ($i==$term_id_digits) {?> selected <?php }?>>
<?php echo $i?> </option>
<?php
}
?>
</select>
,
start from:
<input name="term_id_start" id="term_id_start" value="<?php echo $term_id_start?>" size="10"></td>
</tr>
<tr>
<td align="center" style="padding-top:12px"><input type="submit" name="Submit1" value="Get OWL (RDF/XML) Output File" onClick="javascript: document.getElementById('formMain').action='domapping.php';"/>
<input type="submit" name="Submit2" value="Generate Ontorat Settings File" style="margin-left:40px;" onClick="javascript: document.getElementById('formMain').action='getsettings.php';" /><input type="reset" name="Submit3" value="Reset" style="margin-left:40px;"></td>
</tr>
</table>
<p><strong>Please cite the reference: </strong>Xiang Z, Lin Y, He Y. Ontorat web server for automatic ontology term generation and annotations. <em>International Conference on Biomedical Ontologies</em> (ICBO 2012), University of Graz, Austria, July 2012. [<a href="Ontorat_ICBO2012.pdf">One page abstract</a>][<a href="Ontorat_poster_ICBO2012.pdf">Poster</a>][<a href="Ontorat_FlashTalk.pdf">Flash Talk</a>] </p>
<p> </p>
</form>
<!-- InstanceEndEditable -->
</div>
<div id="footer">
<div id="footer_hl"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div id="footer_left"><a href="http://www.hegroup.org" target="_blank">He Group</a><br>
University of Michigan Medical School<br>
Ann Arbor, MI 48109</div></td>
<td width="300"><div id="footer_right"><a href="http://www.umich.edu" target="_blank"><img src="images/wordmark_m_web.jpg" alt="UM Logo" width="166" height="20" border="0"></a></div></td>
</tr>
</table>
</div>
</body>
<!-- InstanceEnd --></html>