return u"Paired"
else:
return u"Single"
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('htsworkflow.frontend.experiments.views.flowcell_detail',
+ [str(self.flowcell_id)])
### -----------------------
class DataRun(models.Model):
cluster_estimate = models.IntegerField(blank=True, null=True)
status = models.IntegerField(choices=LANE_STATUS_CODES, null=True, blank=True)
comment = models.TextField(null=True, blank=True)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('htsworkflow.frontend.experiments.views.flowcell_lane_detail',
+ [str(self.flowcell.flowcell_id), str(self.lane_number)])
from django.core.mail import EmailMessage, mail_managers
from django.http import HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
-from django.template import Context
+from django.template import RequestContext
from django.template.loader import get_template
from htsworkflow.frontend.experiments.models import *
for user_email in email_lane.keys():
sending = ""
# build body
- context = Context({u'flowcell': fc,
- u'lanes': email_lane[user_email],
- u'runfolder': 'blank',
- u'finish_low': estimate_low,
- u'finish_high': estimate_high,
- u'now': datetime.now(),
- })
+ context = RequestContext(request,
+ {u'flowcell': fc,
+ u'lanes': email_lane[user_email],
+ u'runfolder': 'blank',
+ u'finish_low': estimate_low,
+ u'finish_high': estimate_high,
+ u'now': datetime.now(),
+ })
# build view
subject = "Flowcell %s" % ( fc.flowcell_id )
emails.append((user_email, subject, body, sending))
- verify_context = Context({
- 'emails': emails,
- 'flowcell': fc,
- 'from': sender,
- 'send': send,
- 'site_managers': settings.MANAGERS,
- 'title': fc.flowcell_id,
- 'warnings': warnings,
+ verify_context = RequestContext(
+ request,
+ { 'emails': emails,
+ 'flowcell': fc,
+ 'from': sender,
+ 'send': send,
+ 'site_managers': settings.MANAGERS,
+ 'title': fc.flowcell_id,
+ 'warnings': warnings,
})
return HttpResponse(email_verify.render(verify_context))
"""
"""
return HttpResponse("I've got nothing.")
+
+
+def flowcell_detail(request, flowcell_id):
+ fc = get_object_or_404(FlowCell, flowcell_id=flowcell_id)
+
+ print unicode(fc.get_absolute_url())
+ for lane in fc.lane_set.all():
+ print unicode(lane.get_absolute_url())
+
+ context = RequestContext(request,
+ {'flowcell': fc})
+
+ return render_to_response('experiments/flowcell_detail.html',
+ context)
+
+def flowcell_lane_detail(request, flowcell_id, lane_number):
+ fc = get_object_or_404(FlowCell, flowcell_id=flowcell_id)
+ lane = get_object_or_404(fc.lane_set, lane_number=lane_number)
+
+ context = RequestContext(request,
+ {'lib': lane.library,
+ 'lane': lane,
+ 'flowcell': fc})
+
+ return render_to_response('experiments/flowcell_lane_detail.html',
+ context)
class Meta:
verbose_name_plural = "species"
ordering = ["scientific_name"]
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('htsworkflow.frontend.samples.views.species', [str(self.id)])
class Affiliation(models.Model):
name = models.CharField(max_length=256, db_index=True, verbose_name='Name')
@models.permalink
def get_absolute_url(self):
return ('htsworkflow.frontend.samples.views.library_to_flowcells', [str(self.id)])
-
-
-
class HTSUser(User):
urlpatterns = patterns('',
(r"^library/(?P<library_id>\w+)/json", 'htsworkflow.frontend.samples.views.library_json'),
(r"^species/(?P<species_id>\w+)/json", 'htsworkflow.frontend.samples.views.species_json'),
+ (r"^species/(?P<species_id>\w+)", 'htsworkflow.frontend.samples.views.species'),
)
from htsworkflow.frontend.auth import require_api_key
from htsworkflow.frontend.experiments.models import FlowCell, Lane, LANE_STATUS_MAP
from htsworkflow.frontend.samples.changelist import ChangeList
-from htsworkflow.frontend.samples.models import Library, HTSUser
+from htsworkflow.frontend.samples.models import Library, Species, HTSUser
from htsworkflow.frontend.samples.results import get_flowcell_result_dict, parse_flowcell_id
from htsworkflow.frontend.bcmagic.forms import BarcodeMagicForm
from htsworkflow.pipelines.runfolder import load_pipeline_run_xml
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse, HttpResponseRedirect, Http404
-from django.shortcuts import render_to_response
+from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.template.loader import get_template
from django.contrib.auth.decorators import login_required
#for lib in library_items.object_list:
for lib in cl.result_list:
summary = {}
+ summary['library'] = lib
summary['library_id'] = lib.id
summary['library_name'] = lib.library_name
summary['species_name' ] = lib.library_species.scientific_name
else:
return 'unknown'
-def _make_eland_results(flowcell_id, lane, interesting_flowcells):
+def _make_eland_results(flowcell_id, lane_number, interesting_flowcells):
fc_id, status = parse_flowcell_id(flowcell_id)
cur_fc = interesting_flowcells.get(fc_id, None)
if cur_fc is None:
return []
flowcell = FlowCell.objects.get(flowcell_id=flowcell_id)
+ lane = flowcell.lane_set.get(lane_number=lane_number)
# Loop throw storage devices if a result has been archived
storage_id_list = []
if cur_fc is not None:
result_path = cur_fc[cycle]['eland_results'].get(lane, None)
result_link = make_result_link(fc_id, cycle, lane, result_path)
results.append({'flowcell_id': fc_id,
+ 'flowcell': flowcell,
'run_date': flowcell.run_date,
'cycle': cycle,
'lane': lane,
require_api_key(request)
# what validation should we do on library_id?
- lib = library_dict(library_id)
- if lib is None:
- raise Http404
+ lib = get_object_or_404(Library, library_id=library_id)
lib_json = json.dumps(lib)
return HttpResponse(lib_json, mimetype='application/json')
"""
raise Http404
+def species(request, species_id):
+ species = get_object_or_404(Species, id=species_id)
+
+ context = RequestContext(request,
+ { 'species': species })
+
+ return render_to_response("samples/species_detail.html", context)
+
@login_required
def user_profile(request):
"""
color: white;
background: #880000;
}
+
+div.htswdetail {
+ margin: 0;
+ padding: 0;
+}
+div.htswdetail table, div.htswdetail td {
+ border-style: solid;
+}
+div.htswdetail table {
+ border-width: 0 0 1px 1px;
+ border-spacing: 0;
+ border-collapse: collapse;
+}
+div.htswdetail td {
+ margin: 0;
+ padding: 3px;
+ border-width: 1px 1px 0 0;
+}
+div.htswdetail thead {
+ text-align: center;
+}
+div.htswdetail tbody {
+ text-align: left;
+ }
+div.htswdetail h1,
+div.htswdetail h2
+{
+ font-size: 150%;
+}
+
+div.htswdetail h3 {
+ font-size: 125%;
+ margin: 0;
+}
+
+ div.htswdetail h4,
+ div.htswdetail h5,
+ div.htswdetail ul,
+ div.htswdetail ol,
+ div.htswdetail li
+ {
+ list-style: none;
+ margin: 0;
+ }
+
+ div.htswdetail ul,
+ div.htswdetail ol
+ {
+ margin-bottom: .5em;
+ }
+ /* ]]> */
+</style>
<div id="branding">
{% block branding %}{% endblock %}
</div>
- {% if user.is_authenticated and user.is_staff %}
- <div id="user-tools">{% trans 'Welcome,' %} <strong>{% firstof user.first_name user.username %}</strong>. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}<a href="/admin/password_change/">{% trans 'Change password' %}</a> / <a href="/admin/logout/">{% trans 'Log out' %}</a>{% endblock %}
- </div>
+ <div id="user-tools">
+ {% if user.is_authenticated %}
+ {% trans 'Welcome,' %} <strong>{% firstof user.first_name user.username %}</strong>. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}<a href="/admin/password_change/">{% trans 'Change password' %}</a> / <a href="/admin/logout/">{% trans 'Log out' %}</a>{% endblock %}
+ {% else %}
+ <a href="/admin/login/">{% trans 'Log in' %}</a>
{% endif %}
+ </div>
{% block nav-global %}{% endblock %}
</div>
{% endif %}
--- /dev/null
+{% 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 %}
+{% endblock %}
+
+{% block content %}
+<div id="flowcell_detail">
+ <h2>About this Flowcell</h2>
+ <b>Flowcell</b>:
+ <a href="{{flowcell.get_absolute_url}}" property="libns:flowcell_id">{{flowcell.flowcell_id}}</a><br/>
+ <b>Run Date</b>:
+ <span property="libns:date" content="{{flowcell.run_date|date:'Y-m-d\TH:i:s'}}" datatype="xsd:dateTime">{{ flowcell.run_date }}</span><br/>
+ <b>Type</b>:
+ <span property="libns:flowcell_type">{{flowcell.flowcell_type}}</span><br/>
+ <b>Read Length</b>:
+ <span property="libns:read_length">{{flowcell.read_length}}</span><br/>
+ <b>Control Lane</b>:
+ <span property="libns:control_lane">{{flowcell.control_lane}}</span><br/>
+
+ <b>Notes</b>:
+ <p property="libns:flowcell_notes">{{flowcell.notes}}</p>
+ <div class="htswdetail">
+ <h2>Lanes</h2>
+ <table>
+ <thead>
+ <tr>
+ <td>Lane</td>
+ <td>Library ID</td>
+ <td>Library Name</td>
+ <td>Species</td>
+ <td>Comment</td>
+ </tr>
+ </thead>
+ <tbody>
+ {% for lane in flowcell.lane_set.all %}
+ <tr rel="libns:has_lane" resource="{{lane.get_absolute_url}}" >
+ <td><a href="{{lane.get_absolute_url}}">
+ <span property="libns:lane_number">{{lane.lane_number}}</span></a></td>
+ <td><a href="{{lane.library.get_absolute_url}}"
+ rel="libns:library"><span property="libns:library_id"
+ >{{lane.library.id}}</span></a></td>
+ <td><a href="{{lane.library.get_absolute_url}}" rel="libns:library"><span property="libns:name">{{lane.library.library_name}}</span></a></td>
+ <td><a href="{{lane.library.library_species.get_absolute_url}}" rel="libns:species">
+ <span property="libns:species_name">{{ lane.library.library_species.scientific_name }}</span></a></td>
+ <td><span property="libns:comment">{{lane.comment}}</span></td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+</div>
+{% endblock %}
--- /dev/null
+{% 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 %}
+{% endblock %}
+
+{% block content %}
+<div id="lane_detail">
+ <h2>About this lane</h2>
+ <div rel="libns:flowcell" resource="{{flowcell.get_absolute_url}}">
+ <b>Flowcell</b>:
+ <a href="{{flowcell.get_absolute_url}}">{{flowcell.flowcell_id}}</a><br/>
+ <b>Run Date</b>:
+ <span property="libns:date" content="{{flowcell.run_date|date:'Y-m-d\TH:i:s'}}" datatype="xsd:dateTime">{{ flowcell.run_date }}</span><br/>
+ <b>Type</b>:
+ <span property="libns:flowcell_type">{{flowcell.flowcell_type}}</span><br/>
+ </div>
+ <b>Lane</b>:
+ <span property="libns:lane_number" datatype="xsd:decimal">{{lane.lane_number}}</span><br/>
+ <b>pM</b>
+ <span property="libns:pM" datatype="xsd:decimal">{{ lane.pM }}</span><br/>
+ <b>Cluster Estimate</b>
+ <span property="libns:cluster_estimate" datatype="xsd:decimal"
+ content="{{lane.cluster_estimate}}">{{ lane.cluster_estimate|intcomma }}</span><br/>
+ <b>Lane Status</b>:
+ <span property="libns:status">{{ lane.status }}</span><br/>
+ <b>Comment</b>:
+ <span property="libns:comment">{{ lane.comment }}</span><br/>
+
+
+ <div rel="libns:library" resource="{{lib.get_absolute_url}}">
+ <h2>About the library</h2>
+ <b>Library ID</b>:
+ <a href="{{lib.get_absolute_url}}" property="libns:library_id">{{ lib.id }}</a><br/>
+ <b>Name</b>:
+ <span property="libns:name">{{ lib.library_name }}</span>
+ <br/>
+ <b>Species</b>:
+ <a href="{{lib.library_species.get_absolute_url}}" rel="libns:species"><span property="libns:species_name">{{ lib.library_species.scientific_name }}</span></a>
+ <br/>
+ <b>Concentration</b>:
+ <span property="libns:concentration">{{ lib.undiluted_concentration }} ng/µl</span>
+ <br/>
+ <b>Gel Cut Size</b>:
+ <span property="libns:gel_cut">{{ lib.gel_cut_size }}</span>
+ <br/>
+ <b>Insert Size</b>:
+ <span property="libns:insert_size">{{ lib.insert_size }}</span>
+ <br/>
+ <b>Background or Cell Line</b>:
+ <span property="libns:cell_line">{{ lib.cell_line }}</span>
+ <br/>
+ <b>Replicate</b>:
+ <span property="libns:replicate">{{ lib.replicate }}</span>
+ <br/>
+ <b>Library Type</b>:
+ <span property="libns:library_type">{{ lib.library_type }}</span>
+ <br/>
+ <b>Experiment Type</b>:
+ <span property="libns:experiment_type">{{ lib.experiment_type }}</span>
+ <br/>
+ <b>Made By</b>:
+ <span property="libns:made_by">{{ lib.made_by }}</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>Protocol Stopping Point</b>
+ <span property="libns:stopping_point">{{ lib.stopping_point_name }}</span>
+ <br/>
+ <b>Affiliations</b>:
+ <ul>
+ {% for individual in lib.affiliations.all %}
+ <li property="libns:affliation" content="{{individual.name}}">
+ {{ individual.name }} ( {{ individual.contact }} )
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+</div>
+{% endblock %}
{% block additional_javascript %}
{% endblock %}
-<style type="text/css">
- /* <![CDATA[ */
- div#librarydetail {
- margin: 0;
- padding: 0;
- }
- div#librarydetail table, div#librarydetail td {
- border-style: solid;
- }
- div#librarydetail table {
- border-width: 0 0 1px 1px;
- border-spacing: 0;
- border-collapse: collapse;
- }
- div#librarydetail td {
- margin: 0;
- padding: 3px;
- border-width: 1px 1px 0 0;
- }
- div#librarydetail thead {
- text-align: center;
- }
- div#librarydetail tbody {
- text-align: right;
- }
- 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;
- }
-
- div#librarydetail ul,
- div#librarydetail ol
- {
- margin-bottom: .5em;
- }
- /* ]]> */
-</style>
{% endblock %}
{% block content %}
-<div id="librarydetail">
+<div id="library_detail">
<h2>About this library</h2>
<b>Library ID</b>: {{ lib.id }}<br/>
<b>Name</b>:
<span property="libns:name">{{ lib.library_name }}</span>
<br/>
<b>Species</b>:
- <span property="libns:species">{{ lib.library_species.scientific_name }}</span>
+ <a href="{{lib.library_species.get_absolute_url}}" rel="libns:species">
+ <span property="libns:species_name">{{ lib.library_species.scientific_name }}</span></a>
<br/>
<b>Concentration</b>:
<span property="libns:concentration">{{ lib.undiluted_concentration }} ng/µl</span>
</li>
{% endfor %}
</ul>
-
+ <div class="htswdetail">
<h2>Raw Result Files</h2>
<table>
<thead>
</thead>
<tbody>
{% for result in eland_results %}
- <tr about="/flowcell/{{result.flowcell_id}}/lane/{{result.lane}}">
+ <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 property="libns:flowcell_id">{{ result.flowcell_id }}</td>
- <td property="libns:lane">{{ result.lane }}</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>
<tbody>
{% for lane in lane_summary_list %}
- <tr about="/flowcell/{{lane.flowcell_id}}/lane/{{lane.lane_id}}/end/{% if lane.end %}{{ lane.end }}{% endif %}">
+ <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>
</thead>
<tbody>
{% for lane in lib.lane_set.all %}
- <tr>
- <td>{{ lane.flowcell.flowcell_id }}</td>
- <td>{{ lane.lane_number }}</td>
+ <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>
- <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 %}
{% endblock %}
+ </div>
</div>
{% endblock %}
</thead>
<tbody >
{% for lib in library_list %}
- <tr about="/library/{{lib.library_id}}">
- <td ><a href="/library/{{ lib.library_id }}">{{ lib.amplified_from }}</a></td>
- <td ><a href="/library/{{ lib.library_id }}" property="libns:library_id">{{ lib.library_id }}</a></td>
- <td ><a href="/library/{{ lib.library_id }}" property="libns:species_name">{{ lib.species_name }}</a></td>
- <td ><a href="/library/{{ lib.library_id }}" property="libns:library_name">{{ lib.library_name }}</a></td>
+ <tr about="{{lib.library.get_absolute_url}}">
+ <td ><a href="{{lib.library.get_absolute_url}}">{{ lib.amplified_from }}</a></td>
+ <td ><a href="{{lib.library.get_absolute_url}}"><span property="libns:library_id">{{ lib.library_id }}</span></a></td>
+ <td ><a href="{{lib.library.library_species.get_absolute_url}}" rel="libns:species"><span property="libns:species_name">{{ lib.species_name }}</span></a></td>
+ <td ><a href="{{ lib.library.get_absolute_url }}"><span property="libns:library_name">{{ lib.library_name }}</span></a></td>
<td bgcolor="#00BFFF">{{ lib.lanes_run.0.0 }}</td>
<td bgcolor="#00BFFF">{{ lib.lanes_run.0.1 }}</td>
<td bgcolor="#00BFFF">{{ lib.lanes_run.0.2 }}</td>
--- /dev/null
+{% 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 %}
+{% endblock %}
+
+{% block content %}
+<div id="genome_detail">
+ <h2>About this Genome</h2>
+ <b>Common Name</b>:
+ <span property="libns:species">{{ species.common_name}}</span><br/>
+ <b>Scientific Name</b>:
+ <span property="libns:species">{{ species.scientific_name}}</span><br/>
+</div>
+{% endblock %}
#(r'^admin/(.*)', admin.site.root),
# Experiments:
(r'^experiments/', include('htsworkflow.frontend.experiments.urls')),
+ # Flowcell:
+ (r'^flowcell/(?P<flowcell_id>\w+)/(?P<lane_number>\w+)/',
+ 'htsworkflow.frontend.experiments.views.flowcell_lane_detail'),
+ (r'^flowcell/(?P<flowcell_id>\w+)/',
+ 'htsworkflow.frontend.experiments.views.flowcell_detail'),
# AnalysTrack:
#(r'^analysis/', include('htsworkflow.frontend.analysis.urls')),
# Inventory urls