Changeset 1804


Ignore:
Timestamp:
Jan 21, 2013, 3:34:31 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #423: Implement wizards for cDNA->FlowCell? processing

Started with preparations for this batch of wizards.

  • Added a new section on the main index page (links not working yet).
  • Installation wizard now create 24 'TruSeqIndexXX` barcodes.
  • Installation wizard rearranged to 3 columns for better space utilization. Also changed so that not all items are visible if everything is ok (if there is an error all items are visisble).
Location:
extensions/net.sf.basedb.reggie/branches/ticket-422
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/ticket-422/resources/index.jsp

    r1782 r1804  
    297297            </ul>
    298298          </dd>
     299         
     300          <dt>
     301            <base:icon image="<%=home+"/images/flowcell.png" %>" />
     302            Library preparation wizards
     303          </dt>
     304          <dd>
     305            <ul>
     306            <li><a href="libprep/assign_barcode.jsp?ID=<%=ID%>">Assign barcodes to cDNA plate</a>
     307            <li><a href="libprep/libprep_protocol.jsp?ID=<%=ID%>">Lab protocols and files for library preparation</a>
     308            <li><a href="libprep/lib_registration.jsp?ID=<%=ID%>">Library registration and quality control results</a>
     309            </ul>
     310          </dd>
    299311          <%
    300312        }
  • extensions/net.sf.basedb.reggie/branches/ticket-422/resources/install.jsp

    r1628 r1804  
    4949    return false;
    5050  }
     51  var COL_BREAKS = ['ANNOTATIONTYPE', 'BIOMATERIALLIST'];
    5152 
    5253  var numMissing = 0;
     
    5556  var numIncomplete = 0;
    5657  var checks = response.checks;
    57   var tblHeader = '<tr><th class="itemTypeCol">Item type</th><th class="nameCol">Name</th><th class="iconCol"></th><th class="statusCol">Status</th></tr>';
    5858  var html = '<table class="report">';
    59   html += tblHeader;
    6059  var lastItemType = null;
     60  var index = 0;
     61  var first10 = '';
     62  var theRest = '';
     63  var allOk = true;
     64 
    6165  for (var i = 0; i < checks.length; i++)
    6266  {
     
    6771      numMissing++;
    6872      icon = 'error.png';
     73      allOk = false;
    6974    }
    7075    if (check.status == 'incomplete')
     
    7277      numIncomplete++;
    7378      icon = 'warning.png';
     79      allOk = false;
    7480    }
    7581    if (check.status == 'error')
     
    7783      numErrors++;
    7884      icon = 'error.png';
     85      allOk = false;
    7986    }
    8087    if (check.status == 'warning')
     
    8289      numWarnings++;
    8390      icon = 'warning.png';
    84     }
     91      allOk = false;
     92    }
     93   
    8594    if (lastItemType != check.itemType)
    8695    {
    87       if (check.itemType == 'ANNOTATIONTYPE')
     96      html += first10;
     97      if (allOk && index > 13)
     98      {
     99        html += '<tr class="sameitemtype highlight" id="'+check.itemType+'" onclick="showMore(event)">';
     100        html += '<td class="link">&hellip; '+(index-10)+' more</td>';
     101        html += '<td><img src="images/ok.png"></td><td>Ok</td></tr>';
     102        html += '<tbody id="'+check.itemType+'.more" style="display: none;">';
     103        html += theRest;
     104        html += '</tbody>';
     105      }
     106      else
     107      {
     108        html += theRest;
     109      }
     110     
     111      first10 = '';
     112      theRest = '';
     113      allOk = true;
     114      index = 0;
     115     
     116      var col_break = COL_BREAKS.indexOf(check.itemType);
     117      if (col_break >= 0)
    88118      {
    89119        // End the left side and start on the right
    90120        html += '</table>';
    91         setInnerHTML('validationResult', html);
     121        setInnerHTML('validationResult'+col_break, html);
    92122        html = '<table class="report">';
    93         html += tblHeader;
    94123      }
    95       html += '<tr class="newitemtype highlight"><td>'+check.itemType+'</td>';
    96     }
    97     else
    98     {
    99       html += '<tr class="sameitemtype highlight"><td>&nbsp;</td>';
    100     }
     124      html += '<tr class="newitemtype"><td colspan="3">'+check.itemType+'</td></tr>';
     125    }
     126   
     127    var line = '<tr class="sameitemtype highlight">';
    101128    lastItemType = check.itemType;
    102129    var name = check.name;
     
    104131    if (check.id)
    105132    {
    106       html += '<td><div class="link" onclick="itemOnClick(event, \''+check.itemType+'\','+check.id+')"';
    107       html += ' title="View this item (use CTRL, ALT or SHIFT to edit)">'+name+'</div></td>';
     133      line += '<td class="itemTypeCol"><div class="link" onclick="itemOnClick(event, \''+check.itemType+'\','+check.id+')"';
     134      line += ' title="View this item (use CTRL, ALT or SHIFT to edit)">'+name+'</div></td>';
    108135    }
    109136    else
    110137    {
    111       html += '<td><i>' + name + '</i></td>';
    112     }
    113     html += '<td><img src="images/'+icon+'"></td><td>';
     138      line += '<td class="itemTypeCol"><i>' + name + '</i></td>';
     139    }
     140    line += '<td class="iconCol"><img src="images/'+icon+'"></td>';
     141    line += '<td class="statusCol">';
    114142    if (check.messages.length > 1)
    115143    {
    116144      for (var m = 0; m < check.messages.length; m++)
    117145      {
    118         html += '• '+check.messages[m] + '<br>';
     146        line += '• '+check.messages[m] + '<br>';
    119147      }
    120148    }
    121149    else
    122150    {
    123       html += check.messages;
    124     }
    125     html += '</td></tr>';
    126   }
     151      line += check.messages;
     152    }
     153    line += '</td></tr>';
     154   
     155    if (index < 10)
     156    {
     157      first10 += line;
     158    }
     159    else
     160    {
     161      theRest += line;
     162    }
     163    index++;
     164  }
     165 
     166  html += first10;
     167  if (allOk && index > 13)
     168  {
     169    html += '<tr class="sameitemtype highlight" id="'+check.itemType+'" onclick="showMore(event)">';
     170    html += '<td class="link">&hellip; '+(index-10)+' more</td>';
     171    html += '<td><img src="images/ok.png"></td><td>Ok</td></tr>';
     172    html += '<tbody id="'+check.itemType+'.more" style="display: none;">';
     173    html += theRest;
     174    html += '</tbody>';
     175  }
     176  else
     177  {
     178    html += theRest;
     179  }
     180 
    127181  html += '</table>';
    128   setInnerHTML('validationResult2', html);
     182  setInnerHTML('validationResult'+COL_BREAKS.length, html);
    129183 
    130184  if (numErrors > 0)
     
    150204  Main.itemOnClick(event, '<%=ID%>', itemType, itemId, true);
    151205}
     206
     207function showMore(event)
     208{
     209  var target = event.currentTarget;
     210  Main.show(target.id + '.more');
     211  Main.hide(target.id);
     212}
     213
    152214</script>
    153215<style>
     
    155217{
    156218  width: 100%;
    157   table-layout: fixed;
    158219  border-collapse: collapse;
    159220}
     
    161222.report .itemTypeCol
    162223{
    163   width: 15em;
     224  width: 18em;
    164225  overflow: hidden;
    165226  text-overflow: ellipsis;
    166227}
    167228
    168 .report .nameCol
    169 {
    170   width: 20em;
    171   overflow: hidden;
    172   text-overflow: ellipsis;
    173 }
    174229.report .iconCol
    175230{
     
    196251{
    197252  border-top: 1px solid #A0A0A0;
     253  border-bottom: 1px solid #A0A0A0;
     254  font-weight: bold;
     255  background-color: #E8E8E8;
    198256}
    199257.report .sameitemtype
     
    201259  border-top: 1px dotted #A0A0A0;
    202260  border-bottom: 1px dotted #A0A0A0;
     261}
     262
     263.report .sameitemtype > td:first-child
     264{
     265  padding-left: 1em;
     266}
     267
     268.report td
     269{
     270  white-space: nowrap;
     271  overflow: hidden;
     272  text-overflow: ellipsis;
    203273}
    204274</style>
     
    213283  <div class="content" style="padding-left: 2em;">
    214284
    215     <div class="absolutefull" style="width: 50%; bottom: 10em;">
    216       <div id="validationResult" class="absolutefull fullborder" style="left: 1em; right: 0.5em; ">
     285    <div class="absolutefull" style="width: 33%; bottom: 10em;">
     286      <div id="validationResult0" class="absolutefull fullborder" style="left: 1em; right: 0.5em; border-top-width: 0 !important;">
    217287        Checking; please wait...
    218288      </div>
    219289    </div>
    220290   
    221     <div class="absolutefull" style="width: 50%; bottom: 10em; left: auto;">
    222       <div id="validationResult2" class="absolutefull fullborder" style="left: 0.5em; right: 1em; ">
     291    <div class="absolutefull" style="width: 33%; bottom: 10em; left: 33%;">
     292      <div id="validationResult1" class="absolutefull fullborder" style="left: 0.5em; right: 1em; border-top-width: 0 !important;">
    223293      </div>
    224294    </div>
    225  
     295
     296    <div class="absolutefull" style="width: 34%; bottom: 10em; left: auto;">
     297      <div id="validationResult2" class="absolutefull fullborder" style="left: 0.5em; right: 1em; border-top-width: 0 !important;">
     298      </div>
     299    </div>
     300
    226301    <div class="absolutefull" style="top: auto; height: 10em; left: 1em; right: 1em;">
    227302      <div id="createMissingItems" style="display:none; margin-top: 1em;">
  • extensions/net.sf.basedb.reggie/branches/ticket-422/src/net/sf/basedb/reggie/dao/Subtype.java

    r1734 r1804  
    176176 
    177177  /**
     178    The definition of the "Barcode" subtype for tags. Should already
     179    exist in BASE.
     180    @since 2.x
     181   */
     182  public static final Subtype BARCODE = new Subtype("Barcode", Item.TAG, false);
     183 
     184  /**
    178185    Create a subtype representation of an ItemSubtype object.
    179186    @since 2.4
  • extensions/net.sf.basedb.reggie/branches/ticket-422/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r1803 r1804  
    4040import net.sf.basedb.core.SessionControl;
    4141import net.sf.basedb.core.SharedItem;
     42import net.sf.basedb.core.Tag;
    4243import net.sf.basedb.core.Type;
    4344import net.sf.basedb.core.plugin.Plugin;
     
    140141        jsonChecks.add(checkSubtype(dc, Subtype.FLOW_THROUGH, createIfMissing, Subtype.LYSATE, Subtype.EXTRACTION_PROTOCOL));
    141142        jsonChecks.add(checkSubtype(dc, Subtype.QUALITY_CONTROL, createIfMissing));
    142         jsonChecks.add(checkSubtype(dc, Subtype.RNAQC, createIfMissing, Subtype.RNA, Subtype.QUALITY_CONTROL));
    143        
     143        jsonChecks.add(checkSubtype(dc, Subtype.RNAQC, createIfMissing, Subtype.RNA, Subtype.QUALITY_CONTROL));   
    144144        jsonChecks.add(checkSubtype(dc, Subtype.MRNA_PROTOCOL, createIfMissing));
    145145        jsonChecks.add(checkSubtype(dc, Subtype.MRNA, createIfMissing, Subtype.RNA, Subtype.MRNA_PROTOCOL));
    146146        jsonChecks.add(checkSubtype(dc, Subtype.CDNA_PROTOCOL, createIfMissing));
    147147        jsonChecks.add(checkSubtype(dc, Subtype.CDNA, createIfMissing, Subtype.MRNA, Subtype.CDNA_PROTOCOL));
     148        jsonChecks.add(checkSubtype(dc, Subtype.BARCODE, createIfMissing));
    148149
    149150        // Plate geometries
     
    160161        jsonChecks.add(checkBioplateType(dc, BioplateType.MRNA, createIfMissing));
    161162        jsonChecks.add(checkBioplateType(dc, BioplateType.CDNA, createIfMissing));
    162        
    163         // Biomaterial lista
    164         jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_RNA, createIfMissing));
    165        
    166         // MIME types
    167         jsonChecks.add(checkMimeType(dc, Mimetype.GDX, createIfMissing));
    168        
    169         // Special items
    170         jsonChecks.add(checkExtract(dc, "Stratagene.r", Subtype.RNA, null, effectiveOptions, createIfMissing));
    171         jsonChecks.add(checkExtract(dc, "External.r", Subtype.RNA,
    172           "This RNA is used to indicate that a bioplate location is taken by RNA not registered in BASE.", effectiveOptions, createIfMissing));
    173163       
    174164        // Plugin definitions and configurations
     
    288278        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.CDNA, createIfMissing));
    289279
     280       
     281        // Biomaterial lists
     282        jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_RNA, createIfMissing));
     283       
     284        // MIME types
     285        jsonChecks.add(checkMimeType(dc, Mimetype.GDX, createIfMissing));
     286       
     287        // Special items
     288        jsonChecks.add(checkExtract(dc, "Stratagene.r", Subtype.RNA, null, effectiveOptions, createIfMissing));
     289        jsonChecks.add(checkExtract(dc, "External.r", Subtype.RNA,
     290          "This RNA is used to indicate that a bioplate location is taken by RNA not registered in BASE.", effectiveOptions, createIfMissing));
     291
     292        // Tags
     293        for (int i = 1; i <= 27; i++)
     294        {
     295          // Skip 24 and 26 since those are not present in our kits
     296          if (i == 24 || i == 26) continue;
     297          jsonChecks.add(checkTag(dc, "TruSeqIndex"+(i < 10 ? "0" : "")+i, Subtype.BARCODE, effectiveOptions, createIfMissing));
     298        }
     299       
    290300        json.put("checks", jsonChecks);
    291301       
     
    716726 
    717727  /**
     728    Create a Tag with the given options. The tag is created in
     729    a separate transaction.
     730    @since 2.x
     731  */
     732  public Tag createTag(SessionControl sc, String name, Subtype subtype, PermissionOptions permissions)
     733  {
     734    Tag tag = null;
     735    DbControl dc = sc.newDbControl();
     736    try
     737    {
     738      tag = Tag.getNew(dc);
     739      tag.setName(name);
     740      tag.setItemSubtype(subtype.get(dc));
     741      if (permissions != null) permissions.applyPermissions(tag);
     742      dc.saveItem(tag);
     743      dc.commit();
     744    }
     745    finally
     746    {
     747      if (dc != null) dc.close();
     748    }
     749    return tag;
     750  }
     751
     752 
     753  /**
     754    Check for an existing tag with the given options.
     755    A JSONObject is returned with the result. The following
     756    keys are used:
     757    <ul>
     758    <li>itemType: TAG
     759    <li>name: The name of the tag
     760    <li>id: The id of the subtype if it exists
     761    <li>status: ok, error, or missing
     762    <li>message: A descriptive message in case of an error
     763    </ul>
     764    @since 2.x
     765  */
     766  @SuppressWarnings("unchecked")
     767  public JSONObject checkTag(DbControl dc, String name, Subtype subtype, PermissionOptions permissions, boolean createIfMissing)
     768  {
     769 
     770    JSONObject json = new JSONObject();
     771    JSONArray jsonMessages = new JSONArray();
     772    json.put("itemType", Item.TAG.name());
     773    json.put("name", name);
     774   
     775    ItemQuery<Tag> query = Tag.getQuery();
     776    query.restrict(
     777        Restrictions.eq(
     778          Hql.property("name"),
     779          Expressions.parameter("name", name, Type.STRING)
     780        ));
     781    query.include(Include.ALL);
     782    List<Tag> result = query.list(dc);
     783    if (result.size() == 0)
     784    {
     785      if (createIfMissing)
     786      {
     787        Tag t = createTag(dc.getSessionControl(), name, subtype, permissions);
     788        json.put("id", t.getId());
     789        json.put("status", "ok");
     790        jsonMessages.add("Created");
     791      }
     792      else
     793      {
     794        json.put("status", "missing");
     795        jsonMessages.add("Not found");
     796      }
     797    }
     798    else if (result.size() > 1)
     799    {
     800      json.put("status", "error");
     801      jsonMessages.add("Found > 1 tag");
     802    }
     803    else
     804    {
     805      Tag t = result.get(0);
     806      json.put("id", t.getId());
     807      json.put("status", "ok"); // For now -- more checks below
     808     
     809      if (!subtype.load(dc).equals(t.getItemSubtype()))
     810      {
     811        json.put("status", "error");
     812        jsonMessages.add("Should have '" + subtype.getName() + "' as subtype.");
     813      }
     814     
     815      if (permissions != null && !permissions.checkPermissions(t))
     816      {
     817        if (createIfMissing)
     818        {
     819          permissions.applyPermissions(t);
     820          if (jsonMessages.size() == 0) jsonMessages.add("Fixed");
     821        }
     822        else
     823        {
     824          json.put("status", "incomplete");
     825          jsonMessages.add(permissions.getMessage());
     826        }
     827      }
     828     
     829    }
     830    if (jsonMessages.size() == 0) jsonMessages.add("Ok");
     831    json.put("messages", jsonMessages);
     832    return json;
     833 
     834  }
     835
     836 
     837  /**
    718838    Create an annotation type category with the given options. The category
    719839    is created in a separate transaction.
     
    11641284    @since 2.x
    11651285  */
    1166   public Extract createExtract(SessionControl sc, String name, Subtype subtype, String description)
     1286  public Extract createExtract(SessionControl sc, String name, Subtype subtype, String description, PermissionOptions permissions)
    11671287  {
    11681288    Extract extract = null;
     
    11741294      extract.setItemSubtype(subtype.get(dc));
    11751295      extract.setDescription(description);
     1296      if (permissions != null) permissions.applyPermissions(extract);
    11761297      dc.saveItem(extract);
    11771298      dc.commit();
     
    12201341      if (createIfMissing)
    12211342      {
    1222         Extract extract = createExtract(dc.getSessionControl(), name, subtype, description);
     1343        Extract extract = createExtract(dc.getSessionControl(), name, subtype, description, permissions);
    12231344        json.put("id", extract.getId());
    12241345        json.put("status", "ok");
Note: See TracChangeset for help on using the changeset viewer.