Add in test code to verify RDF data being added to the library page.
[htsworkflow.git] / htsworkflow / frontend / templates / samples / library_detail.html
index 4c5c2b889e678a65edd3fb94eef06c0a2a6ddbab..f5c4176855cd071950e2819add3e4f5a3d6693e6 100644 (file)
-{% load humanize %}
+{% extends "base_site.html" %}
+{% load adminmedia humanize i18n %}
+{% block extrahead %}
+    <!-- App Stuff -->
+    <link type="text/css" rel="stylesheet" href="/static/css/app.css" />
+    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
+    
+    {% block additional_javascript %}
+    {% endblock %}
+
 <style type="text/css">
   /* <![CDATA[ */
-  table, td {
+  div#librarydetail {
+    margin: 0;
+    padding: 0;
+  }
+  div#librarydetail table, div#librarydetail td {
     border-style: solid;
   }
-  table {
+  div#librarydetail table {
     border-width: 0 0 1px 1px;
     border-spacing: 0;
     border-collapse: collapse;
   }
-  td {
+  div#librarydetail td {
     margin: 0;
-    padding: 4px;
+    padding: 3px;
     border-width: 1px 1px 0 0;
   }
-  thead {
+  div#librarydetail thead {
     text-align: center;
     }
-  tbody {
+  div#librarydetail tbody {
     text-align: right;
   }
-  /* ]]> */
-</style>
+  div#librarydetail h1,
+  div#librarydetail h2
+  {
+    font-size: 150%;
+  }
+
+  div#librarydetail h3 {
+     font-size: 125%;
+     margin: 0;
+  }
+
+  div#librarydetail h4,
+  div#librarydetail h5,
+  div#librarydetail ul,
+  div#librarydetail ol,
+  div#librarydetail li
+  {
+    list-style: none;
+    margin: 0;   
+  }
 
-<h2>About this library</h2>
-<b>Library ID</b>: {{ lib.library_id }}<br/>
-<b>Name</b>: {{ lib.library_name }}<br/>
-<b>Species</b>: {{ lib.library_species.scientific_name }}<br/>
-<b>Affiliations</b>:
-<ul>
-  {% for individual in lib.affiliations.all %}
-    <li>{{ individual.name }} ( {{ individual.contact }} )</li>
-  {% endfor %}
-</ul>
+  div#librarydetail ul,
+  div#librarydetail ol
+  {
+    margin-bottom: .5em;
+  }
 
-<h2>Raw Result Files</h2>
-<table>
-<thead>
-  <tr>
-    <td>Cycle</td>
-    <td>Flowcell</td>
-    <td>Lane</td>
-    <td>Summary</td>
-    <td>Eland</td>
-    <td>Bed</td>
-  </tr>
-{% for result in eland_results %}
-<tr>
-  <td>{{ result.cycle }}</td>
-  <td>{{ result.flowcell_id }}</td>
-  <td>{{ result.lane }}</td>
-  <td><a href="{{ result.summary_url }}">Summary</a></td>
-  <td><a href="{{ result.result_url }}">{{ result.result_label }}</a></td>
-  <td>
-  {% if result.bed_url %}
-    <a href="{{ result.bed_url }}">Bed</a>
-  {% endif %}
-  </td>
-</tr>
-{% endfor %}
-</table>
+  div.library_identity { 
+    float: left; margin: 5px; }
+  div.library_sample_detail { float: left; margin: 5px; }
+  div.library_library_detail { float: left; margin: 5px; }
+  div.library_statistics { clear: both; border: 1px; }
+ /* ]]> */
+</style>
+{% endblock %}
 
-<h2>Lane Summary Statistics</h2>
-{% block summary_stats %}
-<table>
+{% block content %}
+<div id="librarydetail">
+  <div class="library_identity">
+    <h2>Library Name</h2>  
+    <b>Library ID</b>: {{ lib.id }}<br/>
+    <b>Name</b>: 
+      <span property="libns:name">{{ lib.library_name }}</span>
+    <br/>
+    <b>Affiliations</b>:
+    <ul>
+      {% for individual in lib.affiliations.all %}
+        <li property="libns:affiliation" content="{{individual.name}}">
+          {{ individual.name }} ( {{ individual.contact }} )
+        </li>
+      {% endfor %}
+    </ul>
+  </div>
+  <div class="library_sample_detail">
+    <h2>Sample Details</h2>
+    <b>Species</b>: 
+      <span property="libns:species">{{ lib.library_species.scientific_name }}</span>
+    <br/>
+    <b>Experiment Type</b>:
+       <span property="libns:experiment_type">{{ lib.experiment_type }}</span>
+    <br/>
+    {% if lib.antibody %}
+    <b>Antibody</b>:
+       <span property="libns:antibody">{{ lib.antibody.antibodies }}</span>
+       {% if lib.antibody.antibodies.nuckname %}
+       (<span property="libns:antibody_term">{{ lib.antibody.nickname }}</span>)
+       {% endif %}
+    <br/>
+    {% endif %}
+    {% if lib.cell_line %}
+    <b>Background or Cell Line</b>:
+       <span property="libns:cell_line">{{ lib.cell_line }}</span>
+    <br/>
+    {% endif %}
+    {% if lib.condition %}
+    <b>Condition</b>:
+       <span property="libns:condition">{{ lib.condition.condition_name }}</span>
+       {% if lib.condition.nickname %}
+       (<span property="libns:condition_term">{{ lib.condition.nickname }}</span>)
+       {% endif %}
+    <br/>
+    {% endif %}
+    {% if lib.replicate %}
+    <b>Replicate</b>: 
+       <span property="libns:replicate">{{ lib.replicate }}</span>
+    <br/>
+    {% endif %}
+  </div>
+  <div class="library_library_detail">
+    <h2>Library Details</h2>
+    <b>Library Type</b>:
+       <span property="libns:library_type">{{ lib.library_type }}</span>
+    <br/>
+    <b>Creation Date</b>
+      <span property="libns:date" content="{{lib.creation_date|date:'Y-m-d'}}T00:00:00" datatype="xsd:dateTime">{{ lib.creation_date }}</span>
+    <br/> 
+    <b>Made By</b>: 
+      <span property="libns:made_by">{{ lib.made_by }}</span>
+    <br/>
+    {% if lib.gel_cut_size %}
+    <b>Gel Cut Size</b>: 
+      <span property="libns:gel_cut">{{ lib.gel_cut_size }}</span>
+    <br/>
+    {% endif %}
+    {% if lib.insert_size %}
+    <b>Insert Size</b>: 
+      <span property="libns:insert_size">{{ lib.insert_size }}</span>
+    <br/>
+    {% endif %}
+    {% if lib.undiluted_concentration %}
+    <b>Concentration</b>: 
+      <span property="libns:concentration">{{ lib.undiluted_concentration }} ng/µl</span>
+    <br/>
+    {% endif %}
+    {% if lib.stopping_point_name %}
+    <b>Protocol Stopping Point</b>
+      <span property="libns:stopping_point">{{ lib.stopping_point_name }}</span>
+    <br/>
+    {% endif %}
+  </div>
+  <div class="library_statistics">
+  <h2>Raw Result Files</h2>
+  <table>
   <thead>
     <tr>
-      <td colspan="7"></td>
-      <td colspan="2">No Match</td>
-      <td colspan="2">QC Failed</td>
-      <td colspan="4">Unique</td>
-      <td colspan="4">Repeat</td>
-    </tr>
-    <tr>
-    <td>Cycles</td>
-    <td>Flowcell</td>
-    <td>Lane</td>
-    <td>End</td>
-    <td>Cluster / Tile</td>
-    <td>pM</td>
-    <td>Raw Reads</td>
-    <td>total</td>
-    <td>%</td>
-    <td>total</td>
-    <td>%</td>
-    <td>0 mismatch</td>
-    <td>1 mismatch</td>
-    <td>2 mismatch</td>
-    <td>Total</td>
-    <td>0 mismatch</td>
-    <td>1 mismatch</td>
-    <td>2 mismatch</td>
-    <td>Total</td>
+      <td>Run Start Date</td>
+      <td>Cycle</td>
+      <td>Flowcell</td>
+      <td>Lane</td>
+      <td>Summary</td>
+      <td>Eland</td>
+      <td>Bed</td>
+      <td>Archived</td>
     </tr>
   </thead>
   <tbody>
-
-    {% for lane in lane_summary_list %}
-    <tr>
-      <td>{{ lane.cycle_width }}</td>
-      <td>{{ lane.flowcell_id }}</td>
-      <td>{{ lane.lane_id }}</td>
-      <td>{% if lane.end %}{{ lane.end }}{% endif %}</td>
-      <td>{{ lane.clusters.0|intcomma }}</td>
-      <td>{{ lane.successful_pm }}</td>
-      <td>{{ lane.reads|intcomma }}</td>
-      <td>{{ lane.no_match|intcomma }}</td>
-      <td>{{ lane.no_match_percent|stringformat:".2f" }}</td>
-      <td>{{ lane.qc_failed|intcomma }}</td>
-      <td>{{ lane.qc_failed_percent|stringformat:".2f" }}</td>
-      <td>{{ lane.match_codes.U0|intcomma }}</td>
-      <td>{{ lane.match_codes.U1|intcomma }}</td>
-      <td>{{ lane.match_codes.U2|intcomma }}</td>
-      <td>{{ lane.unique_reads|intcomma }}</td>
-      <td>{{ lane.match_codes.R0|intcomma }}</td>
-      <td>{{ lane.match_codes.R1|intcomma }}</td>
-      <td>{{ lane.match_codes.R2|intcomma }}</td>
-      <td>{{ lane.repeat_reads|intcomma }}</td>
+    {% for result in eland_results %}
+    <tr about="{{result.flowcell.get_absolute_url}}">
+      <td property="libns:date" content="{{result.run_date|date:'Y-m-d\TH:i:s'}}" datatype="xsd:dateTime">{{ result.run_date|date}}</td>
+      <td>{{ result.cycle }}</td>
+      <td><a href="{{result.flowcell.get_absolute_url}}"><span property="libns:flowcell_id">{{ result.flowcell_id }}</span></a></td>
+      <td><a href="{{result.lane.get_absolute_url}}" rel="libns:has_lane"><span property="libns:lane_number" datatype="xsd:decimal">{{ result.lane.lane_number }}</span></a></td>
+      <td><a href="{{ result.summary_url }}">Summary</a></td>
+      <td><a href="{{ result.result_url }}">{{ result.result_label }}</a></td>
+      <td>
+      {% if result.bed_url %}
+        <a href="{{ result.bed_url }}">Bed</a>
+      {% endif %}
+      </td>
+      <td>
+        {% if result.storage_ids %}
+          {{ result.storage_ids|safe }}
+        {% endif %}
+      </td>
     </tr>
     {% endfor %}
   </tbody>
-</table>
-<br/>
-<hr/>
-<h2>Count of multi-reads</h2>
-{% for lane in lane_summary_list %}
-  {% if lane.summarized_reads %}
-  <h3>
-    {{lane.cycle_width}} {{ lane.flowcell_id }} lane {{ lane.lane_id }} 
-    {% if lane.end %} end {{ lane.end }}{% endif %}
-  </h3>
-  <ul>
-    {% for name, counts in lane.summarized_reads.items %}
-    <li><b>{{ name }}</b>: {{ counts|intcomma }}</li>
-    {% endfor %}
-  </ul>
-  {% endif %}
-{% endfor %}
+  </table>
+  
+  <h2>Lane Summary Statistics</h2>
+  {% block summary_stats %}
+  <table>
+    <thead>
+      <tr>
+        <td colspan="7"></td>
+        <td colspan="2">No Match</td>
+        <td colspan="2">QC Failed</td>
+        <td colspan="4">Unique</td>
+        <td colspan="4">Repeat</td>
+      </tr>
+      <tr>
+      <td>Cycles</td>
+      <td>Flowcell</td>
+      <td>Lane</td>
+      <td>End</td>
+      <td>Cluster / Tile</td>
+      <td>pM</td>
+      <td>Raw Reads</td>
+      <td>total</td>
+      <td>%</td>
+      <td>total</td>
+      <td>%</td>
+      <td>0 mismatch</td>
+      <td>1 mismatch</td>
+      <td>2 mismatch</td>
+      <td>Total</td>
+      <td>0 mismatch</td>
+      <td>1 mismatch</td>
+      <td>2 mismatch</td>
+      <td>Total</td>
+      </tr>
+    </thead>
+    <tbody>
+  
+      {% for lane in lane_summary_list %}
+      <tr about="/flowcell/{{lane.flowcell_id}}/{{lane.lane_id}}/{% if lane.end %}#end{{ lane.end }}{% endif %}">
+        <td>{{ lane.cycle_width }}</td>
+        <td>{{ lane.flowcell_id }}</td>
+        <td>{{ lane.lane_id }}</td>
+        <td>{% if lane.end %}{{ lane.end }}{% endif %}</td>
+        <td>{{ lane.clusters.0|intcomma }}</td>
+        <td>{{ lane.successful_pm }}</td>
+        <td>{{ lane.reads|intcomma }}</td>
+        <td>{{ lane.no_match|intcomma }}</td>
+        <td>{{ lane.no_match_percent|stringformat:".2f" }}</td>
+        <td>{{ lane.qc_failed|intcomma }}</td>
+        <td>{{ lane.qc_failed_percent|stringformat:".2f" }}</td>
+        <td>{{ lane.match_codes.U0|intcomma }}</td>
+        <td>{{ lane.match_codes.U1|intcomma }}</td>
+        <td>{{ lane.match_codes.U2|intcomma }}</td>
+        <td {% if lane.unique_reads %}property="libns:total_unique_locations" content="{{lane.unique_reads}}" datatype="xsd:decimal"{% endif %}>{{ lane.unique_reads|intcomma }}</td>
+        <td>{{ lane.match_codes.R0|intcomma }}</td>
+        <td>{{ lane.match_codes.R1|intcomma }}</td>
+        <td>{{ lane.match_codes.R2|intcomma }}</td>
+        <td>{{ lane.repeat_reads|intcomma }}</td>
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+
+  <h2>Flowcell Notes</h2>
+  <table>
+    <thead>
+      <tr>
+       <td>Flowcell ID</td>
+       <td>Lane</td>
+       <td>Comment</td>
+      </tr>
+    </thead>
+    <tbody>
+      {% for lane in lib.lane_set.all %}
+      <tr rel="libns:has_lane" resource="{{lane.get_absolute_url}}">
+        <td><a href="{{lane.flowcell.get_absolute_url}}" rel="libns:flowcell">
+            <span property="libns:flowcell_id">{{ lane.flowcell.flowcell_id }}</span></a></td>
+        <td><a href="{{lane.get_absolute_url}}"> 
+            <span property="libns:lane_number"  datatype="xsd:decimal"
+               >{{ lane.lane_number }}</span></a></td>
+        <td>{{ lane.comment }}</td>
+      </tr>
+         {% endfor %}
+    </tbody>
+  </table>
+  {% endblock %}
+  </div>
+</div>
 {% endblock %}