7604 |
25 Feb 19 |
nicklas |
/* $Id $ |
7604 |
25 Feb 19 |
nicklas |
2 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
Copyright (C) 2013 Nicklas Nordborg |
7604 |
25 Feb 19 |
nicklas |
4 |
|
7604 |
25 Feb 19 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
7604 |
25 Feb 19 |
nicklas |
Available at http://base.thep.lu.se/ |
7604 |
25 Feb 19 |
nicklas |
7 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is free software; you can redistribute it and/or |
7604 |
25 Feb 19 |
nicklas |
modify it under the terms of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
as published by the Free Software Foundation; either version 3 |
7604 |
25 Feb 19 |
nicklas |
of the License, or (at your option) any later version. |
7604 |
25 Feb 19 |
nicklas |
12 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is distributed in the hope that it will be useful, |
7604 |
25 Feb 19 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7604 |
25 Feb 19 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7604 |
25 Feb 19 |
nicklas |
GNU General Public License for more details. |
7604 |
25 Feb 19 |
nicklas |
17 |
|
7604 |
25 Feb 19 |
nicklas |
You should have received a copy of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
7604 |
25 Feb 19 |
nicklas |
20 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
21 |
|
7604 |
25 Feb 19 |
nicklas |
@author Nicklas |
7604 |
25 Feb 19 |
nicklas |
23 |
*/ |
7604 |
25 Feb 19 |
nicklas |
'use strict'; |
7604 |
25 Feb 19 |
nicklas |
25 |
|
7604 |
25 Feb 19 |
nicklas |
var BioAssays = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var bioassays = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7604 |
25 Feb 19 |
nicklas |
30 |
/** |
7604 |
25 Feb 19 |
nicklas |
Initialize the page. |
7604 |
25 Feb 19 |
nicklas |
32 |
*/ |
7604 |
25 Feb 19 |
nicklas |
bioassays.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
34 |
{ |
7604 |
25 Feb 19 |
nicklas |
var pageId = Doc.getPageId(); |
7604 |
25 Feb 19 |
nicklas |
if (pageId == 'edit-page') |
7604 |
25 Feb 19 |
nicklas |
37 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Save + Close buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSave', bioassays.save); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
41 |
|
7604 |
25 Feb 19 |
nicklas |
// Tab validation |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('settings.datafiles', bioassays.loadDataFilesFrame); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabValidator('settings.info', bioassays.validateRawBioAssay); |
7604 |
25 Feb 19 |
nicklas |
46 |
|
7604 |
25 Feb 19 |
nicklas |
// Platform |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('platform', 'change', bioassays.platformOnChange); |
7604 |
25 Feb 19 |
nicklas |
bioassays.platformOnChange(); |
7604 |
25 Feb 19 |
nicklas |
50 |
|
7604 |
25 Feb 19 |
nicklas |
// Protocol |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('protocol_id.select', bioassays.selectProtocol); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('protocol_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
54 |
|
7604 |
25 Feb 19 |
nicklas |
// Software |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('software_id.select', bioassays.selectSoftware); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('software_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
58 |
|
7604 |
25 Feb 19 |
nicklas |
// Parent bioassay |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('bioassay_id.select', bioassays.selectBioAssay); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('bioassay_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('bioassay_id', 'change', bioassays.bioAssayOnChange); |
7604 |
25 Feb 19 |
nicklas |
63 |
|
7604 |
25 Feb 19 |
nicklas |
// Array design |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('arraydesign_id.select', bioassays.selectArrayDesign); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('arraydesign_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('arraydesign_id', 'change', bioassays.arrayDesignOnChange); |
7604 |
25 Feb 19 |
nicklas |
68 |
|
7604 |
25 Feb 19 |
nicklas |
// Extract |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('extract_id.select', bioassays.selectExtract); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('extract_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
72 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'view-page') |
7604 |
25 Feb 19 |
nicklas |
74 |
{ |
7604 |
25 Feb 19 |
nicklas |
var itemId = Data.get('page-data', 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'RAWBIOASSAY', 'item-id': itemId}; |
7604 |
25 Feb 19 |
nicklas |
77 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
88 |
|
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.rawdata', bioassays.viewRawData); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.overview', Overview.loadOnce); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.history', History.loadOnce); |
7604 |
25 Feb 19 |
nicklas |
93 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'list-page') |
7604 |
25 Feb 19 |
nicklas |
95 |
{ |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'RAWBIOASSAY'}; |
7604 |
25 Feb 19 |
nicklas |
var tableAttributes = {'table-id': 'rawbioassays'}; |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewItem', Buttons.newItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDeleteItems', Buttons.deleteItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRestoreItems', Buttons.restoreItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnShareItems', Buttons.shareItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSetOwner', Buttons.setOwnerOfItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnInheritAnnotations', Buttons.inheritAnnotations, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnColumns', Buttons.configureColumns, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnExport', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnImport', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRunPlugin', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewItemList', bioassays.newItemListOnClick); |
7813 |
19 May 20 |
nicklas |
Buttons.addClickHandler('btnAddToItemList', bioassays.addToItemListOnClick); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewExperiment', bioassays.newExperiment); |
7604 |
25 Feb 19 |
nicklas |
111 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnOk', Buttons.returnSelected, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
114 |
} |
7604 |
25 Feb 19 |
nicklas |
115 |
} |
7604 |
25 Feb 19 |
nicklas |
116 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.newExperiment = function() |
7604 |
25 Feb 19 |
nicklas |
118 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!Table.checkIfSelected('rawbioassays')) |
7604 |
25 Feb 19 |
nicklas |
120 |
{ |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
122 |
} |
7604 |
25 Feb 19 |
nicklas |
Table.submitToPopup('rawbioassays', 'NewExperiment', 750, 500); |
7604 |
25 Feb 19 |
nicklas |
124 |
} |
7604 |
25 Feb 19 |
nicklas |
125 |
|
7604 |
25 Feb 19 |
nicklas |
// Create a new item list with the selected items as members |
7604 |
25 Feb 19 |
nicklas |
bioassays.newItemListOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
128 |
{ |
7604 |
25 Feb 19 |
nicklas |
var controller = Items.getController('ITEMLIST'); |
7604 |
25 Feb 19 |
nicklas |
Table.submitToPopup('rawbioassays', 'CreateItemList', controller.width, controller.height); |
7604 |
25 Feb 19 |
nicklas |
131 |
} |
7813 |
19 May 20 |
nicklas |
// Add selected raw bioassays to an existing item list |
7813 |
19 May 20 |
nicklas |
bioassays.addToItemListOnClick = function() |
7813 |
19 May 20 |
nicklas |
134 |
{ |
7813 |
19 May 20 |
nicklas |
Table.submitToPopup('rawbioassays', 'AddItemsToList', 450, 300); |
7813 |
19 May 20 |
nicklas |
136 |
} |
7604 |
25 Feb 19 |
nicklas |
137 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.viewRawData = function() |
7604 |
25 Feb 19 |
nicklas |
139 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = 'rawdata/index.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=List&rawbioassay_id='+Data.get('page-data', 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
location.replace(url); |
7604 |
25 Feb 19 |
nicklas |
143 |
} |
7604 |
25 Feb 19 |
nicklas |
144 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.validateRawBioAssay = function() |
7604 |
25 Feb 19 |
nicklas |
146 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.name.value) == '') |
7604 |
25 Feb 19 |
nicklas |
149 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.name, 'You must enter a name'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
152 |
} |
7604 |
25 Feb 19 |
nicklas |
return true; |
7604 |
25 Feb 19 |
nicklas |
154 |
} |
7604 |
25 Feb 19 |
nicklas |
155 |
|
7604 |
25 Feb 19 |
nicklas |
// Submit the form |
7604 |
25 Feb 19 |
nicklas |
bioassays.save = function() |
7604 |
25 Feb 19 |
nicklas |
158 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
if (TabControl.validateActiveTab('settings')) |
7604 |
25 Feb 19 |
nicklas |
161 |
{ |
7604 |
25 Feb 19 |
nicklas |
Annotations.saveModifiedAnnotationsToForm(frm); |
7604 |
25 Feb 19 |
nicklas |
DataFiles.writeFileActionsToForm(frm); |
7604 |
25 Feb 19 |
nicklas |
frm.submit(); |
7604 |
25 Feb 19 |
nicklas |
165 |
} |
7604 |
25 Feb 19 |
nicklas |
166 |
} |
7604 |
25 Feb 19 |
nicklas |
167 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.loadDataFilesFrame = function() |
7604 |
25 Feb 19 |
nicklas |
169 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var selected = frm.platform[frm.platform.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
var platform = Data.get(selected, 'platform'); |
7604 |
25 Feb 19 |
nicklas |
var variant = Data.get(selected, 'variant'); |
7604 |
25 Feb 19 |
nicklas |
DataFiles.autoLoadEditFrame(platform ? platform : 0, variant ? variant : 0, 0); |
7604 |
25 Feb 19 |
nicklas |
175 |
} |
7604 |
25 Feb 19 |
nicklas |
176 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.loadAnnotationsFrame = function() |
7604 |
25 Feb 19 |
nicklas |
178 |
{ |
7604 |
25 Feb 19 |
nicklas |
Annotations.autoLoadEditFrame(bioassays.getProtocolId(), null, bioassays.getParents()); |
7604 |
25 Feb 19 |
nicklas |
180 |
} |
7604 |
25 Feb 19 |
nicklas |
181 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.getProtocolId = function() |
7604 |
25 Feb 19 |
nicklas |
183 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var protocolId = 0; |
7604 |
25 Feb 19 |
nicklas |
if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled) |
7604 |
25 Feb 19 |
nicklas |
187 |
{ |
7604 |
25 Feb 19 |
nicklas |
protocolId = Math.abs(parseInt(frm.protocol_id.value)); |
7604 |
25 Feb 19 |
nicklas |
189 |
} |
7604 |
25 Feb 19 |
nicklas |
return protocolId; |
7604 |
25 Feb 19 |
nicklas |
191 |
} |
7604 |
25 Feb 19 |
nicklas |
192 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.getParents = function() |
7604 |
25 Feb 19 |
nicklas |
194 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var parents = []; |
7604 |
25 Feb 19 |
nicklas |
197 |
|
7604 |
25 Feb 19 |
nicklas |
var bioAssayId = Math.abs(parseInt(frm.bioassay_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (bioAssayId > 0) parents[parents.length] = 'DERIVEDBIOASSAY:'+bioAssayId; |
7604 |
25 Feb 19 |
nicklas |
var extractId = Math.abs(parseInt(frm.extract_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (extractId > 0) parents[parents.length] = 'EXTRACT:'+extractId; |
7604 |
25 Feb 19 |
nicklas |
var softwareId = Math.abs(parseInt(frm.software_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (softwareId > 0) parents[parents.length] = 'SOFTWARE:'+softwareId; |
7604 |
25 Feb 19 |
nicklas |
var protocolId = Math.abs(parseInt(frm.protocol_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (protocolId > 0) parents[parents.length] = 'PROTOCOL:'+protocolId; |
7604 |
25 Feb 19 |
nicklas |
if (frm.arraydesign_id) |
7604 |
25 Feb 19 |
nicklas |
207 |
{ |
7604 |
25 Feb 19 |
nicklas |
var arrayDesignId = Math.abs(parseInt(frm.arraydesign_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (arrayDesignId > 0) parents[parents.length] = 'ARRAYDESIGN:'+arrayDesignId; |
7604 |
25 Feb 19 |
nicklas |
210 |
} |
7604 |
25 Feb 19 |
nicklas |
return parents; |
7604 |
25 Feb 19 |
nicklas |
212 |
} |
7604 |
25 Feb 19 |
nicklas |
213 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.platformOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
215 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var selected = frm.platform[frm.platform.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
var platform = Data.get(selected, 'platform'); |
7604 |
25 Feb 19 |
nicklas |
var variant = Data.get(selected, 'variant'); |
7604 |
25 Feb 19 |
nicklas |
var fileOnly = Data.int(selected, 'file-only'); |
7604 |
25 Feb 19 |
nicklas |
var rawDataType = Data.get(selected, 'raw-data-type'); |
7604 |
25 Feb 19 |
nicklas |
222 |
|
7604 |
25 Feb 19 |
nicklas |
if (frm.rawdatatype[frm.rawdatatype.length - 1].value == '') |
7604 |
25 Feb 19 |
nicklas |
224 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.rawdatatype[frm.rawdatatype.length - 1] = null; |
7604 |
25 Feb 19 |
nicklas |
226 |
} |
7604 |
25 Feb 19 |
nicklas |
if (fileOnly) |
7604 |
25 Feb 19 |
nicklas |
228 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.rawdatatype.disabled = true; |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.rawdatatype, 'required'); |
7604 |
25 Feb 19 |
nicklas |
frm.rawdatatype[frm.rawdatatype.length] = new Option('- file only -', ''); |
7604 |
25 Feb 19 |
nicklas |
frm.rawdatatype.selectedIndex = frm.rawdatatype.length - 1; |
7604 |
25 Feb 19 |
nicklas |
233 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (rawDataType) |
7604 |
25 Feb 19 |
nicklas |
235 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.rawdatatype.disabled = true; |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.rawdatatype, 'required'); |
7604 |
25 Feb 19 |
nicklas |
Forms.selectListOption(frm.rawdatatype, rawDataType); |
7604 |
25 Feb 19 |
nicklas |
239 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
241 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.rawdatatype.disabled = Data.int('page-data', 'has-db-spots'); |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(frm.rawdatatype, 'required'); |
7604 |
25 Feb 19 |
nicklas |
244 |
} |
7604 |
25 Feb 19 |
nicklas |
245 |
} |
7604 |
25 Feb 19 |
nicklas |
246 |
|
7604 |
25 Feb 19 |
nicklas |
247 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectProtocol = function() |
7604 |
25 Feb 19 |
nicklas |
249 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+Data.get('page-data', 'feature-extraction-protocol'); |
7604 |
25 Feb 19 |
nicklas |
if (frm.protocol_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
254 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
257 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('PROTOCOL', 'protocol_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
259 |
} |
7604 |
25 Feb 19 |
nicklas |
260 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectSoftware = function() |
7604 |
25 Feb 19 |
nicklas |
262 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+Data.get('page-data', 'feature-extraction-software'); |
7604 |
25 Feb 19 |
nicklas |
if (frm.software_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
267 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.software_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
270 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('SOFTWARE', 'software_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
272 |
} |
7604 |
25 Feb 19 |
nicklas |
273 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectBioAssay = function() |
7604 |
25 Feb 19 |
nicklas |
275 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.bioassay_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
279 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.bioassay_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
282 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'bioassay_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
284 |
} |
7604 |
25 Feb 19 |
nicklas |
285 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.bioAssayOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
287 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var bioAssayId = Math.abs(frm.bioassay_id.value); |
7604 |
25 Feb 19 |
nicklas |
if (bioAssayId > 0) bioassays.updateArrayDesign(bioAssayId); |
7604 |
25 Feb 19 |
nicklas |
291 |
} |
7604 |
25 Feb 19 |
nicklas |
292 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.updateArrayDesign = function(bioAssayId) |
7604 |
25 Feb 19 |
nicklas |
294 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!bioAssayId) return; |
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
var url = '../derivedbioassays/ajax.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=GetArrayDesign&item_id=' + bioAssayId; |
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, false); |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
301 |
|
7604 |
25 Feb 19 |
nicklas |
var response = JSON.parse(request.responseText); |
7604 |
25 Feb 19 |
nicklas |
if (response.status != 'ok') |
7604 |
25 Feb 19 |
nicklas |
304 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert(response.message); |
7604 |
25 Feb 19 |
nicklas |
return null; |
7604 |
25 Feb 19 |
nicklas |
307 |
} |
7604 |
25 Feb 19 |
nicklas |
308 |
|
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
if (response.id) |
7604 |
25 Feb 19 |
nicklas |
311 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Update the 'array design' field |
7604 |
25 Feb 19 |
nicklas |
Events.sendCustomEvent('arraydesign_id', 'base-selected', |
7604 |
25 Feb 19 |
nicklas |
{ 'id': response.id, 'name': response.name, 'itemType': 'ARRAYDESIGN'} |
7604 |
25 Feb 19 |
nicklas |
315 |
); |
7604 |
25 Feb 19 |
nicklas |
316 |
} |
7604 |
25 Feb 19 |
nicklas |
317 |
} |
7604 |
25 Feb 19 |
nicklas |
318 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectArrayDesign = function() |
7604 |
25 Feb 19 |
nicklas |
320 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.arraydesign_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
324 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.arraydesign_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
327 |
} |
7604 |
25 Feb 19 |
nicklas |
328 |
|
7604 |
25 Feb 19 |
nicklas |
var platform = frm.platform[frm.platform.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
var platformId = Data.get(platform, 'platform'); |
7604 |
25 Feb 19 |
nicklas |
var variantId = Data.get(platform, 'variant'); |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:platform='+platformId; |
7604 |
25 Feb 19 |
nicklas |
if (variantId) url += '&tmpfilter:INT:variant='+variantId; |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('ARRAYDESIGN', 'arraydesign_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
335 |
} |
7604 |
25 Feb 19 |
nicklas |
336 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.arrayDesignOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
338 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (Data.int('page-data', 'has-db-spots')) |
7604 |
25 Feb 19 |
nicklas |
340 |
{ |
7604 |
25 Feb 19 |
nicklas |
var oldArrayDesign = Data.get('arraydesign_id', 'current-array-design'); |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
var selectedId = frm.arraydesign_id.value; |
7604 |
25 Feb 19 |
nicklas |
var showFiMethod = (selectedId > 0 && selectedId != oldArrayDesign); |
7604 |
25 Feb 19 |
nicklas |
if (showFiMethod) |
7604 |
25 Feb 19 |
nicklas |
346 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.show('fiMethod'); |
7604 |
25 Feb 19 |
nicklas |
348 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
350 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('fiMethod'); |
7604 |
25 Feb 19 |
nicklas |
352 |
} |
7604 |
25 Feb 19 |
nicklas |
353 |
} |
7604 |
25 Feb 19 |
nicklas |
354 |
} |
7604 |
25 Feb 19 |
nicklas |
355 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectExtract = function() |
7604 |
25 Feb 19 |
nicklas |
357 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['rawbioassay']; |
7604 |
25 Feb 19 |
nicklas |
359 |
|
7604 |
25 Feb 19 |
nicklas |
var relatedExtractIds = null; |
7604 |
25 Feb 19 |
nicklas |
var bioAssayId = Math.abs(frm.bioassay_id.value); |
7604 |
25 Feb 19 |
nicklas |
if (bioAssayId > 0) |
7604 |
25 Feb 19 |
nicklas |
363 |
{ |
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
var url = '../derivedbioassays/ajax.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=GetAllExtractIds&bioassay_ids=' + bioAssayId; |
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, false); |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
369 |
|
7604 |
25 Feb 19 |
nicklas |
var response = JSON.parse(request.responseText); |
7604 |
25 Feb 19 |
nicklas |
if (response.status != 'ok') |
7604 |
25 Feb 19 |
nicklas |
372 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert(response.message); |
7604 |
25 Feb 19 |
nicklas |
return null; |
7604 |
25 Feb 19 |
nicklas |
375 |
} |
7604 |
25 Feb 19 |
nicklas |
relatedExtractIds = response.allExtractIds; |
7604 |
25 Feb 19 |
nicklas |
377 |
} |
7604 |
25 Feb 19 |
nicklas |
378 |
|
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (relatedExtractIds) |
7604 |
25 Feb 19 |
nicklas |
381 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:id='+encodeURIComponent(relatedExtractIds.join('|')); |
7604 |
25 Feb 19 |
nicklas |
383 |
} |
7604 |
25 Feb 19 |
nicklas |
if (frm.extract_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
385 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.extract_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
388 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('EXTRACT', 'extract_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
390 |
} |
7604 |
25 Feb 19 |
nicklas |
391 |
|
7604 |
25 Feb 19 |
nicklas |
return bioassays; |
7604 |
25 Feb 19 |
nicklas |
393 |
}(); |
7604 |
25 Feb 19 |
nicklas |
394 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(BioAssays.initPage); |
7604 |
25 Feb 19 |
nicklas |
396 |
|