Changeset 3833


Ignore:
Timestamp:
Apr 8, 2016, 9:22:12 AM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #875: Soft and hard target amount for NeoPrep?

Added LibPrepTarget target annotation. This MUST be set on normalization protocols to specify if they are for Manual or NeoPrep.

This makes it possible to get rid of all almost all hard-coded target volumes/amounts in the other wizards. The "Auto-select" and "Auto-design" functions have been updated to only use the information from the protocols.

NOTE! When updating to this Reggie version it is recommended that there are no mRNA/Library plates in progress, since it is not certain that the calculations when printing lab protocols will be correct if the mRNA/Library plate was created with the old Reggie version.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/auto_select_rna.js

    r3832 r3833  
    1717    Events.addEventHandler('preNormalized.1', 'click', autoselect.setPreNormalize);
    1818   
     19    var isNeoPrep = Data.int('page-data', 'is-neoprep');
    1920    Events.addEventHandler('normalizationProtocol', 'change', autoselect.protocolOnChange);
    20     Reggie.loadProtocols('RNA_NORMALIZATION_PROTOCOL', 'normalizationProtocol', 'RNA_TARGET_AMOUNT,RNA_MINIMAL_AMOUNT,RNA_TARGET_VOLUME');
     21    Reggie.loadProtocols('RNA_NORMALIZATION_PROTOCOL', 'normalizationProtocol', 'LIBPREP_TARGET,RNA_TARGET_AMOUNT,RNA_MINIMAL_AMOUNT,RNA_TARGET_VOLUME', isNeoPrep ? 'NeoPrep' : 'Manual');
    2122    autoselect.setPreNormalize();
    2223  }
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/auto_select_rna.jsp

    r3832 r3833  
    2525  final String title = "Options for auto-selecting RNA";
    2626 
     27  boolean isNeoPrep = Values.getBoolean(request.getParameter("neoprep"));
    2728  String protocolId = request.getParameter("protocol");
    2829  String requiredQuantity = request.getParameter("quantity");
     
    4445    data-ignore="[<%=HTML.encodeTags(ignore)%>]"
    4546    data-protocol-id="<%=HTML.encodeTags(protocolId)%>"
     47    data-is-neoprep="<%=isNeoPrep ? 1 : 0%>"
    4648  ></div>
    4749
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/mrna_protocol.js

    r3832 r3833  
    163163    rna.external = Reggie.isExternal(rna.name);
    164164    rna.isYellow = rna.specimen && rna.specimen.YellowLabel != null;
    165     if (!lib.DilutionVolume) lib.DilutionVolume = DEFAULT_DILUTION_VOLUME;
     165    if (!mrna.DilutionVolume) mrna.DilutionVolume = DEFAULT_DILUTION_VOLUME;
    166166   
    167167    // Set the 'QC' flag
     
    178178    {
    179179      rna.volume = Math.ceil(10000*rna.usedQuantity/rna.NDConc) / 10; // µl
    180       if (rna.preNormalized)
    181       {
    182         rna.water = 0;
    183       }
    184       else
    185       {
    186         var totalVolume = mrna.DilutionConc ? 1000 * rna.usedQuantity / mrna.DilutionConc : lib.DilutionVolume;
    187         rna.water = totalVolume-rna.volume;
    188         if (totalVolume > lib.DilutionVolume)
    189         {
    190           remarks[remarks.length] = 'Large mix; Use '+Reggie.formatNumber(lib.DilutionVolume, 'µl', 1);
    191         }
    192       }
     180     
     181      var totalVolume = mrna.DilutionConc ? 1000 * rna.usedQuantity / mrna.DilutionConc : mrna.DilutionVolume;
     182      if (totalVolume < mrna.DilutionVolume)
     183      {
     184        totalVolume = mrna.DilutionVolume;
     185      }
     186      else if (totalVolume > mrna.DilutionVolume)
     187      {
     188        remarks[remarks.length] = 'Large mix; Use '+Reggie.formatNumber(mrna.DilutionVolume, 'µl', 1);
     189      }
     190      rna.water = totalVolume-rna.volume;
    193191    }
    194192   
     
    271269      Doc.element('remain.'+idSuffix).innerHTML = Numbers.formatNumber(rna.remainingQuantity, 2);
    272270      Doc.element('volume.'+idSuffix).innerHTML = Numbers.formatNumber(rna.volume, 1);
    273       Doc.element('water.'+idSuffix).innerHTML = rna.preNormalized ? '—' : Numbers.formatNumber(rna.water, 1);
     271      Doc.element('water.'+idSuffix).innerHTML = rna.water > 0 ? Numbers.formatNumber(rna.water, 1) : '—';
    274272      Doc.element('remarks.'+idSuffix).innerHTML = rna.remarks.join('; ');
    275273    }
     
    340338      {
    341339        text += '<div><span class="volume">'+Numbers.formatNumber(rna.volume, 1)+'µl</span>';
    342         text += '<span class="water">'+(rna.preNormalized ? '—' : Numbers.formatNumber(rna.water, 1)+'µl')+'</span></div>';
     340        text += '<span class="water">'+(rna.water > 0 ? Numbers.formatNumber(rna.water, 1)+'µl' : '—')+'</span></div>';
    343341      }
    344342      text += '<div class="remarks">'+ rna.remarks.join('; ') + '</div>';
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/neoprep_protocol.js

    r3832 r3833  
    260260    {
    261261      rna.volume = Math.ceil(10000*rna.usedQuantity/rna.NDConc) / 10; // µl
    262       if (rna.preNormalized)
    263       {
    264         rna.water = 0;
    265       }
    266       else
    267       {
    268         var totalVolume = lib.DilutionConc ? 1000 * rna.usedQuantity / lib.DilutionConc : lib.DilutionVolume;
    269         rna.water = totalVolume-rna.volume;
    270         if (totalVolume > lib.DilutionVolume)
    271         {
    272           remarks[remarks.length] = 'Large mix; Use '+Reggie.formatNumber(lib.DilutionVolume, 'µl', 1);
    273         }
    274       }
     262     
     263      var totalVolume = lib.DilutionConc ? 1000 * rna.usedQuantity / lib.DilutionConc : lib.DilutionVolume;
     264      if (totalVolume < lib.DilutionVolume)
     265      {
     266        totalVolume = lib.DilutionVolume;
     267      }
     268      else if (totalVolume > lib.DilutionVolume)
     269      {
     270        remarks[remarks.length] = 'Large mix; Use '+Reggie.formatNumber(lib.DilutionVolume, 'µl', 1);
     271      }
     272      rna.water = totalVolume-rna.volume;
    275273    }
    276274   
     
    373371      Doc.element('remain.'+idSuffix).innerHTML = Numbers.formatNumber(rna.remainingQuantity, 2);
    374372      Doc.element('volume.'+idSuffix).innerHTML = Numbers.formatNumber(rna.volume, 1);
    375       Doc.element('water.'+idSuffix).innerHTML = rna.preNormalized ? '—' : Numbers.formatNumber(rna.water, 1);
     373      Doc.element('water.'+idSuffix).innerHTML = rna.water > 0 ? Numbers.formatNumber(rna.water, 1) : '—';
    376374      Doc.element('barcode.'+idSuffix).innerHTML = Strings.encodeTags(lib.barcode.name);
    377375     
     
    451449      {
    452450        text += '<div><span class="volume">'+Numbers.formatNumber(rna.volume, 1)+'µl</span>';
    453         text += '<span class="water">'+(rna.preNormalized ? '—' : Numbers.formatNumber(rna.water, 1)+'µl')+'</span></div>';
     451        text += '<span class="water">'+(rna.water > 0 ? Numbers.formatNumber(rna.water, 1)+'µl' : '—')+'</span></div>';
    454452      }
    455453      text += '<div class="remarks">'+ rna.remarks.join('; ') + '</div>';
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/select_rna.js

    r3832 r3833  
    109109      QUANTITY_QC = QUANTITY_REGULAR;
    110110    }
    111    
    112     Reggie.loadProtocols('RNA_NORMALIZATION_PROTOCOL', 'normalizationProtocol', 'RNA_TARGET_AMOUNT,RNA_MINIMAL_AMOUNT,RNA_TARGET_VOLUME');
     111
     112    Reggie.loadProtocols('RNA_NORMALIZATION_PROTOCOL', 'normalizationProtocol', 'LIBPREP_TARGET,RNA_TARGET_AMOUNT,RNA_MINIMAL_AMOUNT,RNA_TARGET_VOLUME', isNeoPrep ? 'NeoPrep' : 'Manual');
     113  }
     114 
     115  selectrna.initProtocols = function()
     116  {
     117    var frm = document.forms['reggie'];
     118    hasInitProtocols = true;
     119   
     120    if (frm.normalizationProtocol.length == 0)
     121    {
     122      Wizard.setFatalError('No RNA dilution protocols found. Please ask the server administrator to create at least one protocol.');
     123      return;
     124    }
     125   
     126    for (var i=0; i < frm.normalizationProtocol.length; i++)
     127    {
     128      var p = frm.normalizationProtocol[i].item;
     129     
     130      var unit = 'µg';
     131      var factor = 1;
     132      if (p.RNATargetAmount < 0.5)
     133      {
     134        unit = 'ng';
     135        factor = 1000;
     136      }
     137     
     138      var text = p.name + ' (';
     139      if (p.RNAMinimalAmount) text += Reggie.formatNumber(p.RNAMinimalAmount * factor, '', 1) + '-';
     140      text += p.RNATargetAmount ? Reggie.formatNumber(p.RNATargetAmount * factor, '', 1) : '? ';
     141      text += unit;
     142      text += ' in '+(p.RNATargetVolume || '? ')+'µl)';
     143      frm.normalizationProtocol[i].text = text;
     144    }
     145   
     146    if (autoDesign) frm.normalizationProtocol.disabled = true;
     147    var isNeoPrep = Data.int('page-data', 'is-neoprep');
    113148
    114149    var url = '../MRna.servlet?ID='+App.getSessionId();
     
    130165  }
    131166
     167 
    132168  selectrna.stratageneLoaded = function(response)
    133169  {
     
    145181      frm.stratagene[frm.stratagene.length] = new Option(name, s.name);
    146182    }
    147 
     183   
    148184    var url = '../LibPrep.servlet?ID='+App.getSessionId();
    149185    url += '&cmd=GetAllBarcodeInfo';
    150186    Wizard.asyncJsonRequest(url, selectrna.barcodesLoaded);
    151187  }
    152  
    153188
    154189  selectrna.barcodesLoaded = function(response)
     
    192227      url += '&cmd=GetRNAForAutoDesign&numToSelect='+wells.length;
    193228      url += '&neoprep='+isNeoPrep;
     229      url += '&protocol='+frm.normalizationProtocol.value;
    194230      Wizard.showLoadingAnimation('Finding RNA. Please wait...');
    195231      Wizard.asyncJsonRequest(url, selectrna.rnaAutoDesignSelected);
     
    246282  {
    247283    var frm = document.forms['reggie'];
    248 
    249     if (!hasInitProtocols)
    250     {
    251       hasInitProtocols = true;
    252      
    253       if (frm.normalizationProtocol.length == 0)
    254       {
    255         Wizard.setFatalError('No RNA dilution protocols found. Please ask the server administrator to create at least one protocol.');
    256         return;
    257       }
    258      
    259       var closestAlternateProtocolIndex = -1;
    260       var closestRnaAmount = 999;
    261       for (var i=0; i < frm.normalizationProtocol.length; i++)
    262       {
    263         var p = frm.normalizationProtocol[i].item;
    264        
    265         var unit = 'µg';
    266         var factor = 1;
    267         if (p.RNATargetAmount < 0.5)
    268         {
    269           unit = 'ng';
    270           factor = 1000;
    271         }
    272        
    273         var text = p.name + ' (';
    274         if (p.RNAMinimalAmount) text += Reggie.formatNumber(p.RNAMinimalAmount * factor, '', 1) + '-';
    275         text += p.RNATargetAmount ? Reggie.formatNumber(p.RNATargetAmount * factor, '', 1) : '? ';
    276         text += unit;
    277         text += ' in '+(p.RNATargetVolume || '? ')+'µl)';
    278         frm.normalizationProtocol[i].text = text;
    279        
    280         // Adjust default selected protocol to match the expected RNA amount
    281         // The protocol must be an alternate project default and have a RNATargetAmount value
    282         if (p.alternateDefault && p.RNATargetAmount)
    283         {
    284           var tmp = Math.abs(QUANTITY_REGULAR-p.RNATargetAmount);
    285           if (tmp < closestRnaAmount)
    286           {
    287             closestRnaAmount = tmp;
    288             closestAlternateProtocolIndex = i;
    289           }
    290         }
    291       }
    292      
    293       if (closestAlternateProtocolIndex != -1)
    294       {
    295         frm.normalizationProtocol.selectedIndex = closestAlternateProtocolIndex;
    296       }
    297      
    298       if (autoDesign) frm.normalizationProtocol.disabled = true;
    299     }
     284    if (!hasInitProtocols) selectrna.initProtocols();
    300285
    301286    var protocol = frm.normalizationProtocol[frm.normalizationProtocol.selectedIndex].item;
     
    595580  selectrna.autoSelect = function(event)
    596581  {
     582    var isNeoPrep = Data.int('page-data', 'is-neoprep');
    597583    var frm = document.forms['reggie'];
    598584    var wells = Plate.getWells();
     
    640626    url += '&numToSelect='+selected.length;
    641627    url += '&protocol='+frm.normalizationProtocol.value;
     628    url += '&neoprep='+(isNeoPrep ? 1 : 0);
    642629    url += '&quantity='+encodeURIComponent(QUANTITY_REGULAR);
    643630    url += '&ignore='+ignore.join(',');
     
    17321719        else if (volRNA > TOTAL_VOLUME)
    17331720        {
    1734           volRNA = TOTAL_VOLUME;
     1721          volRNA = Math.min(TOTAL_VOLUME, 1000 * info.remainingQuantity / info.NDConc);
    17351722          rna.usedQuantity = volRNA * info.NDConc / 1000; // µg
    17361723          rna.dilutionConc = info.NDConc;
    1737           water = 0;
     1724          water = TOTAL_VOLUME - volRNA;
    17381725        }
    17391726       
     
    17421729          var useNanoGram = info.remainingQuantity < 0.5;
    17431730          text += '<div class="quantity">'+(useNanoGram ? Reggie.formatNumber(info.remainingQuantity * 1000, 'ng', 1):Reggie.formatNumber(info.remainingQuantity, 'µg', 2)) + '</div>';
    1744          
    1745           App.debug(rna.name+':'+info.remainingQuantity +':'+ rna.usedQuantity +':'+ rna.usedQuantity +':'+ QUANTITY_MINIMAL);
    17461731         
    17471732          if (info.remainingQuantity < rna.usedQuantity || rna.usedQuantity < QUANTITY_MINIMAL)
  • extensions/net.sf.basedb.reggie/trunk/resources/reggie-2.js

    r3827 r3833  
    198198    immediately.
    199199  */
    200   reggie.loadProtocols = function(subtype, list, annotations)
     200  reggie.loadProtocols = function(subtype, list, annotations, filter)
    201201  {
    202202    list = Doc.element(list);
     
    209209    {
    210210      url += '&annotations='+annotations;
     211    }
     212    if (filter)
     213    {
     214      url += '&filter='+encodeURIComponent(filter);
    211215    }
    212216    Wizard.asyncJsonRequest(url,
     
    424428  var wizard = {};
    425429  var internal = {};
    426   var debug = 1;
     430  var debug = 0;
    427431 
    428432  var currentStep = 1;
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r3832 r3833  
    712712
    713713  /**
     714    Flag to set on normalization protocol to indicate the
     715    target platform they can be used on. Eg. NeoPrep or manual.
     716    @since 4.3
     717  */
     718  public static final Annotationtype LIBPREP_TARGET =
     719    new Annotationtype("LibPrepTarget", Type.STRING, false, Item.PROTOCOL);
     720
     721  /**
    714722    The "AutoProcessing" annotation which, if set, is a
    715723    flag to indicate how the item should be handled by
     
    759767  public static final Annotationtype DILUTION_VOLUME =
    760768    new Annotationtype("DilutionVolume", Type.FLOAT, false, Item.EXTRACT);
     769 
    761770 
    762771  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r3832 r3833  
    410410        jsonChecks.add(checkAnnotationType(dc, Annotationtype.RNA_MINIMAL_AMOUNT, 1, null, effectivePermissionsUse, createIfMissing));
    411411        jsonChecks.add(checkAnnotationType(dc, Annotationtype.RNA_TARGET_VOLUME, 1, null, effectivePermissionsUse, createIfMissing));
     412        jsonChecks.add(checkAnnotationType(dc, Annotationtype.LIBPREP_TARGET, 1,
     413            new ValueOptions("Manual", "NeoPrep"), effectivePermissionsUse, createIfMissing));
    412414       
    413415        jsonChecks.add(checkAnnotationType(dc, Annotationtype.USE_FOR_QC, 1, null, effectivePermissionsUse, createIfMissing));
     
    626628        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.RNA_NORMALIZATION_PROTOCOL, createIfMissing,
    627629            Annotationtype.RNA_TARGET_VOLUME, Annotationtype.RNA_TARGET_AMOUNT,
    628             Annotationtype.RNA_MINIMAL_AMOUNT
     630            Annotationtype.RNA_MINIMAL_AMOUNT, Annotationtype.LIBPREP_TARGET
    629631            ));
    630632       
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/MRnaServlet.java

    r3832 r3833  
    2222import net.sf.basedb.core.BioMaterialEventSource;
    2323import net.sf.basedb.core.ItemList;
    24 import net.sf.basedb.core.ItemNotFoundException;
    2524import net.sf.basedb.core.BioPlate;
    2625import net.sf.basedb.core.BioPlateEvent;
     
    249248        int numNewToSelect = Values.getInt(req.getParameter("numNewToSelect"), numToSelect-1);
    250249        boolean neoPrep = Values.getBoolean(req.getParameter("neoprep"));
     250        int protocolId = Values.getInt(req.getParameter("protocol"));
    251251       
    252252        // Find the best matching normalization protocol used on pre-normalized RNA item
    253         float targetRnaAmount = neoPrep ? 0.12f : 0.5f;
    254         Protocol protocol = findNormalizationProtocol(dc, targetRnaAmount);
    255         if (protocol == null)
    256         {
    257           throw new ItemNotFoundException("RNA Normalization protocol for target amount " + targetRnaAmount + "µg");
     253        Protocol protocol = Protocol.getById(dc, protocolId);
     254        Float targetRnaAmount = (Float)Annotationtype.RNA_MINIMAL_AMOUNT.getAnnotationValue(dc, protocol);
     255        if (targetRnaAmount == null)
     256        {
     257          targetRnaAmount = (Float)Annotationtype.RNA_TARGET_AMOUNT.getAnnotationValue(dc, protocol);
     258        }
     259        if (targetRnaAmount == null)
     260        {
     261          throw new InvalidDataException("The '" + protocol.getName() + "' doesn't specify the amount of RNA.");
    258262        }
    259263       
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ProtocolServlet.java

    r3603 r3833  
    1313import org.json.simple.JSONObject;
    1414
     15import net.sf.basedb.core.AnnotationSimpleRestriction;
    1516import net.sf.basedb.core.Application;
    1617import net.sf.basedb.core.DbControl;
    1718import net.sf.basedb.core.ItemQuery;
     19import net.sf.basedb.core.Operator;
    1820import net.sf.basedb.core.Permission;
    1921import net.sf.basedb.core.Project;
     
    8082
    8183        String ann = req.getParameter("annotations");
     84        String filter = req.getParameter("filter");
    8285        List<Annotationtype> annotations = new ArrayList<Annotationtype>();
    8386        if (ann != null)
    8487        {
    85           for (String aType : ann.split(","))
     88          String[] aTypes = ann.split(",");
     89          String[] filters = filter != null ? filter.split(",") : null;
     90          for (int index = 0; index < aTypes.length; index++)
    8691          {
    87             Annotationtype a = Annotationtype.getByCName(aType);
    88             if (a != null) annotations.add(a);
     92            Annotationtype a = Annotationtype.getByCName(aTypes[index]);
     93            if (a != null)
     94            {
     95              annotations.add(a);
     96              if (filters != null && filters.length > index)
     97              {
     98                query.restrict(new AnnotationSimpleRestriction((String)null, a.get(dc), Operator.EQ, filters[index], true, false));
     99              }
     100            }
    89101          }
    90102        }
Note: See TracChangeset for help on using the changeset viewer.