Changeset 1975
- Timestamp:
- May 15, 2013, 1:20:50 PM (10 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/libprep/create_pools.jsp
r1972 r1975 146 146 tmp.volume = lib.volume; 147 147 tmp.eb = lib.eb; 148 tmp. extraMixFactor = lib.extraMixFactor;148 tmp.mixFactor = lib.mixFactor; 149 149 poolInfo.libs[poolInfo.libs.length] = tmp; 150 150 } … … 315 315 } 316 316 317 if (lib. extraMixFactor)317 if (lib.mixFactor > 1.001) 318 318 { 319 319 // Larger mix than default 320 var mixedVolume = (lib.volume+lib.eb)*( 1+lib.extraMixFactor);320 var mixedVolume = (lib.volume+lib.eb)*(lib.mixFactor); 321 321 remarks[remarks.length] = 'Mix ' + Numbers.formatNumber(mixedVolume, 0) + 'µl'; 322 322 } … … 353 353 if (lib) 354 354 { 355 poolMolarity += Math.min(lib.molarity, TARGET_MOLARITY_IN_POOL);355 poolMolarity += Math.min(lib.molarity, lib.mixMolarity); 356 356 poolVolume += TARGET_VOLUME_IN_POOL_PER_LIB; 357 357 numLibs++; … … 392 392 var name = lib.name; 393 393 var i = name.indexOf('.m'); 394 var mixFactor = 1+lib.extraMixFactor;394 var mixFactor = lib.mixFactor; 395 395 var displayName = name.substring(0, i)+'.<br> '+name.substring(i); 396 396 text += '<div class="lib">'+displayName+'</div>'; 397 397 text += '<span class="barcode">'+lib.barcode.name+'</span>'; 398 398 text += '<span class="molarity">'+Numbers.formatNumber(lib.molarity, 2)+'nM</span>'; 399 text += '<span class="volume">'+Numbers.formatNumber(lib.volume*mixFactor, 2) + 'µl</span>';400 text += '<span class="eb">'+Numbers.formatNumber(lib.eb*mixFactor, 2)+'µl</span>';399 text += '<span class="volume">'+Numbers.formatNumber(lib.volume*mixFactor, 1) + 'µl</span>'; 400 text += '<span class="eb">'+Numbers.formatNumber(lib.eb*mixFactor, 1)+'µl</span>'; 401 401 text += '<div class="remarks">'+ lib.remarks.join('; ') + '</div>'; 402 402 } -
extensions/net.sf.basedb.reggie/trunk/resources/libprep/pool_protocol2.jsp
r1965 r1975 212 212 } 213 213 214 if (lib. extraMixFactor)214 if (lib.mixFactor > 1.001) 215 215 { 216 216 // Larger mix than default 217 var mixedVolume = (lib.volume+lib.eb)*( 1+lib.extraMixFactor);217 var mixedVolume = (lib.volume+lib.eb)*(lib.mixFactor); 218 218 remarks[remarks.length] = 'Mix ' + Numbers.formatNumber(mixedVolume, 0) + 'µl'; 219 219 } … … 266 266 } 267 267 268 addColumn(tr, "lib", lib.name);269 addColumn(tr, "remain", Numbers.formatNumber((lib.remainingQuantity+lib.usedQuantity)*1000, 2));270 addColumn(tr, "molarity", Numbers.formatNumber(lib.molarity, 2));268 addColumn(tr, 'lib', lib.name); 269 addColumn(tr, 'remain', Numbers.formatNumber((lib.remainingQuantity+lib.usedQuantity)*1000, 2)); 270 addColumn(tr, 'molarity', Numbers.formatNumber(lib.molarity, 2)); 271 271 <% 272 272 if (libPlate==null) 273 273 { 274 274 %> 275 addColumn(tr, "workplate", well.bioPlate.name + ' ' + well.location);275 addColumn(tr, 'workplate', well.bioPlate.name + ' ' + well.location); 276 276 <% 277 277 } … … 279 279 { 280 280 %> 281 addColumn(tr, "workplate", well.location);281 addColumn(tr, 'workplate', well.location); 282 282 <% 283 283 } 284 284 %> 285 var mixFactor = 1+(lib.extraMixFactor || 0); 286 addColumn(tr, "mix", '<span class="volume">'+Numbers.formatNumber(lib.volume*mixFactor, 2)+'</span>+<span class="eb">'+Numbers.formatNumber(lib.eb*mixFactor, 2)+'</span>'); 285 var mixFactor = lib.mixFactor || 1.0; 286 addColumn(tr, 'volume', Numbers.formatNumber(lib.volume*mixFactor, 1)); 287 addColumn(tr, 'eb', Numbers.formatNumber(lib.eb*mixFactor, 1)); 287 288 addColumn(tr, "remarks", lib.remarks.join('; ')); 288 289 tbody.appendChild(tr); … … 296 297 function addColumn(tr, className, html) 297 298 { 298 299 299 var td = document.createElement('td'); 300 300 td.className = className; 301 301 td.innerHTML = html; 302 302 tr.appendChild(td); 303 304 303 } 305 304 … … 308 307 Plate.init(8, 12, schema, WellPainter); 309 308 310 for (var i = 0; i < pools.length; i++)311 { 312 var pool = pools[ i];313 POOL_NAMES[ i] = pool.name;314 for (var j = 0; j < pool.libraries.length; j++)315 { 316 var lib = pool.libraries[ j];309 for (var poolNo = 0; poolNo < pools.length; poolNo++) 310 { 311 var pool = pools[poolNo]; 312 POOL_NAMES[poolNo] = pool.name; 313 for (var libNo = 0; libNo < pool.libraries.length; libNo++) 314 { 315 var lib = pool.libraries[libNo]; 317 316 var well = lib.bioWell; 318 317 Plate.getWell(well.row, well.column).setExtract(lib); … … 324 323 PoolSchema.buildPoolTableRow(schema, 12); 325 324 Main.show('plateview'); 325 326 327 for (var poolNo = 0; poolNo < pools.length; poolNo++) 328 { 329 var pool = pools[poolNo]; 330 //setInnerHTML('molarity.'+pool.id, Numbers.formatNumber(pool.molarity, 2) + ' nM; ' + Numbers.formatNumber(1000*pool.originalQuantity / pool.conc, 0)+' µl'); 331 332 var poolData = '<div class="pool-data">'; 333 poolData += Numbers.formatNumber(pool.molarity, 2)+'nM; '; 334 poolData += Numbers.formatNumber(1000*pool.originalQuantity / pool.conc, 0) + 'µl'; 335 poolData += '</div>'; 336 document.getElementById('pool.'+poolNo).innerHTML = POOL_NAMES[poolNo] + poolData; 337 338 } 326 339 } 327 340 … … 349 362 { 350 363 var name = lib.name; 351 var mixFactor = 1+(lib.extraMixFactor || 0);364 var mixFactor = lib.mixFactor || 1.0; 352 365 var i = name.indexOf('.m'); 353 366 text += '<div class="lib">'+name.substring(0, i)+'.<br> '+name.substring(i)+'</div>'; … … 478 491 } 479 492 480 .listview . mix481 { 482 width: 8em;493 .listview .volume 494 { 495 width: 3.5em; 483 496 padding-right: 0.5em; 484 497 text-align: right; 485 }486 487 .listview .empty .mix488 {489 visibility: hidden;490 }491 492 .listview .volume493 {494 498 color: #C80000; 495 padding-right: 3px;496 499 } 497 500 498 501 .listview .eb 499 502 { 503 width: 3.5em; 504 padding-right: 0.5em; 505 text-align: right; 500 506 color: #0000C8; 501 padding-left: 3px;502 507 } 503 508 … … 546 551 color: #C80000; 547 552 font-style: italic; 553 } 554 #plateview .pool-data 555 { 556 font-weight: normal; 548 557 } 549 558 </style> … … 620 629 <th>DNA</th> 621 630 <th class="workplate">Work</th> 622 <th >2nM, 5/10µl</th>631 <th colspan="2">2nM, 5/10µl</th> 623 632 <th></th> 624 633 </tr> … … 629 638 <th class="workplate">plate</th> 630 639 <th>(µl)</th> 640 <th>EB</th> 631 641 <th>Remarks</th> 632 642 </tr> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java
r1953 r1975 156 156 } 157 157 158 /** 159 Round a floating point value to a given number of decimals. 160 @since 2.12 161 */ 162 public static float round(float value, int decimals) 163 { 164 double factor = Math.pow(10, decimals); 165 return (float)(Math.round(factor * value) / factor); 166 } 167 158 168 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PoolServlet.java
r1974 r1975 67 67 68 68 /** 69 Percentage to increase the mixwhen making an extra large mix.70 In the common case 1.0 means mixing 10µl instead of 5µl. But, only69 Factor to apply when making an extra large mix. 70 In the common case 2.0 means mixing 10µl instead of 5µl. But, only 71 71 5µl is used for the pool and the remaining 5µl is saved in a temporary 72 72 location. 73 73 */ 74 private static final float EXTRA_LARGE_MIX_FACTOR = 1.0f;74 private static final float EXTRA_LARGE_MIX_FACTOR = 2.0f; 75 75 76 76 … … 358 358 359 359 // 360 float extraMixFactor = ((Number)jsonLib.get("extraMixFactor")).floatValue();360 float mixFactor = ((Number)jsonLib.get("mixFactor")).floatValue(); 361 361 float usedQuantityForExtra = 0f; 362 if ( extraMixFactor > 0)362 if (mixFactor > 1.001) 363 363 { 364 364 // Create 'dil' extract for keeping track of remaining quantity that has been mixed 365 float usedVolumeForExtra = extraMixFactor* usedVolumeForPool;365 float usedVolumeForExtra = (mixFactor - 1) * usedVolumeForPool; 366 366 usedQuantityForExtra = usedVolumeForExtra * usedConc / 1000; 367 367 Extract dil = Extract.getNew(dc); … … 375 375 dil.setOriginalQuantity(usedQuantityForExtra); 376 376 dc.saveItem(dil); 377 378 //jsonMessages.add("Created " + dil.getName() + "; volume=" + Values.formatNumber(usedVolumeForExtra, 2)); 377 379 } 378 380 379 //jsonMessages.add("Using " + Values.formatNumber(usedQuantityForPool*1000, 2) + "+" + Values.formatNumber(usedQuantityForExtra*1000, 2) +"ng of " + Values.formatNumber(lib.getOriginalQuantity()*1000,2) + "ng from " + lib.getName()+"; molarity="+ molarity);381 //jsonMessages.add("Using " + Values.formatNumber(usedQuantityForPool*1000, 2) + "+" + Values.formatNumber(usedQuantityForExtra*1000, 2) +"ng of " + Values.formatNumber(lib.getOriginalQuantity()*1000,2) + "ng from " + lib.getName()+"; molarity="+Values.formatNumber(molarity, 2) + "(" + Values.formatNumber(molarityForPool, 2) + ")"); 380 382 } 381 383 … … 387 389 jsonMessages.add("Created '" + pool.getName() + "' from " + jsonLibs.size() + " libraries; pool molarity=" + Values.formatNumber(summedPoolMolarity / jsonLibs.size(), 2)); // conc="+Values.formatNumber(poolQuantity * 1000 / poolVolume, 2) + "ng/µl; quantity="+Values.formatNumber(poolQuantity*1000, 2)+"ng; volume="+Values.formatNumber(poolVolume, 2) + "µl"); 388 390 } 391 389 392 dc.commit(); 390 393 } … … 476 479 Float dilQuantity = dil.getOriginalQuantity(); 477 480 //Float dilConc = (Float)Annotationtype.POOL_CONC.getAnnotationValue(dc, dil); 478 lib.setAnnotation(" extraMixFactor", dilQuantity/ usedQuantity);481 lib.setAnnotation("mixFactor", (dilQuantity + usedQuantity) / usedQuantity); 479 482 } 480 483 481 484 lib.setAnnotation("dils", result.size()); 482 483 485 } 484 486 else … … 486 488 // Calculate mix volumes, but do not correct for negative volumes 487 489 // due to low concentration (this will be notified in the protocols) 488 float usedVolumeForMix = TARGET_VOLUME_IN_POOL_PER_LIB * TARGET_MOLARITY_IN_POOL / molarity; 490 // Round to 1 decimal since that is the expected accuracy of pipettes 491 // Remember to use the rounded values in the calculations 492 float usedVolumeForMix = Reggie.round(TARGET_VOLUME_IN_POOL_PER_LIB * TARGET_MOLARITY_IN_POOL / molarity, 1); 493 float mixFactor = 1.0f; 494 if (usedVolumeForMix < LIMIT_FOR_EXTRA_LARGE_MIX) 495 { 496 // Extra large mix is required if the usedVolume is small due to 497 // difficulties to pipette the exact amount for small volumes 498 mixFactor = EXTRA_LARGE_MIX_FACTOR; 499 // Re-calculate volume to get the rounding correct 500 usedVolumeForMix = Reggie.round(mixFactor * TARGET_VOLUME_IN_POOL_PER_LIB * TARGET_MOLARITY_IN_POOL / molarity, 1) / mixFactor; 501 } 502 489 503 float ebVolumeForMix = TARGET_VOLUME_IN_POOL_PER_LIB - usedVolumeForMix; 490 504 lib.setAnnotation("volume", usedVolumeForMix); 491 505 lib.setAnnotation("eb", ebVolumeForMix); 492 // Extra large mix is required if the usedVolume is small due to 493 // difficulties to pipette the exact amount for small volumes 494 lib.setAnnotation("extraMixFactor", usedVolumeForMix < LIMIT_FOR_EXTRA_LARGE_MIX ? EXTRA_LARGE_MIX_FACTOR : 0); 506 lib.setAnnotation("mixMolarity", molarity * usedVolumeForMix / TARGET_VOLUME_IN_POOL_PER_LIB); 507 lib.setAnnotation("mixFactor", mixFactor); 495 508 } 496 509 }
Note: See TracChangeset
for help on using the changeset viewer.