Changeset 2224
- Timestamp:
- Feb 12, 2014, 11:09:09 AM (9 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java
r2196 r2224 667 667 668 668 /** 669 The "SequencingCycles" annotation, used for physical bioassays (FlowCell). 669 The "SequencingCycles" annotation, used for physical bioassays and 670 (FlowCell) derived bioassays (SequencingRun). 670 671 @since 2.13 671 672 */ 672 673 public static final Annotationtype SEQUENCING_CYCLES = 673 new Annotationtype("SequencingCycles", Type.STRING, Item.PHYSICALBIOASSAY );674 675 676 /** 677 The "HiSeqPosition" annotation, used for physical bioassays (FlowCell).674 new Annotationtype("SequencingCycles", Type.STRING, Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAY); 675 676 677 /** 678 The "HiSeqPosition" annotation, used for derived bioassays (SequencingRun). 678 679 It is an enumerated string annotation type with two options: A and B 679 680 @since 2.13 680 681 */ 681 682 public static final Annotationtype HISEQ_POSITION = 682 new Annotationtype("HiSeqPosition", Type.STRING, Item.PHYSICALBIOASSAY );683 new Annotationtype("HiSeqPosition", Type.STRING, Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAY); 683 684 684 685 … … 705 706 new Annotationtype("SequencingEnd", Type.TIMESTAMP, Item.DERIVEDBIOASSAY); 706 707 707 708 /** 709 The "SequencingRunNumber" annotation, used for derived bioassays (SequencingRun). 710 @since 2.15 711 */ 712 public static final Annotationtype SEQUENCING_RUN_NUMBER = 713 new Annotationtype("SequencingRunNumber", Type.INT, Item.DERIVEDBIOASSAY); 714 708 715 /** 709 716 The "SequencingOperator" annotation, used for derived bioassays (SequencingRun). … … 712 719 public static final Annotationtype SEQUENCING_OPERATOR = 713 720 new Annotationtype("SequencingOperator", Type.STRING, Item.DERIVEDBIOASSAY); 721 722 /** 723 The "DataFilesFolder" annotation, used for derived bioassays that 724 are linked with data files on the server. 725 @since 2.15 726 */ 727 public static final Annotationtype DATA_FILES_FOLDER = 728 new Annotationtype("DataFilesFolder", Type.STRING, Item.DERIVEDBIOASSAY); 714 729 715 730 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/PooledLibrary.java
r2094 r2224 60 60 public static final String FLAG_CLUSTERING_FAILED = "ClusteringFailed"; 61 61 62 /** 63 Flag value for the {@link Annotationtype#FLAG} annotation when sequencing 64 a pooled library failed. This flag is normally attached to 'PooledLibrary' 65 items, but may be found on RNA items if the pool runs out of biomaterial. 66 @since 2.15 67 */ 68 public static final String FLAG_SEQUENCING_FAILED = "SequencingFailed"; 62 69 63 70 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SequencingRun.java
r2197 r2224 35 35 } 36 36 37 38 public static List<SequencingRun> findByFlowCell(DbControl dc, FlowCell fc) 39 { 40 ItemQuery<DerivedBioAssay> query = fc.getItem().getRootDerivedBioAssays(); 41 Subtype.SEQUENCING_RUN.addFilter(dc, query); 42 query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); 43 query.order(Orders.asc(Hql.property("name"))); 44 return toList(query.list(dc)); 45 } 37 46 38 47 public static List<SequencingRun> toList(Collection<DerivedBioAssay> bioassays) -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java
r2222 r2224 24 24 import net.sf.basedb.core.BioMaterialList; 25 25 import net.sf.basedb.core.DbControl; 26 import net.sf.basedb.core.DerivedBioAssay;27 26 import net.sf.basedb.core.Extract; 28 27 import net.sf.basedb.core.Hardware; … … 404 403 boolean failed = Boolean.TRUE.equals(jsonReq.get("failed")); 405 404 406 // Sequencing start -- only if not failed407 DerivedBioAssay sequenceRun = null;408 405 BioMaterialList flaggedPools = null; 409 406 Set<Extract> pools = null; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r2196 r2224 285 285 Rna.FLAG_MRNA_PLATE_FAILED, Rna.FLAG_CDNA_PLATE_FAILED, Rna.FLAG_LIB_PLATE_FAILED, 286 286 Rna.FLAG_EXCLUDED_FROM_POOL, 287 PooledLibrary.FLAG_CLUSTERING_FAILED ),287 PooledLibrary.FLAG_CLUSTERING_FAILED, PooledLibrary.FLAG_SEQUENCING_FAILED), 288 288 effectivePermissionsUse, createIfMissing)); 289 289 jsonChecks.add(checkAnnotationType(dc, Annotationtype.AUTO_PROCESSING, 1, … … 330 330 jsonChecks.add(checkAnnotationType(dc, Annotationtype.READ_STRING, 1, null, effectivePermissionsUse, createIfMissing)); 331 331 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_CYCLES, 1, null, effectivePermissionsUse, createIfMissing)); 332 333 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_START, 1, null, effectivePermissionsUse, createIfMissing)); 334 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_TURN_AROUND, 1, null, effectivePermissionsUse, createIfMissing)); 335 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_END, 1, null, effectivePermissionsUse, createIfMissing)); 336 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_RUN_NUMBER, 1, null, effectivePermissionsUse, createIfMissing)); 337 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_OPERATOR, 1, null, effectivePermissionsUse, createIfMissing)); 332 338 jsonChecks.add(checkAnnotationType(dc, Annotationtype.HISEQ_POSITION, 1, 333 339 new ValueOptions("A", "B"), 334 340 effectivePermissionsUse, createIfMissing)); 335 336 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_START, 1, null, effectivePermissionsUse, createIfMissing)); 337 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_TURN_AROUND, 1, null, effectivePermissionsUse, createIfMissing)); 338 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_END, 1, null, effectivePermissionsUse, createIfMissing)); 339 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_OPERATOR, 1, null, effectivePermissionsUse, createIfMissing)); 341 jsonChecks.add(checkAnnotationType(dc, Annotationtype.DATA_FILES_FOLDER, 1, null, effectivePermissionsUse, createIfMissing)); 340 342 341 343 // Annotation type categories … … 421 423 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.FLOW_CELL, createIfMissing, 422 424 Annotationtype.FLOWCELL_ID, Annotationtype.CLUSTER_START, Annotationtype.CLUSTER_OPERATOR, 423 Annotationtype.SEQUENCING_CYCLES, Annotationtype.HISEQ_POSITION, 424 Annotationtype.PLATE_PROCESS_RESULT)); 425 Annotationtype.SEQUENCING_CYCLES, Annotationtype.PLATE_PROCESS_RESULT)); 425 426 426 427 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.SEQUENCING_RUN, createIfMissing, 427 428 Annotationtype.SEQUENCING_START, Annotationtype.SEQUENCING_TURN_AROUND, Annotationtype.SEQUENCING_END, 428 Annotationtype.SEQUENCING_OPERATOR 429 Annotationtype.SEQUENCING_OPERATOR, Annotationtype.SEQUENCING_RUN_NUMBER, Annotationtype.SEQUENCING_CYCLES, 430 Annotationtype.HISEQ_POSITION, Annotationtype.DATA_FILES_FOLDER 429 431 )); 430 432 … … 678 680 { 679 681 json.put("status", "incomplete"); 680 jsonMessages.add("Doesn't have all options: " + valueOptions.getList() );682 jsonMessages.add("Doesn't have all options: " + valueOptions.getList() + "!=" + at.getValues()); 681 683 } 682 684 } … … 1076 1078 1077 1079 /** 1078 We need to do this in a separate transaction.1079 @since 2.01080 */1081 public void addAnnotionTypeToCategory(SessionControl sc, AnnotationType annotationType, AnnotationTypeCategory category)1082 {1083 DbControl dc = sc.newDbControl();1084 try1085 {1086 annotationType = AnnotationType.getById(dc, annotationType.getId());1087 category = AnnotationTypeCategory.getById(dc, category.getId());1088 annotationType.addCategory(category);1089 dc.commit();1090 }1091 finally1092 {1093 if (dc != null) dc.close();1094 }1095 }1096 1097 /**1098 1080 Check for an existing annotation type category. 1099 1081 A JSONObject is returned with the result. The following … … 1131 1113 { 1132 1114 AnnotationType at = annotationType.load(dc); 1133 if (at != null) 1134 { 1135 at.addCategory(cat); 1136 } 1115 at.addCategory(cat); 1137 1116 } 1138 1117 } … … 1169 1148 if (createIfMissing) 1170 1149 { 1171 a ddAnnotionTypeToCategory(dc.getSessionControl(), at,cat);1150 at.addCategory(cat); 1172 1151 if (jsonMessages.size() == 0) jsonMessages.add("Fixed"); 1173 1152 } … … 1959 1938 for (Object opt : options) 1960 1939 { 1940 System.out.println(opt+":"+values.contains(opt)); 1961 1941 if (!values.contains(opt)) values.add(opt); 1962 1942 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SequencingRunServlet.java
r2197 r2224 17 17 import net.sf.basedb.core.DbControl; 18 18 import net.sf.basedb.core.DerivedBioAssay; 19 import net.sf.basedb.core.Hardware; 19 20 import net.sf.basedb.core.ItemQuery; 20 21 import net.sf.basedb.core.PhysicalBioAssay; 22 import net.sf.basedb.core.Protocol; 21 23 import net.sf.basedb.core.SessionControl; 22 24 import net.sf.basedb.core.query.Annotations; … … 29 31 import net.sf.basedb.reggie.dao.SequencingRun; 30 32 import net.sf.basedb.reggie.dao.Subtype; 33 import net.sf.basedb.util.Values; 31 34 import net.sf.basedb.util.error.ThrowableUtil; 32 35 … … 111 114 json.put("sequencingRuns", jsonRuns); 112 115 } 116 else if ("GetSequencingRunsForFlowCell".equals(cmd)) 117 { 118 dc = sc.newDbControl(); 119 int flowCellId = Values.getInt(req.getParameter("flowCell")); 120 121 FlowCell flowCell = FlowCell.getById(dc, flowCellId); 122 List<SequencingRun> seqRuns = SequencingRun.findByFlowCell(dc, flowCell); 123 JSONArray jsonSeqRuns = new JSONArray(); 124 for (SequencingRun seqRun : seqRuns) 125 { 126 seqRun.loadAnnotations(dc, "SequencingStart", Annotationtype.SEQUENCING_START, Reggie.CONVERTER_DATE_TO_STRING); 127 seqRun.loadAnnotations(dc, "SequencingEnd", Annotationtype.SEQUENCING_END, Reggie.CONVERTER_DATE_TO_STRING); 128 seqRun.loadAnnotations(dc, "DataFilesFolder", Annotationtype.DATA_FILES_FOLDER, null); 129 jsonSeqRuns.add(seqRun.asJSONObject()); 130 } 131 json.put("sequencingRuns", jsonSeqRuns); 132 } 113 133 } 114 134 catch (Throwable t) … … 146 166 try 147 167 { 148 if ("RegisterSequencingEnded".equals(cmd)) 168 if ("RegisterSequencingStarted".equals(cmd)) 169 { 170 dc = sc.newDbControl(); 171 ReggieRole.checkPermission(dc, "'" + cmd + "' wizard", ReggieRole.LIBRARY_PREP, ReggieRole.ADMINISTRATOR); 172 173 JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader()); 174 JSONObject jsonSeq = (JSONObject)jsonReq.get("sequencingRun"); 175 JSONObject jsonFlowCell = (JSONObject)jsonReq.get("flowCell"); 176 JSONObject jsonRunParameters = (JSONObject)jsonReq.get("runParameters"); 177 178 Number sequencerId = (Number)jsonSeq.get("sequencer"); 179 Hardware sequencer = sequencerId == null ? null : Hardware.getById(dc, sequencerId.intValue()); 180 Number protocolId = (Number)jsonSeq.get("protocol"); 181 Protocol protocol = protocolId == null ? null : Protocol.getById(dc, protocolId.intValue()); 182 String sequencingComments = Values.getStringOrNull((String)jsonSeq.get("comments")); 183 String sequencingOperator = Values.getStringOrNull((String)jsonSeq.get("operator")); 184 Date startDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonRunParameters.get("SequencingStart")); 185 186 // Create new SequencingRun item 187 DerivedBioAssay sequenceRun = DerivedBioAssay.getNew(dc, true, null); 188 sequenceRun.setItemSubtype(Subtype.SEQUENCING_RUN.get(dc)); 189 sequenceRun.setName(SequencingRun.generateNamesForBatch(dc, 1, 1).get(0)); 190 sequenceRun.setDescription(sequencingComments); 191 sequenceRun.setHardware(sequencer); 192 sequenceRun.setProtocol(protocol); 193 dc.saveItem(sequenceRun); 194 Annotationtype.SEQUENCING_OPERATOR.setAnnotationValue(dc, sequenceRun, sequencingOperator); 195 196 // Link to FlowCell 197 Number flowCellId = (Number)jsonFlowCell.get("id"); 198 PhysicalBioAssay flowCell = PhysicalBioAssay.getById(dc, flowCellId.intValue()); 199 sequenceRun.addPhysicalBioAssay(flowCell); 200 201 // Set run parameters 202 Annotationtype.HISEQ_POSITION.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("HiSeqPosition")); 203 Annotationtype.SEQUENCING_START.setAnnotationValue(dc, sequenceRun, startDate); 204 Annotationtype.SEQUENCING_RUN_NUMBER.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("ScanNumber")); 205 Annotationtype.SEQUENCING_CYCLES.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("SequencingCycles")); 206 Annotationtype.DATA_FILES_FOLDER.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("RunID")); 207 dc.commit(); 208 209 jsonMessages.add("Sequencing started for flow cell '" + flowCell.getName() + "': " + sequenceRun.getName()); 210 211 } 212 else if ("RegisterSequencingEnded".equals(cmd)) 149 213 { 150 214 dc = sc.newDbControl();
Note: See TracChangeset
for help on using the changeset viewer.