Changeset 6211
- Timestamp:
- Apr 14, 2021, 12:40:34 PM (2 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/batch/import-external-specimen.js
r6208 r6211 5 5 var importItems; 6 6 7 var clusterIsValid = false;7 var autoAnalyzeIsValid = false; 8 8 9 9 specimen.initPage = function() … … 16 16 Events.addEventHandler('step-2', 'wizard-validate', specimen.validateStep2); 17 17 Events.addEventHandler('clusters', 'change', specimen.clusterOnChange); 18 Events.addEventHandler('autoAnalyzeYes', 'click', specimen.autoAnalyzeOnChange); 19 Events.addEventHandler('autoAnalyzeNo', 'click', specimen.autoAnalyzeOnChange); 18 20 19 21 // Navigation … … 162 164 specimen.validateStep1 = function(event) 163 165 { 164 //if (!selectionIsValid) event.preventDefault(); 165 } 166 166 Wizard.hideGoNextConfirmation(); 167 var frm = document.forms['reggie']; 168 for (var itemNo = 0; itemNo < importItems.length; itemNo++) 169 { 170 if (frm['import.'+itemNo].checked) return; 171 } 172 Wizard.showGoNextConfirmation(false, 'Please select at least one item!'); 173 event.preventDefault(); 174 } 167 175 168 176 // --- Step 2 ----------------------------------- … … 174 182 var frm = document.forms['reggie']; 175 183 frm.debug.checked = debug || location.protocol != 'https:'; 184 185 Reggie.loadProtocols('MERGE_PROTOCOL', 'mergeProtocol', 'PIPELINE', 'RNAseq'); 186 Reggie.loadSoftware('MERGE_SOFTWARE', 'mergeSoftware', 'PIPELINE,PARAMETER_SET', 'RNAseq'); 176 187 177 188 // Load open grid clusters … … 187 198 specimen.validateStep2 = function(event) 188 199 { 189 if (! clusterIsValid) event.preventDefault();200 if (!autoAnalyzeIsValid) event.preventDefault(); 190 201 } 191 202 … … 194 205 Doc.removeClass('clusters', 'list-loading'); 195 206 var frm = document.forms['reggie']; 207 frm.clusters.length = 0; 196 208 var clusters = response.hosts; 197 frm.clusters.length = 0; 209 if (clusters.length == 0) 210 { 211 Doc.element('autoAnalyzeNo').checked = true; 212 autoAnalyzeIsValid = true; 213 Wizard.setInputStatus('autoAnalyze', 'warning', 'No Open Grid cluster available'); 214 return; 215 } 216 217 Doc.element('autoAnalyzeNo').disabled = false; 218 Doc.element('autoAnalyzeYes').disabled = false; 198 219 for (var i = 0; i < clusters.length; i++) 199 220 { … … 202 223 option.cluster = cl; 203 224 frm.clusters[frm.clusters.length] = option; 204 Wizard.setInputStatus('clusters', 'valid'); 205 clusterIsValid = true; 206 } 207 if (frm.clusters.length == 0) 208 { 209 Wizard.setInputStatus('clusters', 'invalid', 'No available Open Grid clusters'); 210 clusterIsValid = false; 211 } 212 else 213 { 214 specimen.clusterOnChange(); 215 } 216 } 225 } 226 specimen.autoAnalyzeOnChange(); 227 } 228 229 specimen.autoAnalyzeOnChange = function() 230 { 231 Wizard.setInputStatus('autoAnalyze'); 232 autoAnalyzeIsValid = false; 233 234 var frm = document.forms['reggie']; 235 var yesChecked = Doc.element('autoAnalyzeYes').checked; 236 var noChecked = Doc.element('autoAnalyzeNo').checked; 237 238 frm.mergeProtocol.disabled = !yesChecked; 239 frm.mergeSoftware.disabled = !yesChecked; 240 frm.clusters.disabled = !yesChecked; 241 frm.priority.disabled = !yesChecked; 242 frm.autoConfirm.disabled = !yesChecked; 243 frm.debug.disabled = !yesChecked; 244 245 if (!yesChecked && !noChecked) 246 { 247 Wizard.setInputStatus('autoAnalyze', 'invalid', 'Must select Yes or No'); 248 return; 249 } 250 251 autoAnalyzeIsValid = true; 252 Wizard.setInputStatus('autoAnalyze', 'valid'); 253 254 if (yesChecked) specimen.clusterOnChange(); 255 } 256 217 257 218 258 specimen.clusterOnChange = function() … … 242 282 var submitInfo = {}; 243 283 244 submitInfo.cluster = frm.clusters.value;245 if (frm.priority.selectedIndex >= 0)246 {247 submitInfo.priority = parseInt(frm.priority.value);248 }249 submitInfo.debug = frm.debug.checked;250 submitInfo.autoConfirm = frm.autoConfirm.checked;251 252 284 var items = []; 253 285 submitInfo.items = items; … … 264 296 } 265 297 298 if (Doc.element('autoAnalyzeYes').checked) 299 { 300 var autoAnalyze = {}; 301 autoAnalyze.mergeSoftware = parseInt(frm.mergeSoftware.value); 302 autoAnalyze.mergeProtocol = parseInt(frm.mergeProtocol.value); 303 autoAnalyze.cluster = frm.clusters.value; 304 autoAnalyze.priority = parseInt(frm.priority.value); 305 autoAnalyze.debug = frm.debug.checked; 306 autoAnalyze.autoConfirm = frm.autoConfirm.checked; 307 submitInfo.autoAnalyze = autoAnalyze; 308 } 309 266 310 var url = '../FutureSpecimen.servlet?ID='+App.getSessionId(); 267 311 url += '&cmd=ImportFromJSON'; -
extensions/net.sf.basedb.reggie/trunk/resources/batch/import-external-specimen.jsp
r6198 r6211 99 99 <table class="step-form"> 100 100 <tbody> 101 <tr> 102 <td class="subprompt">Auto-analyze</td> 103 <td class="input"> 104 <label><input type="radio" name="autoAnalyze" id="autoAnalyzeYes" disabled>Yes</label> 105 <label><input type="radio" name="autoAnalyze" id="autoAnalyzeNo" disabled>No</label> 106 </td> 107 <td class="status" id="autoAnalyze.status"></td> 108 <td class="help"> 109 <span id="autoAnalyze.message" class="message"></span> 110 If the auto-analyze option is enabled, Reggie will automatically start 111 importing the FASTQ files after a successful JSON import. 112 </td> 113 </tr> 114 <tr> 115 <td class="subprompt">Protocol</td> 116 <td class="input"> 117 <select name="mergeProtocol" id="mergeProtocol" disabled></select> 118 </td> 119 <td class="status" id="mergeProtocol.status"></td> 120 <td class="help"> 121 <span id="mergeProtocol.message" class="message"></span> 122 Select the protocol used for merging. 123 </td> 124 </tr> 125 <tr> 126 <td class="subprompt">Software</td> 127 <td class="input"> 128 <select name="mergeSoftware" id="mergeSoftware" disabled></select> 129 </td> 130 <td class="status" id="mergeSoftware.status"></td> 131 <td class="help"> 132 <span id="mergeSoftware.message" class="message"></span> 133 Select the software to use for merging the FASTQ files. 134 </td> 135 </tr> 136 </tbody> 137 <tbody> 101 138 <tr class="section-header"> 102 139 <td colspan="4">Open Grid Scheduler</td> 103 140 </tr> 104 141 <tr> 105 <td class="subprompt">Cluster</td> 106 <td class="input"> 107 <select name="clusters" id="clusters" class="required"></select></td> 142 <td class="subprompt">Open Grid Cluster</td> 143 <td class="input"> 144 <select name="clusters" id="clusters" class="required" disabled></select> 145 </td> 108 146 <td class="status" id="clusters.status"></td> 109 147 <td class="help"> 110 148 <span id="clusters.message" class="message"></span> 111 Select the cluster to use for running the software.112 </td> 113 </tr> 114 <tr id="job-priority" style="display: none;">149 Select the cluster to use for running the analysis. 150 </td> 151 </tr> 152 <tr> 115 153 <td class="subprompt">Job priority</td> 116 154 <td class="input"> 117 <select name="priority" id="priority" ></select>155 <select name="priority" id="priority" disabled></select> 118 156 </td> 119 157 <td class="status" id="priority.status"></td> 120 158 <td class="help"> 121 159 <span id="priority.message" class="message"></span> 122 Select the priority of the job.160 Select the priority of the analysis jobs. 123 161 </td> 124 162 </tr> 125 163 <tr> 126 164 <td class="subprompt">Auto-confirm</td> 127 <td class="input"><input type="checkbox" name="autoConfirm" checked ></td>165 <td class="input"><input type="checkbox" name="autoConfirm" checked disabled></td> 128 166 <td class="status" id="autoConfirm.status"></td> 129 167 <td class="help"> 130 168 <span id="autoConfirm.message" class="message"></span> 131 169 If the FASTQ analysis is successful, with at least 10M reads 170 after trimmomatic and valid fragment size values, it is 171 automatically confirmed and alignment is started. 132 172 </td> 133 173 </tr> 134 174 <tr> 135 175 <td class="subprompt">Debug</td> 136 <td class="input"><input type="checkbox" name="debug" ></td>176 <td class="input"><input type="checkbox" name="debug" disabled></td> 137 177 <td class="status" id="debug.status"></td> 138 178 <td class="help"> 139 179 <span id="debug.message" class="message"></span> 140 When running in debug mode temporary files are not removed from the141 cluster node.180 When running in debug mode only part of the sequenced data is used and 181 temporary files are not removed from the cluster nodes. 142 182 </td> 143 183 </tr> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/grid/ImportFastqJobCreator.java
r6209 r6211 214 214 importJob.setSendMessage(Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), false)); 215 215 importJob.setName("FASTQ Import to " + mergeName); 216 importJob.setParameterValue("pipeline", new StringParameterType(), Pipeline.RNA SEQ_HISAT_STRINGTIE.getId());216 importJob.setParameterValue("pipeline", new StringParameterType(), Pipeline.RNA_SEQ.getId()); 217 217 if (debug) importJob.setName(importJob.getName() + " (debug)"); 218 218 dc.saveItem(importJob); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FutureSpecimenServlet.java
r6210 r6211 18 18 import net.sf.basedb.core.ItemNotFoundException; 19 19 import net.sf.basedb.core.ItemQuery; 20 import net.sf.basedb.core.Job; 21 import net.sf.basedb.core.Protocol; 20 22 import net.sf.basedb.core.Sample; 21 23 import net.sf.basedb.core.SessionControl; 24 import net.sf.basedb.core.Software; 25 import net.sf.basedb.opengrid.JobDefinition; 22 26 import net.sf.basedb.opengrid.OpenGrid; 23 27 import net.sf.basedb.opengrid.OpenGridCluster; … … 34 38 import net.sf.basedb.reggie.dao.Fileserver; 35 39 import net.sf.basedb.reggie.dao.FutureSpecimen; 40 import net.sf.basedb.reggie.dao.MergedSequences; 36 41 import net.sf.basedb.reggie.dao.ReggieRole; 37 42 import net.sf.basedb.reggie.dao.SpecimenTube; 38 43 import net.sf.basedb.reggie.dao.Subtype; 44 import net.sf.basedb.reggie.grid.ImportFastqJobCreator; 39 45 import net.sf.basedb.reggie.grid.ScriptUtil; 40 46 import net.sf.basedb.reggie.plugins.FutureSpecimenImporter; … … 189 195 JSONObject jsonReq = JsonUtil.parseRequest(req); 190 196 JSONArray jsonItems = (JSONArray)jsonReq.get("items"); 191 192 String clusterId = (String)jsonReq.get("cluster"); 193 boolean debug = Boolean.TRUE.equals(jsonReq.get("debug")); 194 boolean autoConfirm = Boolean.TRUE.equals(jsonReq.get("autoConfirm")); 195 Number priority = (Number)jsonReq.get("priority"); 196 197 OpenGridCluster cluster = OpenGridService.getInstance().getClusterById(dc, clusterId); 198 if (cluster == null) 199 { 200 throw new ItemNotFoundException("OpenGridCluster[" + clusterId + "]"); 201 } 202 197 JSONObject jsonAutoAnalyze = (JSONObject)jsonReq.get("autoAnalyze"); 198 199 OpenGridCluster cluster = null; 200 ImportFastqJobCreator jobCreator = null; 201 if (jsonAutoAnalyze != null) 202 { 203 boolean debug = Boolean.TRUE.equals(jsonAutoAnalyze.get("debug")); 204 boolean autoConfirm = Boolean.TRUE.equals(jsonAutoAnalyze.get("autoConfirm")); 205 Number priority = (Number)jsonAutoAnalyze.get("priority"); 206 String clusterId = (String)jsonAutoAnalyze.get("cluster"); 207 Number mergeSoftwareId = (Number)jsonAutoAnalyze.get("mergeSoftware"); 208 Number mergeProtocolId = (Number)jsonAutoAnalyze.get("mergeProtocol"); 209 210 cluster = OpenGridService.getInstance().getClusterById(dc, clusterId); 211 if (cluster == null) 212 { 213 throw new ItemNotFoundException("OpenGridCluster[" + clusterId + "]"); 214 } 215 jobCreator = new ImportFastqJobCreator(); 216 jobCreator.setAutoConfirm(autoConfirm); 217 jobCreator.setDebug(debug); 218 if (priority != null) jobCreator.setPriority(priority.intValue()); 219 jobCreator.setMergeProtocol(mergeProtocolId != null ? Protocol.getById(dc, mergeProtocolId.intValue()) : null); 220 jobCreator.setMergeSoftware(mergeSoftwareId != null ? Software.getById(dc, mergeSoftwareId.intValue()) : null); 221 } 222 203 223 FileServer importGateway = Fileserver.IMPORT_GATEWAY.load(dc); 204 224 FileServer importArchive = Fileserver.IMPORT_ARCHIVE.load(dc); … … 212 232 gatewaySession = new RemoteHost(new ConnectionInfo(importGateway)).connect(5); 213 233 archiveSession = new RemoteHost(new ConnectionInfo(importArchive)).connect(5); 214 234 List<MergedSequences> mergedSequences = new ArrayList<>(); // Collect MergedSequences that has been created by the importer 215 235 for (int itemNo = 0; itemNo < jsonItems.size(); itemNo++) 216 236 { … … 239 259 else 240 260 { 241 242 261 // Add to FASTQ import pipeline 243 262 BiomaterialList.FASTQ_IMPORT_PIPELINE.get(dc).add(items.merged.getItem()); … … 245 264 String dataFilesFolder = (String)Annotationtype.DATA_FILES_FOLDER.getAnnotationValue(dc, items.sequencingRun.getItem()); 246 265 jsonFile.saveTo(archiveSession, archiveRoot + dataFilesFolder); 247 //dc.commit();266 dc.commit(); 248 267 jsonMessages.add("Imported "+specimen.getName()+" with data from "+jsonFile.getName()); 268 mergedSequences.add(items.merged); 249 269 // Remove JSON from Filesever.IMPORT_GATEWAY 250 //jsonFile.deleteFrom(gatewaySession, gatewayRoot);270 jsonFile.deleteFrom(gatewaySession, gatewayRoot); 251 271 if (jsonFile.hasError()) 252 272 { 253 273 jsonMessages.addAll(prefix("[Warning]["+jsonFile.getName()+"] ", jsonFile.getErrorMessages())); 254 274 } 255 if (autoConfirm) 275 } 276 277 jsonMessages.addAll(prefix("[Warning]["+jsonFile.getName()+"] ", jsonFile.getWarningMessages())); 278 // jsonMessages.addAll(prefix("[Debug]["+jsonFile.getName()+"] ", jsonFile.getDebugMessages())); 279 } 280 281 if (jobCreator != null) 282 { 283 dc = sc.newDbControl(); 284 List<JobDefinition> jobDefs = jobCreator.createFastqImportJobs(dc, cluster, mergedSequences); 285 List<Job> jobs = ScriptUtil.submitJobs(dc, cluster, jobDefs); 286 for (Job job : jobs) 287 { 288 if (job.getStatus() == Job.Status.ERROR) 256 289 { 257 jsonMessages.add(items.merged.getName()+" added to FASTQ import pipeline"); 258 // TODO -- implement this 290 jsonMessages.add("[Warning]Job submission for '" + job.getName() + "' failed: " + job.getStatusMessage()); 259 291 } 260 261 } 262 263 jsonMessages.addAll(prefix("[Warning]["+jsonFile.getName()+"] ", jsonFile.getWarningMessages())); 264 if (debug) 265 { 266 jsonMessages.addAll(prefix("[Debug]["+jsonFile.getName()+"] ", jsonFile.getDebugMessages())); 267 } 268 } 292 else 293 { 294 jsonMessages.add("Submitted "+job.getName()+" to "+cluster.getConnectionInfo().getName()+" with id "+job.getExternalId()); 295 } 296 } 297 dc.commit(); 298 } 299 269 300 } 270 301 finally
Note: See TracChangeset
for help on using the changeset viewer.