+import logging
import urlparse
from django.db import models
from django.contrib.auth.models import User, UserManager
from htsworkflow.frontend import settings
from htsworkflow.frontend.reports.libinfopar import *
+
# Create your models here.
+logger = logging.getLogger(__name__)
class Antibody(models.Model):
antigene = models.CharField(max_length=500, db_index=True)
('2A', 'Ligation, PCR, gel, PCR'),
('Done', 'Completed'),
)
+ PROTOCOL_END_POINTS_DICT = dict(PROTOCOL_END_POINTS)
+
stopping_point = models.CharField(max_length=25, choices=PROTOCOL_END_POINTS, default='Done')
amplified_from_sample = models.ForeignKey('self', blank=True, null=True, related_name='amplified_into_sample')
return u'#%s: %s' % (self.id, self.library_name)
class Meta:
- verbose_name_plural = "libraries"
- #ordering = ["-creation_date"]
- ordering = ["-id"]
+ verbose_name_plural = "libraries"
+ #ordering = ["-creation_date"]
+ ordering = ["-id"]
def antibody_name(self):
str ='<a target=_self href="/admin/samples/antibody/'+self.antibody.id.__str__()+'/" title="'+self.antibody.__str__()+'">'+self.antibody.nickname+'</a>'
else:
return False
+ def stopping_point_name(self):
+ end_points = Library.PROTOCOL_END_POINTS_DICT
+ name = end_points.get(self.stopping_point, None)
+ if name is None:
+ name = "Lookup Error"
+ logger.error("protocol stopping point in database didn't match names in library model")
+ return name
+
+
def libtags(self):
affs = self.tags.all().order_by('tag_name')
ar = []
summary['lanes_run'] = lanes_run
summary['is_archived'] = lib.is_archived()
records.append(summary)
- cl.result_count = unicode(cl.paginator._count) + u" libraries"
+ cl.result_count = unicode(cl.paginator._count)
return {'library_list': records }
def library(request):
context.update(create_library_context(fcl))
t = get_template('samples/library_index.html')
c = RequestContext(request, context)
+ return HttpResponse( t.render(c) )
- app_context = {
- 'page_name': 'Library Index',
- 'body': t.render(c)
- }
- app_context.update(SAMPLES_CONTEXT_DEFAULTS)
-
- app_t = get_template('flowcell_libraries_app.html')
- app_c = RequestContext(request, app_context)
- return HttpResponse( app_t.render(app_c) )
def library_to_flowcells(request, lib_id):
"""
--- /dev/null
+<!--overrride pagination-->
+{% load admin_list %}
+{% load i18n %}
+<p class="paginator">
+{% if pagination_required %}
+{% for i in page_range %}
+ {% paginator_number cl i %}
+{% endfor %}
+{% endif %}
+{{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endifequal %}
+{% if show_all_url %}  <a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %}
+{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>{% endif %}
+</p>
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html lang="en">
-<head>
- <title>{% block title %}{{ app_name }} - {{ page_name }}{% endblock %}</title>
-
- <!-- ADMIN STYLE INTERFACE STUFF -->
- {% block additional_css %}
- {% endblock %}
-
- <!-- 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 %}
-
- <script type="text/javascript" src="/static/js/htsw.js"></script>
-</head>
-<body class="{% block bodyclass %}{% endblock %}">
- <!-- Content -->
- <div id="content" class="{% block coltype %}colM{% endblock %}">
- {% block pretitle %}{% endblock %}
- {% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
- {% block content %}
- {% block object-tools %}{% endblock %}
- {{ body }}
- {% endblock %}
- {% block sidebar %}{% endblock %}
- <br class="clear" />
- </div>
- <!-- END Content -->
-
- {% block footer %}<div id="footer"></div>{% endblock %}
-</body>
-</html>
-{% load i18n %}
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html lang="en">
+{% load i18n %}<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
+ "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ version="XHTML+RDFa 1.0"
+ xmlns:xml="http://www.w3.org/1999/xhtml"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:xmls="http://www.w3.org/2001/XMLSchema#"
+ xmlns:libns="http://jumpgate.caltech.edu/wiki/LibraryOntology#"
+ xml:lang="en"
+>
+<!--base.html-->
<head>
<title>{% block title %}{{ app_name }} - {{ page_name }}{% endblock %}</title>
{% 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="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %}
+ <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>
{% endif %}
{% block nav-global %}{% endblock %}
</div>
-
- {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a>{% if title %} › {{ title }}{% endif %}</div>{% endblock %}
{% endif %}
{% if messages %}
<ul class="messagelist">{% for message in messages %}<li>{{ message }}</li>{% endfor %}</ul>
+++ /dev/null
-{% extends "app_base.html" %}
-
-{% block additional_css %}
- {% load adminmedia %}
- {% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% admin_media_prefix %}css/rtl.css{% endblock %}" />{% endif %}
- {% block extrastyle %}{% endblock %}
- {% block extrahead %}{% endblock %}
- {% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
- <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/data-browse-index.css" />
-{% endblock %}
-
-{% block dynamic_panels %}
- <ul id="Libraries" class="x-hidden">
- <li>
- <img src="/static/img/s.gif" class="icon-show-all" />
- <a href="{% url htsworkflow.frontend.samples.views.library %}">Index</a><br />
- </li>
- </ul>
- <ul id="Flowcells" class="x-hidden">
- <li>
- <img src="/static/img/s.gif" class="icon-show-all" />
- <a href="/runfolders/">Run Folders</a><br />
- </li>
- </ul>
-{% endblock %}
-
-{% block app_toolbar_west %}
- <div id="Library Index" href="{% url htsworkflow.frontend.samples.views.library %}"></div>
- <div id="Run Folders" href="/runfolders/"></div>
-{% endblock %}
-
-{% block app_toolbar_east %}
- <!--<div id="Admin" href="/admin/"></div>-->
-{% endblock %}
+++ /dev/null
-{% extends "app_base.html" %}
-
-{% block additional_css %}
-{% endblock %}
-
-{% block dynamic_panels %}
- <ul id="Libraries" class="x-hidden">
- <li>
- <img src="/static/img/s.gif" class="icon-show-all" />
- <a href="{% url htsworkflow.frontend.samples.views.library %}">Index</a><br />
- </li>
- </ul>
-{% endblock %}
-
-{% block app_toolbar_west %}
- <div id="Inventory Index" href="{% url htsworkflow.frontend.inventory.views.index %}"></div>
-{% endblock %}
-
-{% block app_toolbar_east %}
- <!--<div id="Admin" href="/admin/"></div>-->
-{% endblock %}
-{% extends "app_base.html" %}
+{% extends "base_site.html" %}
{% load i18n %}
{% block additional_css %}{% load adminmedia %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/base.css" />
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/login.css" />
{% endblock %}
+
{% block title %}Login{% endblock %}
{% block bodyclass %}login{% endblock %}
<p class="errornote">{{ error_message }}</p>
{% endif %}
<div id="container">
- <div id="header">
<h1>Login</h1>
- </div>
<form action="{{ app_path }}" method="post" id="login-form">
<div class="form-row">
<label for="id_username">{% trans 'Username:' %}</label> <input type="text" name="username" id="id_username" />
-{% extends "flowcell_libraries_app.html" %}
+{% extends "base_site.html" %}
{% block content %}
<table>
{% extends "base_site.html" %}
-{# extends "app_base.html" #}
{% load adminmedia admin_list i18n %}
{% block bodyclass %}change-list{% endblock %}
-{% extends "flowcell_libraries_app.html" %}
-{% 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 %}
-{% block additional_css %}
<style type="text/css">
/* <![CDATA[ */
div#librarydetail {
<div id="librarydetail">
<h2>About this library</h2>
<b>Library ID</b>: {{ lib.id }}<br/>
- <b>Name</b>: {{ lib.library_name }}<br/>
- <b>Species</b>: {{ lib.library_species.scientific_name }}<br/>
- <b>Concentration</b>: {{ lib.undiluted_concentration }} ng/µl<br/>
- <b>Gel Cut Size</b>: {{ lib.gel_cut_size }}<br/>
- <b>Insert Size</b>: {{ lib.insert_size }}<br/>
- <b>Replicate</b>: {{ lib.replicate }}<br/>
- <b>Made By</b>: {{ lib.made_by }} <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>
+ <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:creation_date">{{ 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>{{ individual.name }} ( {{ individual.contact }} )</li>
+ <li property="libns:affliation" content="{{individual.name}}">
+ {{ individual.name }} ( {{ individual.contact }} )
+ </li>
{% endfor %}
</ul>
<td>Bed</td>
<td>Archived</td>
</tr>
- {% for result in eland_results %}
- <tr>
- <td>{{ result.run_date|date }}</td>
- <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>
- <td>
- {% if result.storage_ids %}
- {{ result.storage_ids|safe }}
+ </thead>
+ <tbody>
+ {% for result in eland_results %}
+ <tr about="/flowcell/{{result.flowcell_id}}/lane/{{result.lane}}">
+ <td property="libns:run_date" contents="{{result.run_date}}" datatype="xmls: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.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 %}
+ </td>
+ <td>
+ {% if result.storage_ids %}
+ {{ result.storage_ids|safe }}
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
</table>
<h2>Lane Summary Statistics</h2>
<tbody>
{% for lane in lane_summary_list %}
- <tr>
+ <tr about="/flowcell/{{lane.flowcell_id}}/lane/{{lane.lane_id}}/end/{% if lane.end %}{{ lane.end }}{% endif %}">
<td>{{ lane.cycle_width }}</td>
<td>{{ lane.flowcell_id }}</td>
<td>{{ lane.lane_id }}</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 property="libns:sequence_unique_location" contents="{{lane.unique_reads}}" datatype="xmls:decimal">{{ 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>
<table>
<thead>
<tr>
- <td>Flowcell ID</td>
- <td>Lane</td>
- <td>Comment</td>
+ <td>Flowcell ID</td>
+ <td>Lane</td>
+ <td>Comment</td>
+ </tr>
</thead>
<tbody>
{% for lane in lib.lane_set.all %}
<tr>
- <td>{{ lane.flowcell.flowcell_id }}</td>
- <td>{{ lane.lane_number }}</td>
- <td>{{ lane.comment }}</td>
- {% endfor %}
+ <td>{{ lane.flowcell.flowcell_id }}</td>
+ <td>{{ lane.lane_number }}</td>
+ <td>{{ lane.comment }}</td>
+ </tr>
+ {% endfor %}
</tbody>
</table>
<br/>
{% extends "base_site.html" %}
{% load adminmedia admin_list i18n %}
{% block extrahead %}
+ <!-- App Stuff -->
+ <link type="text/css" rel="stylesheet" href="/static/css/app.css" />
+
+ {% block additional_javascript %}
+ <script type="text/javascript" src="/static/js/jquery.min.js"></script>
+ <script type="text/javascript" src="/static/js/htsw.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(window).resize(function() {
$(window).resize();
});
</script>
+ {% endblock %}
{% endblock %}
{% block bodyclass %}change-list{% endblock %}
{% block coltype %}flex{% endblock %}
+
{% block content %}
<div id="library-index-div" >
<div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
{% for spec in cl.filter_specs %}
{% admin_list_filter cl spec %}
{% endfor %}
- </div>
+ </div>
{% endif %}
{% endblock %}
{% block summary_stats %}
</thead>
<tbody >
{% for lib in library_list %}
- <tr >
+ <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 }}">{{ lib.library_id }}</a></td>
- <td ><a href="/library/{{ lib.library_id }}">{{ lib.species_name }}</a></td>
- <td ><a href="/library/{{ lib.library_id }}">{{ lib.library_name }}</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>
<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>
{% endfor %}
</tbody>
</table>
+ </div>
{% endblock %}
</div>
{% endblock %}