Changeset 6215
- Timestamp:
- Apr 16, 2021, 10:16:20 AM (13 months ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 1 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/analysis/import_confirm.js
r6188 r6215 209 209 var frm = document.forms['reggie']; 210 210 var submitInfo = {}; 211 submitInfo.deleteItemsCreatedByFailedJobs = frm.deleteItemsCreatedByFailedJobs.checked; 211 212 212 213 var all = []; -
extensions/net.sf.basedb.reggie/trunk/resources/analysis/import_confirm.jsp
r6188 r6215 53 53 } 54 54 55 #mergedSequencesTable t body td55 #mergedSequencesTable td, #mergedSequencesTable th 56 56 { 57 padding-top: 1px; 58 padding-bottom: 1px; 57 padding: 2px 1px; 59 58 } 60 59 … … 64 63 } 65 64 66 #mergedSequencesTable . icon-col65 #mergedSequencesTable .warning-col 67 66 { 68 67 width: 20px; … … 110 109 </td> 111 110 </tr> 111 <tr> 112 <td class="prompt"></td> 113 <td class="input" style="text-align: right; vertical-align: middle;"> 114 <label>Delete items selected for re-import 115 <input type="checkbox" name="deleteItemsCreatedByFailedJobs" id="deleteItemsCreatedByFailedJobs" checked> 116 </label> 117 </td> 118 <td class="status" id="deleteItemsCreatedByFailedJobs.status"></td> 119 <td class="help"> 120 <span id="deleteItemsCreatedByFailedJobs.message" class="message"></span> 121 Recommended! Items created by jobs selected for re-import are deleted to avoid cluttering in the database. 122 </td> 123 </tr> 112 124 </table> 113 125 </div> -
extensions/net.sf.basedb.reggie/trunk/resources/analysis/import_fastq.js
r6214 r6215 11 11 12 12 // Step 1 13 Events.addEventHandler(' mergedSequences', 'change', fastq.mergedSequencesOnChange);13 Events.addEventHandler('demuxedSequences', 'change', fastq.demuxedSequencesOnChange); 14 14 Events.addEventHandler('step-1', 'wizard-validate', fastq.validateStep1); 15 15 … … 31 31 Wizard.showLoadingAnimation('Loading bioassays...'); 32 32 var url = '../Fastq.servlet?ID='+App.getSessionId(); 33 url += '&cmd=Get MergedSequencesForImport';33 url += '&cmd=GetDemuxedSequencesForImport'; 34 34 Wizard.asyncJsonRequest(url, fastq.initializeStep1); 35 35 } … … 38 38 fastq.initializeStep1 = function(response) 39 39 { 40 var mergedSequences = response.mergedSequences;40 var demuxedSequences = response.demuxedSequences; 41 41 var frm = document.forms['reggie']; 42 if ( mergedSequences.length == 0)43 { 44 Wizard.setFatalError('No merged sequences available for importing.');42 if (demuxedSequences.length == 0) 43 { 44 Wizard.setFatalError('No demuxed sequences available for importing.'); 45 45 return; 46 46 } 47 47 48 48 var firstPlate = null; 49 for (var msNo=0; msNo < mergedSequences.length; msNo++)50 { 51 var ms = mergedSequences[msNo];49 for (var msNo=0; msNo < demuxedSequences.length; msNo++) 50 { 51 var ms = demuxedSequences[msNo]; 52 52 var libPlate = ms.lib.bioWell ? ms.lib.bioWell.bioPlate : null; 53 53 if (firstPlate == null && libPlate != null) firstPlate = libPlate.name; 54 54 var option = fastq.createListOption(msNo+1, ms, ms.DO_NOT_USE == null && libPlate != null && libPlate.name==firstPlate) 55 frm. mergedSequences.options[frm.mergedSequences.length] = option;56 } 57 Events.sendChangeEvent(' mergedSequences');55 frm.demuxedSequences.options[frm.demuxedSequences.length] = option; 56 } 57 Events.sendChangeEvent('demuxedSequences'); 58 58 59 59 Doc.show('step-1'); 60 60 Doc.show('gonext'); 61 61 62 frm. mergedSequences.focus();62 frm.demuxedSequences.focus(); 63 63 } 64 64 … … 68 68 } 69 69 70 fastq.createListOption = function(index, mergedItem, selected)71 { 72 var lib = mergedItem.lib;70 fastq.createListOption = function(index, demuxItem, selected) 71 { 72 var lib = demuxItem.lib; 73 73 var isYellow = lib.specimen && lib.specimen.YellowLabel != null; 74 74 var libPlate = lib.bioWell ? lib.bioWell.bioPlate : null; … … 77 77 var name = (index) + ': '; 78 78 if (libPlate) name += libPlate.name + ' - '; 79 name += mergedItem.name;80 81 if ( mergedItem.DO_NOT_USE)79 name += demuxItem.name; 80 81 if (demuxItem.DO_NOT_USE) 82 82 { 83 83 name += ' [DoNotUse]'; 84 tooltip = 'DoNotUse-'+Strings.encodeTags( mergedItem.DO_NOT_USE+': '+mergedItem.DO_NOT_USE_COMMENT);85 } 86 else if ( mergedItem.AutoProcess == 'ReProcess')84 tooltip = 'DoNotUse-'+Strings.encodeTags(demuxItem.DO_NOT_USE+': '+demuxItem.DO_NOT_USE_COMMENT); 85 } 86 else if (demuxItem.AutoProcess == 'ReProcess') 87 87 { 88 88 name += ' [R]'; 89 89 } 90 90 91 var option = new Option(name, mergedItem.id, false, selected);91 var option = new Option(name, demuxItem.id, false, selected); 92 92 if (isYellow) option.className = 'yellow'; 93 93 if (tooltip) option.title = tooltip; 94 option. mergedSequences = mergedItem;94 option.demuxedSequences = demuxItem; 95 95 return option; 96 96 } 97 97 98 fastq. mergedSequencesOnChange = function()98 fastq.demuxedSequencesOnChange = function() 99 99 { 100 100 var frm = document.forms['reggie']; … … 104 104 var invalidSelection = null; 105 105 106 Wizard.setInputStatus(' mergedSequences');106 Wizard.setInputStatus('demuxedSequences'); 107 107 Wizard.hideGoNextConfirmation(); 108 for (var msNo = 0; msNo < frm. mergedSequences.length; msNo++)109 { 110 if (frm. mergedSequences[msNo].selected)108 for (var msNo = 0; msNo < frm.demuxedSequences.length; msNo++) 109 { 110 if (frm.demuxedSequences[msNo].selected) 111 111 { 112 112 numSelected++; 113 var ms = frm. mergedSequences[msNo].mergedSequences;113 var ms = frm.demuxedSequences[msNo].demuxedSequences; 114 114 if (ms.DO_NOT_USE) numDoNotUse++; 115 115 if (ms.pipeline && ms.pipeline != 'RNAseq') … … 121 121 invalidSelection = Strings.encodeTags(ms.name+' is missing RawFASTQ information'); 122 122 } 123 else if (!ms. rawFastqFolder)123 else if (!ms.DataFilesFolder) 124 124 { 125 invalidSelection = Strings.encodeTags(ms.name+' demux ('+ms.demuxName+')is missing DataFilesFolder information');125 invalidSelection = Strings.encodeTags(ms.name+' is missing DataFilesFolder information'); 126 126 } 127 127 } … … 130 130 if (numSelected == 0) 131 131 { 132 Wizard.setInputStatus(' mergedSequences', 'invalid', 'Select at least one item');132 Wizard.setInputStatus('demuxedSequences', 'invalid', 'Select at least one item'); 133 133 return; 134 134 } 135 135 if (invalidSelection) 136 136 { 137 Wizard.setInputStatus(' mergedSequences', 'invalid', invalidSelection);137 Wizard.setInputStatus('demuxedSequences', 'invalid', invalidSelection); 138 138 return; 139 139 } … … 142 142 if (numDoNotUse > 0) 143 143 { 144 Wizard.setInputStatus(' mergedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse');144 Wizard.setInputStatus('demuxedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); 145 145 Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); 146 146 } 147 147 else 148 148 { 149 Wizard.setInputStatus(' mergedSequences', 'valid');149 Wizard.setInputStatus('demuxedSequences', 'valid'); 150 150 } 151 151 } … … 270 270 submitInfo.autoConfirm = frm.autoConfirm.checked; 271 271 272 var mergedSequences = [];273 submitInfo. mergedSequences = mergedSequences;272 var demuxedSequences = []; 273 submitInfo.demuxedSequences = demuxedSequences; 274 274 275 for (var msNo = 0; msNo < frm. mergedSequences.length; msNo++)276 { 277 if (frm. mergedSequences[msNo].selected)275 for (var msNo = 0; msNo < frm.demuxedSequences.length; msNo++) 276 { 277 if (frm.demuxedSequences[msNo].selected) 278 278 { 279 279 var ms = {}; 280 ms.id = frm. mergedSequences[msNo].mergedSequences.id;281 mergedSequences[mergedSequences.length] = ms;280 ms.id = frm.demuxedSequences[msNo].demuxedSequences.id; 281 demuxedSequences[demuxedSequences.length] = ms; 282 282 } 283 283 } -
extensions/net.sf.basedb.reggie/trunk/resources/analysis/import_fastq.jsp
r6180 r6215 40 40 <div class="step auto-hide" id="step-1"> 41 41 <div class="step-no">1</div> 42 <div class="step-title">Select merged sequences</div>42 <div class="step-title">Select demuxed sequences</div> 43 43 <div class="step-content"> 44 44 45 45 <table class="step-form"> 46 46 <tr class="align-top"> 47 <td class="prompt"> Merged sequences</td>47 <td class="prompt">Demuxed sequences</td> 48 48 <td class="input"> 49 <select class="required yellow-label-support" multiple size=" 30"50 name=" mergedSequences" id="mergedSequences"></select>49 <select class="required yellow-label-support" multiple size="20" 50 name="demuxedSequences" id="demuxedSequences"></select> 51 51 </td> 52 <td class="status" id=" mergedSequences.status"></td>53 <td class="help"><span id=" mergedSequences.message" class="message"></span>54 Select the sequences that should be imported. The list contains merged sequences52 <td class="status" id="demuxedSequences.status"></td> 53 <td class="help"><span id="demuxedSequences.message" class="message"></span> 54 Select the sequences that should be imported. The list contains demuxed sequences 55 55 from the <b>FASTQ import pipeline</b> item list (max 250).<br><br> 56 56 Items marked with <b>[R]</b> have been marked for re-import due to a failure of -
extensions/net.sf.basedb.reggie/trunk/resources/index.jsp
r6187 r6215 760 760 <li><span class="require-permission" data-role="SecondaryAnalysis" data-link="analysis/import_fastq.jsp?ID=<%=ID%>" 761 761 >Import FASTQ files</span> 762 <span class="counter" data-counter=" merged-sequences-for-fastq-import"763 title="Number of merged sequences waiting for FASTQ import">∙</span>762 <span class="counter" data-counter="demuxed-sequences-for-fastq-import" 763 title="Number of demuxed sequences waiting for FASTQ import">∙</span> 764 764 <span id="fastq-import-pipeline-disabled" class="info-warning">auto-processing is disabled</span> 765 765 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/counter/CounterService.java
r6209 r6215 1171 1171 // External merged sequences waiting for FASTQ import 1172 1172 ItemList fastqImportPipeline = BiomaterialList.FASTQ_IMPORT_PIPELINE.load(dc); 1173 json.put(" merged-sequences-for-fastq-import", fastqImportPipeline.getSize());1173 json.put("demuxed-sequences-for-fastq-import", fastqImportPipeline.getSize()); 1174 1174 1175 1175 // Merged sequences with FASTQ import not confirmed -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java
r6213 r6215 1378 1378 1379 1379 /** 1380 The "RawFASTQ" annotation, used for ( merged) derived bioassays that1380 The "RawFASTQ" annotation, used for (demuxed) derived bioassays that 1381 1381 use external FASTQ files for import. This annotation should typically 1382 1382 have 2 values (one for R1 and one for R2). -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/BiomaterialList.java
r6179 r6215 124 124 public static final BiomaterialList FASTQ_IMPORT_PIPELINE = 125 125 new BiomaterialList("FASTQ Import Pipeline", "net.sf.basedb.reggie.pipeline.fastq-import", 126 Item.DERIVEDBIOASSAY, Subtype. MERGED_SEQUENCES,127 "This list contains merged sequences items that need FASTQ files to be imported " +126 Item.DERIVEDBIOASSAY, Subtype.DEMUXED_SEQUENCES, 127 "This list contains demuxed sequences items that need FASTQ files to be imported " + 128 128 "before downstream analysis can take place. Items are normally added and removed from this list " + 129 129 "automatically, but it is possible to also manually add items."); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/DemuxedSequences.java
r6193 r6215 191 191 } 192 192 193 /** 194 Get the library related to this demux. NOTE! This is only 195 available for externally sequenced where we get raw FASTQ files 196 from the demux. 197 @since 4.32 198 */ 199 public Library getLibrary(DbControl dc) 200 { 201 return getItem().getExtract() == null ? null : Library.getById(dc, getItem().getExtract().getId()); 202 } 193 203 194 204 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Library.java
r6193 r6215 318 318 } 319 319 320 /** 321 Find the next name to give a "DemuxedSequences" child item. This assumes that 322 all child items are using the naming convention. foo.x, foo.x2, and 323 so on. NOTE! The first child item have no number! 324 @return The next unused name 325 */ 326 public String getNextDemuxedSequencesName(DbControl dc) 327 { 328 Extract lib = getItem(); 329 ItemQuery<DerivedBioAssay> query = null; 330 if (lib.isInDatabase()) 331 { 332 query = DerivedBioAssay.getQuery(); 333 Subtype.DEMUXED_SEQUENCES.addFilter(dc, query); 334 query.setIncludes(Include.ALL); 335 query.restrict(Restrictions.eq(Hql.property("extract"), Hql.entity(lib))); 336 } 337 return getNextChildItemName(dc, query, Subtype.DEMUXED_SEQUENCES.getItemSuffix(), true); 338 } 339 340 320 341 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/MergedSequences.java
r6214 r6215 227 227 throw new InvalidDataException( 228 228 "No parent item was found for " + getName() + 229 " This wizard can't be used until that is corrected.");229 ". This wizard can't be used until that is corrected."); 230 230 } 231 231 … … 233 233 } 234 234 235 public DemuxedSequences getSingleDemuxedSeque cnces(DbControl dc)235 public DemuxedSequences getSingleDemuxedSequences(DbControl dc) 236 236 { 237 237 ItemQuery<DerivedBioAssay> query = getItem().getParents(); … … 244 244 throw new InvalidDataException( 245 245 "No demux item was found for " + getName() + 246 " This wizard can't be used until that is corrected.");246 ". This wizard can't be used until that is corrected."); 247 247 } 248 248 else if (tmp.size() > 1) … … 250 250 throw new InvalidDataException( 251 251 "More than one demux was found for " + getName() + 252 " This wizard can't be used until that is corrected.");252 ". This wizard can't be used until that is corrected."); 253 253 } 254 254 return DemuxedSequences.get(tmp.get(0)); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/grid/ImportFastqJobCreator.java
r6214 r6215 22 22 import net.sf.basedb.core.Job; 23 23 import net.sf.basedb.core.Path; 24 import net.sf.basedb.core.PermissionDeniedException;25 24 import net.sf.basedb.core.Protocol; 26 25 import net.sf.basedb.core.SessionControl; … … 41 40 import net.sf.basedb.reggie.dao.Datafiletype; 42 41 import net.sf.basedb.reggie.dao.DemuxedSequences; 42 import net.sf.basedb.reggie.dao.DoNotUse; 43 43 import net.sf.basedb.reggie.dao.Fileserver; 44 44 import net.sf.basedb.reggie.dao.Library; 45 45 import net.sf.basedb.reggie.dao.MergedSequences; 46 46 import net.sf.basedb.reggie.dao.Pipeline; 47 import net.sf.basedb.reggie.dao.SequencingRun;48 47 import net.sf.basedb.reggie.dao.Subtype; 49 48 import net.sf.basedb.util.Values; … … 119 118 120 119 /** 121 Create a child bioassays for all given merged sequences and schedule122 jobs on the given cluster for running Hisat alignment.120 Create a child bioassays for all given demuxed sequences and schedule 121 jobs on the given cluster for importing FASTQ files. 123 122 @return A list with the corresponding jobs in BASE 124 123 */ 125 124 @SuppressWarnings("unchecked") 126 public List<JobDefinition> createFastqImportJobs(DbControl dc, OpenGridCluster cluster, List< MergedSequences> mergedSequences)125 public List<JobDefinition> createFastqImportJobs(DbControl dc, OpenGridCluster cluster, List<DemuxedSequences> demuxedSequences) 127 126 { 128 127 SessionControl sc = dc.getSessionControl(); … … 160 159 // Load common items 161 160 ItemSubtype fastqImportJobType = Subtype.FASTQ_IMPORT_JOB.get(dc); 161 ItemSubtype mergedType = Subtype.MERGED_SEQUENCES.get(dc); 162 162 DataFileType fastqData = Datafiletype.FASTQ.load(dc); 163 163 … … 173 173 174 174 // We submit one job for each item to the cluster 175 List<JobDefinition> jobDefs = new ArrayList<JobDefinition>( mergedSequences.size());176 177 for ( MergedSequences ms : mergedSequences)175 List<JobDefinition> jobDefs = new ArrayList<JobDefinition>(demuxedSequences.size()); 176 177 for (DemuxedSequences ds : demuxedSequences) 178 178 { 179 ms = MergedSequences.getById(dc, ms.getId()); // Ensure item is loaded in this transaction180 DerivedBioAssay merged = ms.getDerivedBioAssay();181 String mergeName = ScriptUtil.checkValidFilename(merged.getName());182 183 List<String> rawFastqNames = (List<String>)Annotationtype.RAW_FASTQ.getAnnotationValues(dc, merged);179 ds = DemuxedSequences.getById(dc, ds.getId()); // Ensure item is loaded in this transaction 180 DerivedBioAssay demuxed = ds.getDerivedBioAssay(); 181 String demuxName = ScriptUtil.checkValidFilename(demuxed.getName()); 182 183 List<String> rawFastqNames = (List<String>)Annotationtype.RAW_FASTQ.getAnnotationValues(dc, demuxed); 184 184 if (rawFastqNames == null || rawFastqNames.size() != 2) 185 185 { 186 186 throw new InvalidDataException("Annotation RawFASTQ on " + 187 mergeName + " must have two values: " + rawFastqNames);187 demuxName + " must have two values: " + rawFastqNames); 188 188 } 189 189 190 190 // Get SequencingRun so that we can get the path to the FASTQ folder. 191 DemuxedSequences demux = ms.getSingleDemuxedSequecnces(dc); 192 String rawFastqFolder = ScriptUtil.checkValidPath((String)Annotationtype.DATA_FILES_FOLDER.getAnnotationValue(dc, demux.getItem()), true, true); 193 194 if (merged.hasFileSet() && merged.getFileSet().hasMember(fastqData)) 195 { 196 throw new PermissionDeniedException("FASTQ files already exists: " + mergeName); 197 } 198 importPipeline.removeItem(merged); 199 Library lib = Library.get(merged.getExtract()); 200 boolean isExternal = Reggie.isExternalItem(mergeName); 191 String rawFastqFolder = ScriptUtil.checkValidPath((String)Annotationtype.DATA_FILES_FOLDER.getAnnotationValue(dc, demuxed), true, true); 192 193 importPipeline.removeItem(demuxed); 194 Library lib = Library.get(demuxed.getExtract()); 195 boolean isExternal = Reggie.isExternalItem(demuxName); 201 196 String rootName = isExternal ? lib.getTopExtractOrSample(dc).getName() : null; 202 197 203 198 // Create job 199 String mergedName = lib.getNextMergedSequencesName(dc); 204 200 Job importJob = Job.getNew(dc, null, null, null); 205 201 importJob.setItemSubtype(fastqImportJobType); 206 202 importJob.setPluginVersion("reggie-"+Reggie.VERSION); 207 203 importJob.setSendMessage(Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), false)); 208 importJob.setName("FASTQ Import to " + merge Name);204 importJob.setName("FASTQ Import to " + mergedName); 209 205 importJob.setParameterValue("pipeline", new StringParameterType(), Pipeline.RNA_SEQ.getId()); 210 206 if (debug) importJob.setName(importJob.getName() + " (debug)"); 211 207 dc.saveItem(importJob); 212 213 // Update the MergedSequence item with information about this import 208 209 // Created MERGED derived bioassay set 210 DerivedBioAssay merged = DerivedBioAssay.getNew(dc, demuxed, importJob); 211 merged.setItemSubtype(mergedType); 212 Pipeline.RNA_SEQ.setAnnotation(dc, merged); 213 merged.setName(mergedName); 214 merged.setExtract(lib.getExtract()); 214 215 merged.setSoftware(mergeSoftware); 215 216 merged.setProtocol(mergeProtocol); 216 merged.setJob(importJob); 217 218 String dataFilesFolder = ScriptUtil.checkValidPath(MergedSequences.generateDataFilesFolderForProjectArchive(mergeName, rootName, debug), true, true); 217 DoNotUse.copyDoNotUseAnnotations(dc, lib.getExtract(), merged, false); 218 // Copy READS 219 Annotationtype.READS.copyAnnotationValues(dc, demuxed, merged, false); 220 Annotationtype.PF_READS.copyAnnotationValues(dc, demuxed, merged, false); 221 dc.saveItem(merged); 222 223 String dataFilesFolder = ScriptUtil.checkValidPath(MergedSequences.generateDataFilesFolderForProjectArchive(mergedName, rootName, debug), true, true); 219 224 Annotationtype.DATA_FILES_FOLDER.setAnnotationValue(dc, merged, dataFilesFolder); 220 225 if (autoConfirm) … … 225 230 String archiveRoot = isExternal ? externalRoot : projectRoot; 226 231 String fastqFolder = archiveRoot + dataFilesFolder; 227 String baseFileName = isExternal ? Reggie.removePrefix(merge Name) : mergeName;232 String baseFileName = isExternal ? Reggie.removePrefix(mergedName) : mergedName; 228 233 String R1_name = baseFileName+"_R1.fastq"; 229 234 String R2_name = baseFileName+"_R2.fastq"; … … 247 252 248 253 // Set file permissions based on consent or external group! 249 String externalGroup = isExternal ? Reggie.getExternalGroup(merge Name) : null;254 String externalGroup = isExternal ? Reggie.getExternalGroup(mergedName) : null; 250 255 ScriptUtil.setUmaskForItem(dc, lib, externalGroup, script); 251 256 … … 294 299 295 300 script.comment("Run Bowtie2"); 296 script.progress(40, "Bowtie2: " + merge Name + " (${NumThreads} threads)");301 script.progress(40, "Bowtie2: " + mergedName + " (${NumThreads} threads)"); 297 302 String alignCmd = "./stdwrap.sh " + bowtie_path; 298 303 alignCmd += " -p ${NumThreads}"; … … 306 311 script.cmd(alignCmd); 307 312 script.cmd("./singlecolumnaverager.awk < fastq.aligned/aligned.sam > fastq.aligned/" + fragments_name); 308 script.time("DONE: Bowtie2 " + merge Name);309 script.newLine(); 310 311 script.progress(60, "Trimmomatic: " + merge Name + " (${NumThreads} threads)");313 script.time("DONE: Bowtie2 " + mergedName); 314 script.newLine(); 315 316 script.progress(60, "Trimmomatic: " + mergedName + " (${NumThreads} threads)"); 312 317 // First Trimmomatic step should filter on Illumina adapters only 313 318 String trimCmd1 = "./stdwrap.sh ./trimmomatic PE"; … … 340 345 trimCmd2 += " >> ${WD}/trimmomatic.out"; 341 346 script.cmd(trimCmd1); 342 script.time("DONE: Trimmomatic 1 " + merge Name);347 script.time("DONE: Trimmomatic 1 " + mergedName); 343 348 344 349 script.cmd(trimCmd2); 345 script.time("DONE: Trimmomatic 2 " + merge Name);346 script.newLine(); 347 348 script.progress(80, "Archiving FASTQ: " + merge Name);350 script.time("DONE: Trimmomatic 2 " + mergedName); 351 script.newLine(); 352 353 script.progress(80, "Archiving FASTQ: " + mergedName); 349 354 script.cmd("mkdir -p " + fastqFolder); 350 355 script.cmd("rm -f " + fastqFolder + "/*"); … … 357 362 if (externalGroup != null) 358 363 { 359 ScriptUtil.addChgrp(externalGroup, fastqFolder, merge Name, archiveRoot+"/"+Reggie.getPrefix(mergeName), script);364 ScriptUtil.addChgrp(externalGroup, fastqFolder, mergedName, archiveRoot+"/"+Reggie.getPrefix(mergedName), script); 360 365 } 361 366 … … 407 412 msg += Values.formatNumber(total.passedFilter/1000000f, 1) + "M passed filter; "; 408 413 msg += Values.formatNumber(total.passedTrimmomatic[1]/1000000f, 1) + "M passed trimmomatic; "; 409 /* if (total.warnings.size() > 0) 410 { 411 msg += total.warnings.size() + " warnings!"; 412 } 413 */ return msg; 414 return msg; 414 415 } 415 416 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/FutureSpecimenImporter.java
r6214 r6215 25 25 import net.sf.basedb.reggie.dao.Library; 26 26 import net.sf.basedb.reggie.dao.Lysate; 27 import net.sf.basedb.reggie.dao.MergedSequences;28 27 import net.sf.basedb.reggie.dao.Pipeline; 29 28 import net.sf.basedb.reggie.dao.PooledLibrary; … … 43 42 import net.sf.basedb.reggie.plugins.cmd.LibraryInfo; 44 43 import net.sf.basedb.reggie.plugins.cmd.LysateInfo; 45 import net.sf.basedb.reggie.plugins.cmd.MergeInfo;46 44 import net.sf.basedb.reggie.plugins.cmd.PoolInfo; 47 45 import net.sf.basedb.reggie.plugins.cmd.RnaInfo; … … 51 49 /** 52 50 Import data to FutureSpecimen items and create all downstream items 53 needed (down to MergedSequences) before FASTQ files can be imported.51 needed (down to DemuxedSequences) before FASTQ files can be imported. 54 52 55 53 It is also possible to start the import on a Specimen item or an 56 54 RNA item. 57 58 The implementation is currently a mockup which only create more or59 less empty items that most likely will cause other wizards to fail.60 55 61 56 @author nicklas … … 109 104 SequencingRunInfo seqRunInfo = jsonFile.getSequencingRun(); 110 105 DemuxInfo demuxInfo = jsonFile.getDemuxInfo(); 111 MergeInfo mergeInfo = jsonFile.getMergeInfo();112 106 FastqInfo fastqInfo = jsonFile.getFastqInfo(); 113 107 … … 140 134 141 135 if (items.sequencingRun == null || !demuxInfo.valid) return null; 142 items.demux = getOrCreateDemux(dc, items.sequencingRun, flowCellInfo, seqRunInfo, demuxInfo); 143 144 if (items.demux == null || !mergeInfo.valid || !fastqInfo.valid) return null; 145 items.merged = createMergedSequences(dc, items.lib, items.demux, mergeInfo, fastqInfo); 146 147 return items.merged == null || jsonFile.hasError() ? null : items; 136 items.demux = createDemuxedSequences(dc, items.lib, items.sequencingRun, flowCellInfo, seqRunInfo, demuxInfo, fastqInfo); 137 138 return items.demux == null || jsonFile.hasError() ? null : items; 148 139 } 149 140 … … 505 496 506 497 507 private DemuxedSequences getOrCreateDemux(DbControl dc, SequencingRun seqRun, FlowCellInfo flowCellInfo, SequencingRunInfo seqRunInfo, DemuxInfo demuxInfo) 508 { 509 String flowCellId = flowCellInfo.flowCellId; 510 if (flowCellId == null) return null; 511 512 DerivedBioAssay demux = demuxInfo.demux; 513 if (demux != null) 514 { 515 addDebugMessage("Found: "+demux.getName()+"[ref="+flowCellId+"]"); 516 } 517 else 518 { 519 demux = DerivedBioAssay.getNew(dc, seqRun.getItem(), null); 520 demux.setItemSubtype(Subtype.DEMUXED_SEQUENCES.get(dc)); 521 demux.setName(seqRun.getNextDemuxedSequencesName(dc)); 522 Pipeline.RNA_SEQ.setAnnotation(dc, demux); 523 demux.setHardware(null); 524 demux.setSoftware(demuxInfo.software); 525 demux.setProtocol(null); 526 Annotationtype.ANALYSIS_RESULT.setAnnotationValue(dc, demux, DemuxedSequences.DEMUX_SUCCESSFUL); 527 Annotationtype.READ_STRING.setAnnotationValue(dc, demux, demuxInfo.readString); 528 529 DateFormat df = new SimpleDateFormat("/yyyy/yyMMdd"); 530 String dataFilesFolder = df.format(seqRunInfo.startDate)+ 531 "_"+seqRunInfo.sequencer.serialNo+ 532 "_"+MD5.leftPad(Integer.toString(seqRunInfo.runNumber), '0', 4)+ 533 "_"+seqRunInfo.position+flowCellInfo.flowCellId; 534 addDebugMessage("DataFilesFolder: "+dataFilesFolder); 535 Annotationtype.DATA_FILES_FOLDER.setAnnotationValue(dc, demux, dataFilesFolder); 536 537 dc.saveItem(demux); 538 539 addDebugMessage("Created: "+ demux.getName()); 540 } 498 private DemuxedSequences createDemuxedSequences(DbControl dc, Library lib, SequencingRun seqRun, FlowCellInfo flowCellInfo, SequencingRunInfo seqRunInfo, DemuxInfo demuxInfo, FastqInfo fastqInfo) 499 { 500 501 DerivedBioAssay demux = DerivedBioAssay.getNew(dc, seqRun.getItem(), null); 502 demux.setItemSubtype(Subtype.DEMUXED_SEQUENCES.get(dc)); 503 demux.setName(lib.getNextDemuxedSequencesName(dc)); 504 Pipeline.RNA_SEQ.setAnnotation(dc, demux); 505 demux.setExtract(lib.getItem()); 506 demux.setHardware(null); 507 demux.setSoftware(demuxInfo.software); 508 demux.setProtocol(null); 509 Annotationtype.ANALYSIS_RESULT.setAnnotationValue(dc, demux, DemuxedSequences.DEMUX_SUCCESSFUL); 510 Annotationtype.READ_STRING.setAnnotationValue(dc, demux, demuxInfo.readString); 511 Annotationtype.READS.setAnnotationValue(dc, demux, demuxInfo.reads); 512 Annotationtype.PF_READS.setAnnotationValue(dc, demux, demuxInfo.pfReads); 513 Annotationtype.RAW_FASTQ.setAnnotationValues(dc, demux, Arrays.asList(fastqInfo.R1.name, fastqInfo.R2.name)); 514 515 DateFormat df = new SimpleDateFormat("/yyyy/yyMMdd"); 516 String dataFilesFolder = df.format(seqRunInfo.startDate)+ 517 "_"+seqRunInfo.sequencer.serialNo+ 518 "_"+MD5.leftPad(Integer.toString(seqRunInfo.runNumber), '0', 4)+ 519 "_"+seqRunInfo.position+flowCellInfo.flowCellId; 520 addDebugMessage("DataFilesFolder: "+dataFilesFolder); 521 Annotationtype.DATA_FILES_FOLDER.setAnnotationValue(dc, demux, dataFilesFolder); 522 523 dc.saveItem(demux); 524 525 addDebugMessage("Created: "+ demux.getName()); 541 526 return DemuxedSequences.get(demux); 542 }543 544 private MergedSequences createMergedSequences(DbControl dc, Library lib, DemuxedSequences demux, MergeInfo mergeInfo, FastqInfo fastqInfo)545 {546 547 DerivedBioAssay merged = DerivedBioAssay.getNew(dc, demux.getItem(), null);548 merged.setItemSubtype(Subtype.MERGED_SEQUENCES.get(dc));549 merged.setName(lib.getNextMergedSequencesName(dc));550 Pipeline.RNA_SEQ.setAnnotation(dc, merged);551 merged.setExtract(lib.getItem());552 Annotationtype.READS.setAnnotationValue(dc, merged, mergeInfo.reads);553 Annotationtype.PF_READS.setAnnotationValue(dc, merged, mergeInfo.pfReads);554 Annotationtype.RAW_FASTQ.setAnnotationValues(dc, merged, Arrays.asList(fastqInfo.R1.name, fastqInfo.R2.name));555 556 merged.setProtocol(null);557 merged.setSoftware(null);558 merged.setHardware(null);559 560 dc.saveItem(merged);561 562 addDebugMessage("Created: "+ merged.getName());563 return MergedSequences.get(merged);564 527 } 565 528 … … 579 542 public SequencingRun sequencingRun; 580 543 public DemuxedSequences demux; 581 public MergedSequences merged;582 544 } 583 545 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/DemuxInfo.java
r6205 r6215 4 4 5 5 import net.sf.basedb.core.DbControl; 6 import net.sf.basedb.core.DerivedBioAssay;7 6 import net.sf.basedb.core.ItemQuery; 8 7 import net.sf.basedb.core.Software; … … 27 26 { 28 27 29 public DerivedBioAssay demux;30 28 public Software software; 31 29 public String readString; 32 33 public boolean valid;30 public Long pfReads; 31 public Long reads; 34 32 35 public DemuxInfo(JsonSection section, SequencingRunInfo seqRunInfo, FlowCellInfo flowCellInfo) 33 public boolean valid = false; 34 35 public DemuxInfo(JsonSection demuxSection, JsonSection mergeSection) 36 36 { 37 if ( section != null)37 if (demuxSection != null && mergeSection != null) 38 38 { 39 software = section.getRequiredEntry("Software", SoftwareValidator.INSTANCE); 40 readString = section.getRequiredEntry("ReadString", PatternValidator.READ_STRING); 41 if (seqRunInfo.sequencingRun != null) 42 { 43 demux = findExistingDemux(seqRunInfo.sequencingRun, flowCellInfo.flowCellId, section); 44 } 39 software = demuxSection.getRequiredEntry("Software", SoftwareValidator.INSTANCE); 40 readString = demuxSection.getRequiredEntry("ReadString", PatternValidator.READ_STRING); 41 pfReads = mergeSection.getRequiredEntry("PF_READS", LongValidator.POSITIVE.warnIf(10000000l, null)); // Warn if less than 10M reads 42 reads = pfReads; // 43 valid = !demuxSection.hasError() && !mergeSection.hasError(); 45 44 } 46 valid = section != null && !section.hasError();47 }48 49 50 private DerivedBioAssay findExistingDemux(DerivedBioAssay seqRun, String flowCellId, JsonSection section)51 {52 DerivedBioAssay demux = null;53 DbControl dc = section.getFile().dc();54 ItemQuery<DerivedBioAssay> query = seqRun.getChildren();55 query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);56 Subtype.DEMUXED_SEQUENCES.addFilter(dc, query);57 List<DerivedBioAssay> list = query.list(dc);58 if (list.size() > 1)59 {60 section.addErrorMessage("Found "+list.size()+" demux items for FlowCellID="+flowCellId);61 }62 else if (list.size() == 1)63 {64 demux = list.get(0);65 }66 return demux;67 45 } 68 46 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/JsonFile.java
r6212 r6215 95 95 private SequencingRunInfo seqRunInfo; 96 96 private DemuxInfo demuxInfo; 97 private MergeInfo mergeInfo;98 97 99 98 /** … … 260 259 flowCellInfo = new FlowCellInfo(getRequiredSection("FlowCell"), poolInfo); 261 260 seqRunInfo = new SequencingRunInfo(getRequiredSection("SequencingRun"), flowCellInfo); 262 demuxInfo = new DemuxInfo(getRequiredSection("DemuxedSequences"), seqRunInfo, flowCellInfo); 263 mergeInfo = new MergeInfo(getRequiredSection("MergedSequences")); 261 demuxInfo = new DemuxInfo(getRequiredSection("DemuxedSequences"), getRequiredSection("MergedSequences")); 264 262 265 263 if (operator != null) setOperator(operator); … … 369 367 } 370 368 371 public MergeInfo getMergeInfo()372 {373 return mergeInfo;374 }375 376 369 public FastqInfo getFastqInfo() 377 370 { -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FastqServlet.java
r6214 r6215 14 14 15 15 import net.sf.basedb.core.ItemList; 16 import net.sf.basedb.core.BasicItem; 16 17 import net.sf.basedb.core.DbControl; 17 18 import net.sf.basedb.core.DerivedBioAssay; … … 23 24 import net.sf.basedb.core.SessionControl; 24 25 import net.sf.basedb.core.Software; 26 import net.sf.basedb.core.Trashcan; 25 27 import net.sf.basedb.core.query.Annotations; 26 28 import net.sf.basedb.core.query.Expressions; … … 48 50 import net.sf.basedb.reggie.grid.ImportFastqJobCreator; 49 51 import net.sf.basedb.reggie.grid.ScriptUtil; 52 import net.sf.basedb.util.Values; 50 53 import net.sf.basedb.util.error.ThrowableUtil; 51 54 … … 75 78 try 76 79 { 77 if ("Get MergedSequencesForImport".equals(cmd))80 if ("GetDemuxedSequencesForImport".equals(cmd)) 78 81 { 79 82 dc = sc.newDbControl(); 80 83 81 List< MergedSequences> list = null;84 List<DemuxedSequences> list = null; 82 85 // Load items from the pipeline list 83 86 ItemList fastqImportPipeline = BiomaterialList.FASTQ_IMPORT_PIPELINE.load(dc); 84 87 ItemQuery<DerivedBioAssay> query = fastqImportPipeline.getMembers(); 85 88 query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); 86 Subtype. MERGED_SEQUENCES.addFilter(dc, query);89 Subtype.DEMUXED_SEQUENCES.addFilter(dc, query); 87 90 // Join LibPlate for sorting 88 91 query.join(Hql.innerJoin(null, "extract", "lib", true)); … … 92 95 query.order(Orders.asc(Hql.property("name"))); 93 96 query.setMaxResults(250); 94 list = MergedSequences.toList(query.list(dc));97 list = DemuxedSequences.toList(query.list(dc)); 95 98 96 99 SnapshotManager manager = new SnapshotManager(); 97 JSONArray jsonMergedSequences = new JSONArray(); 98 for (MergedSequences ms : list) 99 { 100 ms.loadAnnotations(dc, "pipeline", Annotationtype.PIPELINE, null); 101 ms.loadAnnotations(dc, "rawFastq", Annotationtype.RAW_FASTQ, null); 102 DemuxedSequences demux = ms.getSingleDemuxedSequecnces(dc); 103 ms.setAnnotation("rawFastqFolder", Annotationtype.DATA_FILES_FOLDER.getAnnotationValue(dc, demux.getItem())); 104 ms.setAnnotation("demuxName", demux.getName()); 105 Library lib = ms.getLibrary(dc); 100 JSONArray jsonDemuxedSequences = new JSONArray(); 101 for (DemuxedSequences ds : list) 102 { 103 ds.loadAnnotations(dc, "pipeline", Annotationtype.PIPELINE, null); 104 ds.loadAnnotations(dc, "rawFastq", Annotationtype.RAW_FASTQ, null); 105 ds.loadAnnotations(dc, "DataFilesFolder", Annotationtype.DATA_FILES_FOLDER, null); 106 Library lib = ds.getLibrary(dc); 106 107 lib.loadBioPlateLocation(); 107 108 Rna r = lib.getRna(dc, true); 108 109 if (r != null) lib.setAnnotation("specimen", r.loadYellowLabelInfo(dc, manager)); 109 ms.setAnnotation("lib", lib.asJSONObject());110 ms.loadAnnotations(dc, manager, "AutoProcess", Annotationtype.AUTO_PROCESSING, null);111 ms.loadDoNotUseAnnotations(dc, manager);112 json MergedSequences.add(ms.asJSONObject());113 } 114 json.put(" mergedSequences", jsonMergedSequences);110 ds.setAnnotation("lib", lib.asJSONObject()); 111 ds.loadAnnotations(dc, manager, "AutoProcess", Annotationtype.AUTO_PROCESSING, null); 112 ds.loadDoNotUseAnnotations(dc, manager); 113 jsonDemuxedSequences.add(ds.asJSONObject()); 114 } 115 json.put("demuxedSequences", jsonDemuxedSequences); 115 116 } 116 117 else if ("GetUnconfirmedImportedSequences".equals(cmd)) … … 220 221 221 222 JSONObject jsonReq = JsonUtil.parseRequest(req); 222 JSONArray json Merged = (JSONArray)jsonReq.get("mergedSequences");223 JSONArray jsonDemuxed = (JSONArray)jsonReq.get("demuxedSequences"); 223 224 224 225 Number mergeSoftwareId = (Number)jsonReq.get("mergeSoftware"); … … 241 242 242 243 // Load MergedSequences that should be imported 243 List< MergedSequences> mergedSequences = new ArrayList<MergedSequences>();244 for (int mgNo = 0; mgNo < json Merged.size(); mgNo++)245 { 246 JSONObject json Mg = (JSONObject)jsonMerged.get(mgNo);247 Number mergedId = (Number)jsonMg.get("id");248 249 MergedSequences ms = MergedSequences.getById(dc, mergedId.intValue());250 mergedSequences.add(ms);244 List<DemuxedSequences> demuxedSequences = new ArrayList<DemuxedSequences>(); 245 for (int mgNo = 0; mgNo < jsonDemuxed.size(); mgNo++) 246 { 247 JSONObject jsonDx = (JSONObject)jsonDemuxed.get(mgNo); 248 Number demuxedId = (Number)jsonDx.get("id"); 249 250 DemuxedSequences ds = DemuxedSequences.getById(dc, demuxedId.intValue()); 251 demuxedSequences.add(ds); 251 252 252 253 // Reset AUTO_PROCESSING annotation 253 DerivedBioAssay merged = ms.getDerivedBioAssay();254 Annotationtype.AUTO_PROCESSING.setAnnotationValue(dc, merged, null);254 DerivedBioAssay demuxed = ds.getDerivedBioAssay(); 255 Annotationtype.AUTO_PROCESSING.setAnnotationValue(dc, demuxed, null); 255 256 } 256 257 … … 263 264 jobCreator.setMergeSoftware(mergeSoftware); 264 265 265 List<JobDefinition> jobDefs = jobCreator.createFastqImportJobs(dc, cluster, mergedSequences);266 List<JobDefinition> jobDefs = jobCreator.createFastqImportJobs(dc, cluster, demuxedSequences); 266 267 List<Job> jobs = ScriptUtil.submitJobs(dc, cluster, jobDefs); 267 268 for (Job job : jobs) … … 273 274 else 274 275 { 275 jsonMessages.add("Submitted FASTQ import jobto " + cluster.getConnectionInfo().getName() + " with id " + job.getExternalId());276 jsonMessages.add("Submitted " + job.getName() + " to " + cluster.getConnectionInfo().getName() + " with id " + job.getExternalId()); 276 277 } 277 278 } … … 291 292 int numLegacyAlign = 0; 292 293 int numConfirmed = 0; 294 int numUnconfirmed = 0; 293 295 int numFlaggedRna = 0; 294 296 int numReImport = 0; 297 int numDeleted = 0; 298 295 299 ItemList flaggedRna = BiomaterialList.FLAGGED_RNA.load(dc); 296 300 ItemList hisatPipeline = BiomaterialList.HISAT_PIPELINE.load(dc); 297 301 ItemList legacyPipeline = BiomaterialList.LEGACY_PIPELINE.load(dc); 298 302 ItemList fastqImportPipeline = BiomaterialList.FASTQ_IMPORT_PIPELINE.load(dc); 303 304 boolean deleteItemsCreatedByFailedJobs = Boolean.TRUE.equals(jsonReq.get("deleteItemsCreatedByFailedJobs")); 305 List<BasicItem> toDelete = new ArrayList<BasicItem>(); 306 299 307 for (int mergeNo = 0; mergeNo < jsonMergedSequences.size(); ++mergeNo) 300 308 { … … 306 314 boolean flag = Boolean.TRUE.equals(jsonMerge.get("flag")); 307 315 boolean align = legacyAlign || hisatAlign; 308 309 DerivedBioAssay merge = DerivedBioAssay.getById(dc, mergeId.intValue()); 310 merge.setDescription((String)jsonMerge.get("comment")); 316 boolean deleted = false; 317 318 MergedSequences mg = MergedSequences.getById(dc, mergeId.intValue()); 319 DemuxedSequences dx = mg.getSingleDemuxedSequences(dc); 320 321 DerivedBioAssay merge = mg.getDerivedBioAssay(); 322 DerivedBioAssay demux = dx.getDerivedBioAssay(); 323 324 if (flag && !Reggie.isExternalItem(merge.getName())) 325 { 326 Library lib = Library.get(merge.getExtract()); 327 Rna rna = lib.getRna(dc, false); 328 if (rna != null) 329 { 330 Extract r = rna.getItem(); 331 Annotationtype.FLAG.setAnnotationValue(dc, r, Rna.FLAG_FASTQ_IMPORT_FAILED); 332 flaggedRna.add(r); 333 numFlaggedRna++; 334 } 335 } 336 337 String comment = Values.getStringOrNull((String)jsonMerge.get("comment")); 338 merge.setDescription(comment); 311 339 312 340 if (reImport) 313 341 { 314 // TODO -- This will not work in the general case 315 Annotationtype.ANALYSIS_RESULT.setAnnotationValue(dc, merge, null); 316 Annotationtype.AUTO_PROCESSING.setAnnotationValue(dc, merge, "ReProcess"); 317 merge.setJob(null); // Must do this to reset for new import 318 fastqImportPipeline.add(merge); 342 // Set ReProcess annotation on demuxed sequences item 343 Annotationtype.AUTO_PROCESSING.setAnnotationValue(dc, demux, "ReProcess"); 344 fastqImportPipeline.add(demux); 319 345 numReImport++; 320 } 321 else if (align) 322 { 323 Annotationtype.ANALYSIS_RESULT.setAnnotationValue(dc, merge, MergedSequences.MERGE_SUCCESSFUL); 324 numConfirmed++; 325 if (hisatAlign) 346 347 if (deleteItemsCreatedByFailedJobs && !align) 326 348 { 327 hisatPipeline.add(merge); 328 numHisatAlign++; 349 // Delete rawbioassay and related items 350 merge.setRemoved(true); 351 toDelete.add(merge); 352 toDelete.addAll(Reggie.removeAttachedFiles(dc, merge)); 353 deleted = true; 354 numDeleted++; 355 demux.setDescription(comment); 329 356 } 330 331 if (legacyAlign) 357 } 358 if (!deleted) 359 { 360 if (align) 332 361 { 333 legacyPipeline.add(merge); 334 numLegacyAlign++; 362 Annotationtype.ANALYSIS_RESULT.setAnnotationValue(dc, merge, MergedSequences.MERGE_SUCCESSFUL); 363 numConfirmed++; 364 if (hisatAlign) 365 { 366 hisatPipeline.add(merge); 367 numHisatAlign++; 368 } 369 370 if (legacyAlign) 371 { 372 legacyPipeline.add(merge); 373 numLegacyAlign++; 374 } 335 375 } 336 } 337 338 if (flag) 339 { 340 if (!align) 376 else if (reImport || flag) 341 377 { 342 378 Annotationtype.ANALYSIS_RESULT.setAnnotationValue(dc, merge, MergedSequences.MERGE_FAILED); 343 Annotationtype.AUTO_PROCESSING.setAnnotationValue(dc, merge, "Disable");344 379 } 345 346 if (!Reggie.isExternalItem(merge.getName())) 380 else 347 381 { 348 Library lib = Library.get(merge.getExtract()); 349 Rna rna = lib.getRna(dc, false); 350 if (rna != null) 351 { 352 Extract r = rna.getItem(); 353 Annotationtype.FLAG.setAnnotationValue(dc, r, Rna.FLAG_FASTQ_IMPORT_FAILED); 354 flaggedRna.add(r); 355 numFlaggedRna++; 356 } 382 numUnconfirmed++; 357 383 } 358 384 } … … 379 405 ActivityDef.FASTQ_IMPORT_CONFIRMED.merge(dc, numConfirmed); 380 406 } 407 if (numReImport > 0) 408 { 409 jsonMessages.add(numReImport + " items flagged for re-importing"); 410 } 411 if (numDeleted > 0) 412 { 413 jsonMessages.add(numDeleted + " libraries deleted due to failure"); 414 if (toDelete.size() > numDeleted) 415 { 416 jsonMessages.add((toDelete.size() - numDeleted) + " linked items (eg. parent items and files) deleted"); 417 } 418 } 419 381 420 if (numFlaggedRna > 0) 382 421 { 383 422 jsonMessages.add("Added " + numFlaggedRna + " RNA items to the '" + flaggedRna.getName() + "' list"); 384 423 } 385 386 if (numReImport > 0) 387 { 388 jsonMessages.add(numReImport + " items flagged for re-importing"); 389 } 390 391 // dc.commit(); 424 if (numUnconfirmed > 0) 425 { 426 jsonMessages.add(numUnconfirmed + " libraries remain unconfirmed"); 427 } 428 dc.commit(); 429 if (toDelete.size() > 0) 430 { 431 try 432 { 433 Trashcan.delete(sc, toDelete, false, null); 434 } 435 catch (RuntimeException ex) 436 { 437 ex.printStackTrace(); 438 jsonMessages.add("[Error]Could not delete all items created by failed jobs: " + ex.getMessage()); 439 } 440 } 392 441 } 393 442 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FutureSpecimenServlet.java
r6214 r6215 36 36 import net.sf.basedb.reggie.dao.Annotationtype; 37 37 import net.sf.basedb.reggie.dao.BiomaterialList; 38 import net.sf.basedb.reggie.dao.DemuxedSequences; 38 39 import net.sf.basedb.reggie.dao.Fileserver; 39 40 import net.sf.basedb.reggie.dao.FutureSpecimen; 40 import net.sf.basedb.reggie.dao.MergedSequences;41 41 import net.sf.basedb.reggie.dao.ReggieRole; 42 42 import net.sf.basedb.reggie.dao.SpecimenTube; … … 200 200 201 201 OpenGridCluster cluster = null; 202 ImportFastqJobCreator jobCreator = null;203 202 if (jsonAutoAnalyze != null) 204 203 { 205 boolean debug = Boolean.TRUE.equals(jsonAutoAnalyze.get("debug"));206 boolean autoConfirm = Boolean.TRUE.equals(jsonAutoAnalyze.get("autoConfirm"));207 Number priority = (Number)jsonAutoAnalyze.get("priority");208 204 String clusterId = (String)jsonAutoAnalyze.get("cluster"); 209 Number mergeSoftwareId = (Number)jsonAutoAnalyze.get("mergeSoftware");210 Number mergeProtocolId = (Number)jsonAutoAnalyze.get("mergeProtocol");211 212 205 cluster = OpenGridService.getInstance().getClusterById(dc, clusterId); 213 206 if (cluster == null) … … 215 208 throw new ItemNotFoundException("OpenGridCluster[" + clusterId + "]"); 216 209 } 217 jobCreator = new ImportFastqJobCreator();218 jobCreator.setAutoConfirm(autoConfirm);219 jobCreator.setDebug(debug);220 if (priority != null) jobCreator.setPriority(priority.intValue());221 jobCreator.setMergeProtocol(mergeProtocolId != null ? Protocol.getById(dc, mergeProtocolId.intValue()) : null);222 jobCreator.setMergeSoftware(mergeSoftwareId != null ? Software.getById(dc, mergeSoftwareId.intValue()) : null);223 210 } 224 211 … … 234 221 gatewaySession = new RemoteHost(new ConnectionInfo(importGateway)).connect(5); 235 222 archiveSession = new RemoteHost(new ConnectionInfo(importArchive)).connect(5); 236 List< MergedSequences> mergedSequences = new ArrayList<>(); // Collect MergedSequences that has been created by the importer223 List<DemuxedSequences> demuxedSequences = new ArrayList<>(); // Collect DemuxedSequences that has been created by the importer 237 224 for (int itemNo = 0; itemNo < jsonItems.size(); itemNo++) 238 225 { … … 263 250 { 264 251 // Add to FASTQ import pipeline 265 BiomaterialList.FASTQ_IMPORT_PIPELINE.get(dc).add(items. merged.getItem());252 BiomaterialList.FASTQ_IMPORT_PIPELINE.get(dc).add(items.demux.getItem()); 266 253 // Save the JSON to Fileserver.IMPORT_ARCHIVE 267 254 String dataFilesFolder = (String)Annotationtype.DATA_FILES_FOLDER.getAnnotationValue(dc, items.demux.getItem()); … … 269 256 dc.commit(); 270 257 jsonMessages.add("Imported "+specimen.getName()+" with data from "+jsonFile.getName()); 271 mergedSequences.add(items.merged);258 demuxedSequences.add(items.demux); 272 259 // Remove JSON from Filesever.IMPORT_GATEWAY 273 260 jsonFile.deleteFrom(gatewaySession, gatewayRoot); … … 279 266 280 267 jsonMessages.addAll(prefix("[Warning]["+jsonFile.getName()+"] ", jsonFile.getWarningMessages())); 281 //jsonMessages.addAll(prefix("[Debug]["+jsonFile.getName()+"] ", jsonFile.getDebugMessages())); 282 } 283 284 if (jobCreator != null) 285 { 268 jsonMessages.addAll(prefix("[Debug]["+jsonFile.getName()+"] ", jsonFile.getDebugMessages())); 269 } 270 271 if (jsonAutoAnalyze != null) 272 { 273 boolean debug = Boolean.TRUE.equals(jsonAutoAnalyze.get("debug")); 274 boolean autoConfirm = Boolean.TRUE.equals(jsonAutoAnalyze.get("autoConfirm")); 275 Number priority = (Number)jsonAutoAnalyze.get("priority"); 276 String clusterId = (String)jsonAutoAnalyze.get("cluster"); 277 Number mergeSoftwareId = (Number)jsonAutoAnalyze.get("mergeSoftware"); 278 Number mergeProtocolId = (Number)jsonAutoAnalyze.get("mergeProtocol"); 279 286 280 dc = sc.newDbControl(); 287 List<JobDefinition> jobDefs = jobCreator.createFastqImportJobs(dc, cluster, mergedSequences); 288 List<Job> jobs = ScriptUtil.submitJobs(dc, cluster, jobDefs); 289 for (Job job : jobs) 290 { 291 if (job.getStatus() == Job.Status.ERROR) 281 try 282 { 283 ImportFastqJobCreator jobCreator = new ImportFastqJobCreator(); 284 jobCreator.setAutoConfirm(autoConfirm); 285 jobCreator.setDebug(debug); 286 if (priority != null) jobCreator.setPriority(priority.intValue()); 287 jobCreator.setMergeProtocol(mergeProtocolId != null ? Protocol.getById(dc, mergeProtocolId.intValue()) : null); 288 jobCreator.setMergeSoftware(mergeSoftwareId != null ? Software.getById(dc, mergeSoftwareId.intValue()) : null); 289 290 List<JobDefinition> jobDefs = jobCreator.createFastqImportJobs(dc, cluster, demuxedSequences); 291 List<Job> jobs = ScriptUtil.submitJobs(dc, cluster, jobDefs); 292 for (Job job : jobs) 292 293 { 293 jsonMessages.add("[Warning]Job submission for '" + job.getName() + "' failed: " + job.getStatusMessage()); 294 if (job.getStatus() == Job.Status.ERROR) 295 { 296 jsonMessages.add("[Warning]Job submission for '" + job.getName() + "' failed: " + job.getStatusMessage()); 297 } 298 else 299 { 300 jsonMessages.add("Submitted "+job.getName()+" to "+cluster.getConnectionInfo().getName()+" with id "+job.getExternalId()); 301 } 294 302 } 295 else 296 { 297 jsonMessages.add("Submitted "+job.getName()+" to "+cluster.getConnectionInfo().getName()+" with id "+job.getExternalId()); 298 } 299 } 300 dc.commit(); 301 } 302 303 dc.commit(); 304 } 305 catch (Exception ex) 306 { 307 jsonMessages.add("[Warning]Job submission for FASTQ import failed: "+ ex.getMessage()); 308 } 309 } 303 310 } 304 311 finally -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r6214 r6215 1025 1025 Annotationtype.READ_STRING, Annotationtype.OMIT_LANES, 1026 1026 Annotationtype.ANALYSIS_RESULT, Annotationtype.AUTO_PROCESSING, 1027 Annotationtype.DATA_FILES_FOLDER, 1027 Annotationtype.DATA_FILES_FOLDER, Annotationtype.RAW_FASTQ, 1028 1028 Annotationtype.READS, Annotationtype.PF_READS, Annotationtype.PF_NNNN_PCT, 1029 1029 Annotationtype.PF_UNUSED_PCT, Annotationtype.DEMUX_WARNINGS, Annotationtype.SKIPPED_TILES, … … 1035 1035 Annotationtype.READS, Annotationtype.PF_READS, Annotationtype.ADAPTER_READS, Annotationtype.PT_READS, 1036 1036 Annotationtype.FRAGMENT_SIZE_AVG, Annotationtype.FRAGMENT_SIZE_STDEV, 1037 Annotationtype.DATA_FILES_FOLDER, Annotationtype.RAW_FASTQ,1037 Annotationtype.DATA_FILES_FOLDER, 1038 1038 Annotationtype.DO_NOT_USE, Annotationtype.DO_NOT_USE_COMMENT, 1039 1039 Annotationtype.AUTO_PROCESSING,
Note: See TracChangeset
for help on using the changeset viewer.