Skip to content

Commit 377c428

Browse files
committed
Code corresponding to version 3.0 with contributions by @Zigur @eamonnmag @agbeltran - closes #23
1 parent b545748 commit 377c428

File tree

8 files changed

+836
-419
lines changed

8 files changed

+836
-419
lines changed

About.gs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@
1818
//
1919
// The Original Code is OntoMaton.
2020
// The Original Developer is the Initial Developer. The Initial Developer of the
21-
// Original Code is the ISA Team (Eamonn Maguire, [email protected];
22-
// Philippe Rocca-Serra, [email protected]; Susanna-Assunta Sansone, [email protected]; Alejandra Gonzalez-Beltran, [email protected]
21+
// Original Code is the ISA Team (Eamonn Maguire, [email protected]; Alejandra Gonzalez-Beltran, [email protected]; Massimiliano Izzo <[email protected]>;
22+
// Philippe Rocca-Serra, [email protected]; Susanna-Assunta Sansone, [email protected];
2323
// http://www.isa-tools.org). All portions of the code written by the ISA Team are
24-
// Copyright (c) 2007-2012 ISA Team. All Rights Reserved.
24+
// Copyright (c) 2007-2016 ISA Team. All Rights Reserved.
2525
//
2626
// EXHIBIT B. Attribution Information
27-
// Attribution Copyright Notice: Copyright (c) 2007-2015 ISA Team
27+
// Attribution Copyright Notice: Copyright (c) 2007-2016 ISA Team
2828
// Attribution Phrase: Developed by the ISA Team
2929
// Attribution URL: http://www.isa-tools.org
3030
// Graphic Image provided in the Covered Code as file: http://isatab.sf.net/assets/img/tools/ontomaton-part-of-isatools.png
3131
// Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
3232

3333

34+
3435
function showAbout() {
3536
var mydoc = SpreadsheetApp.getActiveSpreadsheet();
3637

AnnotatorSidebar.html

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
<!--
2+
// OntoMaton is a component of the ISA software suite (http://www.isa-tools.org)
3+
//
4+
// License:
5+
// OntoMaton is licensed under the Common Public Attribution License version 1.0 (CPAL)
6+
//
7+
// EXHIBIT A. CPAL version 1.0
8+
// “The contents of this file are subject to the CPAL version 1.0 (the “License”);
9+
// you may not use this file except in compliance with the License. You may obtain a
10+
// copy of the License at http://isatab.sf.net/licenses/OntoMaton-license.html.
11+
// The License is based on the Mozilla Public License version 1.1 but Sections
12+
// 14 and 15 have been added to cover use of software over a computer network and
13+
// provide for limited attribution for the Original Developer. In addition, Exhibit
14+
// A has been modified to be consistent with Exhibit B.
15+
//
16+
// Software distributed under the License is distributed on an “AS IS” basis,
17+
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
18+
// the specific language governing rights and limitations under the License.
19+
//
20+
// The Original Code is OntoMaton.
21+
// The Original Developer is the Initial Developer. The Initial Developer of the
22+
// Original Code is the ISA Team (Eamonn Maguire, [email protected]; Alejandra Gonzalez-Beltran, [email protected]; Massimiliano Izzo <[email protected]>;
23+
// Philippe Rocca-Serra, [email protected]; Susanna-Assunta Sansone, [email protected];
24+
// http://www.isa-tools.org). All portions of the code written by the ISA Team are
25+
// Copyright (c) 2007-2016 ISA Team. All Rights Reserved.
26+
//
27+
// EXHIBIT B. Attribution Information
28+
// Attribution Copyright Notice: Copyright (c) 2007-2016 ISA Team
29+
// Attribution Phrase: Developed by the ISA Team
30+
// Attribution URL: http://www.isa-tools.org
31+
// Graphic Image provided in the Covered Code as file: http://isatab.sf.net/assets/img/tools/ontomaton-part-of-isatools.png
32+
// Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
33+
-->
34+
135
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">
236
<!-- The CSS package above applies Google styling to buttons and other elements. -->
337
<style>
@@ -14,6 +48,10 @@
1448
top: 0;
1549
}
1650

51+
.sidebar {
52+
width: 94%;
53+
}
54+
1755
.hidden {
1856
display:none;
1957
}
@@ -34,7 +72,6 @@
3472

3573
.ontomaton-header{
3674
padding-top: 5px;
37-
background: #f6f7f6;
3875
height: 75px;
3976
}
4077

@@ -92,7 +129,7 @@
92129

93130
.search-results ul {
94131
list-style:none;
95-
margin-left: -30px;
132+
margin-left: 0px;
96133
text-align: left;
97134
}
98135

@@ -108,7 +145,7 @@
108145
}
109146

110147
.search-results ul li{
111-
width:95%;
148+
width:85%;
112149
padding: 4px;
113150
font-weight: bolder;
114151
padding-top: 3px;
@@ -183,7 +220,7 @@
183220
$(function() {
184221
$('#run-annotator').click(runAnnotator);
185222
});
186-
223+
187224
/**
188225
* Taken from http://www.mustbebuilt.co.uk/2012/04/20/replaceall-function-for-javascript-and-actionscript/
189226
*/
@@ -195,15 +232,15 @@
195232
var myPattern=new RegExp(removeStr,cs);
196233
return oldStr.replace(myPattern,replaceStr);
197234
}
198-
235+
199236
/**
200237
* Inserts the term in to the spreadsheet.
201238
*/
202239
function insertTerm(term_id) {
203240
google.script.run
204241
.withSuccessHandler(
205242
function(result, element) {
206-
243+
207244
}).withFailureHandler(
208245
function(msg, element) {
209246
showError(msg, $('#button-bar'));
@@ -212,12 +249,12 @@
212249
.withUserObject(this)
213250
.replaceTermWithSelectedValue(term_id)
214251
}
215-
252+
216253
function toggle(id) {
217254
$("#"+id).toggleClass("hidden");
218255

219256
var isHidden = $("#" + id).hasClass( "hidden" );
220-
console.log("Is hidden? " + isHidden);
257+
console.log("Is hidden? " + isHidden);
221258
$("#expand-icon-" + id).removeClass(isHidden ? "entypo-minus" : "entypo-plus");
222259
$("#expand-icon-" + id).addClass(isHidden ? "entypo-plus" : "entypo-minus");
223260
}
@@ -228,7 +265,7 @@
228265
*/
229266
function runAnnotator() {
230267
this.disabled = true;
231-
$('#search-results').html('<div id="spinner"><img src="http://l4.yimg.com/dh/ap/default/130116/spinner_white_working.gif"/></div>');
268+
$('#search-results').html('<div id="spinner"><img src="//s-media-cache-ak0.pinimg.com/originals/0a/59/71/0a59718a5ee79a0558930ca9907c0659.gif" width="60%"/></div>');
232269
$('#error').remove();
233270

234271
google.script.run

OntoMaton.gs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@
1818
//
1919
// The Original Code is OntoMaton.
2020
// The Original Developer is the Initial Developer. The Initial Developer of the
21-
// Original Code is the ISA Team (Eamonn Maguire, [email protected];
22-
// Philippe Rocca-Serra, [email protected]; Susanna-Assunta Sansone, [email protected]; Alejandra Gonzalez-Beltran, [email protected]
21+
// Original Code is the ISA Team (Eamonn Maguire, [email protected]; Alejandra Gonzalez-Beltran, [email protected]; Massimiliano Izzo <[email protected]>;
22+
// Philippe Rocca-Serra, [email protected]; Susanna-Assunta Sansone, [email protected];
2323
// http://www.isa-tools.org). All portions of the code written by the ISA Team are
24-
// Copyright (c) 2007-2012 ISA Team. All Rights Reserved.
24+
// Copyright (c) 2007-2016 ISA Team. All Rights Reserved.
2525
//
2626
// EXHIBIT B. Attribution Information
27-
// Attribution Copyright Notice: Copyright (c) 2007-2015 ISA Team
27+
// Attribution Copyright Notice: Copyright (c) 2007-2016 ISA Team
2828
// Attribution Phrase: Developed by the ISA Team
2929
// Attribution URL: http://www.isa-tools.org
3030
// Graphic Image provided in the Covered Code as file: http://isatab.sf.net/assets/img/tools/ontomaton-part-of-isatools.png
3131
// Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
3232

33-
3433
/**
3534
* Creates a menu entry in the Google Docs UI when the document is opened.
3635
*/
3736
function onOpen() {
3837

3938
SpreadsheetApp.getUi().createAddonMenu()
40-
.addItem('Perform Ontology Search', 'showOntologySearchSidebar')
41-
.addItem('Run Annotator', 'showAnnotatorSidebar')
39+
.addItem('Search Ontology Terms...', 'showOntologySearchSidebar')
40+
.addItem('Run Annotator...', 'showAnnotatorSidebar')
41+
.addSeparator()
42+
.addItem('Settings...', 'showSettings')
4243
.addItem('About', 'showAbout')
43-
.addItem('Settings', 'showSettings')
4444
.addToUi();
4545
}
4646

@@ -74,10 +74,16 @@ function runAnnotator() {
7474
}
7575

7676
function performSearch(service, term) {
77-
if (service == "bioportal") {
78-
return searchBioPortal(term);
79-
} else {
80-
return searchLOV(term);
81-
}
77+
Logger.log("OntoMaton.performSearch - service is:" + service);
78+
switch (service) {
79+
case "bioportal":
80+
return searchBioPortal(term);
81+
case "lov":
82+
return searchLOV(term);
83+
case "ols":
84+
return searchOLS(term);
85+
default:
86+
return searchLOV(term);
87+
}
8288
}
8389

OntologyAnnotator.gs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@
1818
//
1919
// The Original Code is OntoMaton.
2020
// The Original Developer is the Initial Developer. The Initial Developer of the
21-
// Original Code is the ISA Team (Eamonn Maguire, [email protected];
22-
// Philippe Rocca-Serra, [email protected]; Susanna-Assunta Sansone, [email protected]; Alejandra Gonzalez-Beltran, [email protected]
21+
// Original Code is the ISA Team (Eamonn Maguire, [email protected]; Alejandra Gonzalez-Beltran, [email protected]; Massimiliano Izzo <[email protected]>;
22+
// Philippe Rocca-Serra, [email protected]; Susanna-Assunta Sansone, [email protected];
2323
// http://www.isa-tools.org). All portions of the code written by the ISA Team are
24-
// Copyright (c) 2007-2012 ISA Team. All Rights Reserved.
24+
// Copyright (c) 2007-2016 ISA Team. All Rights Reserved.
2525
//
2626
// EXHIBIT B. Attribution Information
27-
// Attribution Copyright Notice: Copyright (c) 2007-2015 ISA Team
27+
// Attribution Copyright Notice: Copyright (c) 2007-2016 ISA Team
2828
// Attribution Phrase: Developed by the ISA Team
2929
// Attribution URL: http://www.isa-tools.org
3030
// Graphic Image provided in the Covered Code as file: http://isatab.sf.net/assets/img/tools/ontomaton-part-of-isatools.png
3131
// Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
3232

3333

34+
3435
function performAnnotation() {
3536
try {
3637
var sheet = SpreadsheetApp.getActiveSheet();
@@ -45,7 +46,7 @@ function performAnnotation() {
4546
}
4647
}
4748
}
48-
49+
4950
var valuesToTag = "";
5051
for (var valueToTag in valuesToSend) {
5152

@@ -103,9 +104,9 @@ function performAnnotation() {
103104

104105
var ontology_record = {"label": concept, "id": annotationResult["@id"], "ontology-label": ontologyAbbreviation, "ontology-name": ontologyName, "accession": annotationResult["@id"], "ontology": ontologyId, "details": "", "freeText":originalTerm};
105106
var ontology_record_string = JSON.stringify(ontology_record);
106-
107+
107108
storeInCache(annotationResult["@id"], ontology_record_string);
108-
109+
109110
valueToAnnotatorResult.results[ontologyAbbreviation].terms.push(ontology_record);
110111
}
111112
}
@@ -158,12 +159,12 @@ function replaceTermWithSelectedValue(term_id) {
158159
sheet.getRange(row, sourceAndAccessionPositions.sourceRef).setValue(ontologyObject.ontologyId);
159160
sheet.getRange(row, sourceAndAccessionPositions.accession).setValue(ontologyObject.accession);
160161
} else {
161-
162+
162163
var isDefaultInsertionMechanism = isCurrentSettingOnDefault();
163164
var selectedColumn = selectedRange.getColumn();
164165
var nextColumn = selectedColumn +1;
165166
if(!isDefaultInsertionMechanism) {
166-
sheet.getRange(row, selectedColumn).setValue(ontologyObject.term);
167+
sheet.getRange(row, selectedColumn).setValue(ontologyObject.term);
167168
sheet.getRange(row, nextColumn).setValue(ontologyObject.accession);
168169
} else {
169170
sheet.getRange(row, selectedColumn).setFormula('=HYPERLINK("'+ ontologyObject.accession +'","' + ontologyObject.term + '")')
@@ -172,4 +173,4 @@ function replaceTermWithSelectedValue(term_id) {
172173
}
173174
}
174175
}
175-
}
176+
}

0 commit comments

Comments
 (0)