Changeset 2137
- Timestamp:
- Nov 13, 2013, 3:53:05 PM (9 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/libprep/create_pools.jsp
r2053 r2137 96 96 } 97 97 return response.bioplates; 98 } 99 100 function createManualPool() 101 { 102 location.replace('create_manual_pool.jsp?ID=<%=ID%>'); 98 103 } 99 104 … … 874 879 </tr> 875 880 <tr valign="top"> 876 <td class="prompt">Manual select</td> 877 <td class="input"> // TODO</td> 881 <td class="prompt"></td> 882 <td class="input"> 883 <table><tr><td> 884 <base:button title="Create manual pool" onclick="createManualPool()" image="<%=home+"/images/gonext.png"%>" /> 885 </td></tr></table> 886 887 </td> 878 888 <td class="status"></td> 879 889 <td class="help"></td> -
extensions/net.sf.basedb.reggie/trunk/resources/libprep/pools.js
r2053 r2137 307 307 pm.calculateLibVolume = function(lib, targetMolarity, targetVolume, mixingStrategy) 308 308 { 309 var maxVolume = lib. speedVacConc != null ? AVAILABLE_VOLUME_AFTER_SPEEDVAC : AVAILABLE_VOLUME;309 var maxVolume = lib.remainingVolume; 310 310 if (mixingStrategy == 'fixed' && maxVolume > targetVolume) 311 311 { … … 387 387 // Calculate the total volume needed to get to the 388 388 // target molarity for the pooled libs 389 var totalPoolVolume = totalLibAmount / targetMolarity; 390 var totalEbVolume = totalPoolVolume - totalLibVolume - fixedEbVolume; 389 // Round all summarized values to avoid precision problems (eg. 4.0 --> 3.999999998) 390 var totalPoolVolume = pm.round(totalLibAmount / targetMolarity); 391 totalLibVolume = pm.round(totalLibVolume); 392 fixedEbVolume = pm.round(fixedEbVolume); 393 var totalEbVolume = pm.round(totalPoolVolume - totalLibVolume - fixedEbVolume); 391 394 392 395 // Divide EB volume among the libs (rounded to 1 decimal) … … 405 408 } 406 409 410 usedEb = pm.round(usedEb); 411 407 412 // If the used EB doesn't add up to the total amount needed (due to rounding) 408 413 // add the extra amount to the last lib 409 if (Math.abs(totalEbVolume - usedEb) > 0.1&& adjustableLib)414 if (Math.abs(totalEbVolume - usedEb) >= 0.05 && adjustableLib) 410 415 { 411 416 adjustableLib.eb += totalEbVolume - usedEb; … … 427 432 var lib = libs[libNo]; 428 433 var vol = lib.maxVolume < lib.volume ? lib.maxVolume : lib.volume; 429 var eb = Math.max(0, lib.eb);430 434 libVolume += vol; 431 ebVolume += eb;435 ebVolume += lib.eb; 432 436 if (mixingStrategy == 'dynamic' && (!lib.mixFactor || lib.mixFactor == 1)) 433 437 { 434 ebFinalMix += eb;438 ebFinalMix += lib.eb; 435 439 } 436 440 libAmount += vol * lib.molarity; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PoolServlet.java
r2104 r2137 184 184 185 185 } 186 else if ("GetLibraryInfo".equals(cmd)) 187 { 188 // Get information about a single library 189 int libId = Values.getInt(req.getParameter("libraryId")); 190 dc = sc.newDbControl(); 191 192 Library lib = Library.getById(dc, libId); 193 lib.loadBioPlateLocation(); 194 addPoolingCalculationsToLib(dc, lib, null); 195 lib.setAnnotation("comment", lib.getExtract().getDescription()); 196 197 json.put("library", lib.asJSONObject()); 198 199 } 186 200 else if ("GetLibraryInfoForPlate".equals(cmd)) 187 201 { … … 208 222 { 209 223 lib.loadBioPlateLocation(); 210 addPoolingCalculationsToLib(dc, lib, null , libs.size());224 addPoolingCalculationsToLib(dc, lib, null); 211 225 lib.setAnnotation("comment", lib.getExtract().getDescription()); 212 226 jsonLibs.add(lib.asJSONObject()); … … 230 244 int numNames = Values.getInt(req.getParameter("numNames")); 231 245 json.put("names", PooledLibrary.generateNamesForBatch(dc, 1, numNames)); 246 JSONObject poolInfo = new JSONObject(); 247 poolInfo.put("targetMolarity", TARGET_MOLARITY_IN_POOL); 248 poolInfo.put("targetVolumePerLib", DEFAULT_TARGET_VOLUME_IN_POOL_PER_LIB); 249 poolInfo.put("extraLargeMixFactor", EXTRA_LARGE_MIX_FACTOR); 250 poolInfo.put("limitForExtraLargeMix", LIMIT_FOR_EXTRA_LARGE_MIX); 251 json.put("poolInfo", poolInfo); 232 252 } 233 253 else if ("CountUnprocessedPools".equals(cmd)) … … 283 303 { 284 304 lib.loadBioPlateLocation(); 285 addPoolingCalculationsToLib(dc, lib, pool , libs.size());305 addPoolingCalculationsToLib(dc, lib, pool); 286 306 lib.setAnnotation("comment", lib.getExtract().getDescription()); 287 307 jsonLibs.add(lib.asJSONObject()); … … 597 617 598 618 599 private void addPoolingCalculationsToLib(DbControl dc, Library lib, PooledLibrary pool , int numLibs)619 private void addPoolingCalculationsToLib(DbControl dc, Library lib, PooledLibrary pool) 600 620 { 601 621 // Load original and SpeedVac:ed concentrations … … 612 632 613 633 // Load remaining quantity of the lib 614 lib.setAnnotation("remainingQuantity", libEx.getRemainingQuantity()); 634 Float remain = libEx.getRemainingQuantity(); 635 lib.setAnnotation("remainingQuantity", remain); 636 if (remain != null && (originalConc != null || speedVacConc != null)) 637 { 638 // Remaining volume in µl 639 Float conc = speedVacConc == null ? originalConc : speedVacConc; 640 lib.setAnnotation("remainingVolume", 1000 * remain / conc); 641 } 615 642 616 643 if (pool != null) … … 642 669 } 643 670 671 644 672 @SuppressWarnings("unchecked") 645 673 private JSONObject getJSONForLibPlate(DbControl dc, BioPlate libPlate)
Note: See TracChangeset
for help on using the changeset viewer.