and allows filtering by username.
In addition I modified the library index to bin runs into
small (<40), medium (<100), and large (>=100) runs seperated by single
and paired end reads.
# that's the django way... except it didn't work
#return urlresolvers.reverse('admin_experiments_FlowCell_change', args=(self.id,))
return '/admin/experiments/flowcell/%s/' % (self.id,)
-
+
+ def flowcell_type(self):
+ """
+ Convert our boolean 'is paired' flag to a name
+ """
+ if self.paired_end:
+ return u"Paired"
+ else:
+ return u"Single"
+
### -----------------------
class DataRun(models.Model):
ConfTemplate = "CONFIG PARAMS WILL BE GENERATED BY THE PIPELINE SCRIPT.\nYOU'LL BE ABLE TO EDIT AFTER IF NEEDED."
self.opts = model._meta
self.lookup_opts = self.opts
if queryset is None:
- self.root_query_set = model.objects
+ self.root_query_set = model.objects.all()
else:
self.root_query_set = queryset
self.list_display = []
import simplejson as json
from htsworkflow.frontend.auth import require_api_key
-from htsworkflow.frontend.experiments.models import FlowCell
+from htsworkflow.frontend.experiments.models import FlowCell, Lane
from htsworkflow.frontend.samples.changelist import ChangeList
-from htsworkflow.frontend.samples.models import Library
+from htsworkflow.frontend.samples.models import Library, 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
'bcmagic': BarcodeMagicForm()
}
+def count_lanes(lane_set):
+ single = 0
+ paired = 1
+ short_read = 0
+ medium_read = 1
+ long_read = 2
+ counts = [[0,0,0,],[0,0,0]]
+
+ for lane in lane_set.all():
+ if lane.flowcell.paired_end:
+ lane_type = paired
+ else:
+ lane_type = single
+ if lane.flowcell.read_length < 40:
+ read_type = short_read
+ elif lane.flowcell.read_length < 100:
+ read_type = medium_read
+ else:
+ read_type = long_read
+ counts[lane_type][read_type] += 1
+
+ return counts
+
def create_library_context(cl):
"""
Create a list of libraries that includes how many lanes were run
summary['amplified_from'] = lib.amplified_from_sample.id
else:
summary['amplified_from'] = ''
- lanes_run = 0
- #for lane_id in LANE_LIST:
- # lane = getattr(lib, 'lane_%d_library' % (lane_id,))
- # lanes_run += len( lane.all() )
- lanes_run = lib.lane_set.count()
+ lanes_run = count_lanes(lib.lane_set)
+ # suppress zeros
+ for row in xrange(len(lanes_run)):
+ for col in xrange(len(lanes_run[row])):
+ if lanes_run[row][col] == 0:
+ lanes_run[row][col] = ''
summary['lanes_run'] = lanes_run
summary['is_archived'] = lib.is_archived()
records.append(summary)
context,
context_instance = RequestContext(request))
+def lanes_for(request, username=None):
+ """
+ Generate a report of recent activity for a user
+ """
+ query = {}
+ if username is not None:
+ user = HTSUser.objects.get(username=username)
+ query.update({'library__affiliations__users__id':user.id})
+ print query, username
+ fcl = ChangeList(request, Lane,
+ list_filter=[],
+ search_fields=['flowcell__flowcell_id', 'library__id', 'library__library_name'],
+ list_per_page=200,
+ queryset=Lane.objects.filter(**query)
+ )
+
+ context = { 'lanes': fcl, 'title': 'Lane Index'}
+
+ return render_to_response(
+ 'samples/lanes_for.html',
+ context,
+ context_instance = RequestContext(request)
+ )
+
+
def summaryhtm_fc_cnm(request, flowcell_id, cnm):
"""
returns a Summary.htm file if it exists.
Return information about a species.
"""
raise Http404
-
+
@login_required
def user_profile(request):
"""
{% load i18n %}
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="en">
+<head>
+ <title>{% block title %}{{ app_name }} - {{ page_name }}{% endblock %}</title>
+{% 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 %}
+
+</head>
+<body>
<!-- Container -->
{% if not is_popup %}
{% block footer %}<div id="footer" class="djangocss"></div>{% endblock %}
<!-- END Container -->
+</body>
+</html>
\ No newline at end of file
{% extends "base.html" %}
{% load i18n %}
+<link type="text/css" rel="stylesheet" href="/static/css/app.css" />
+
{% block title %}{{ sitename }}{% endblock %}
{% block branding %}
--- /dev/null
+{% extends "base_site.html" %}
+{# extends "app_base.html" #}
+{% load adminmedia admin_list i18n %}
+
+{% block bodyclass %}change-list{% endblock %}
+{% block coltype %}flex{% endblock %}
+
+{% block content %}
+<div id="lanes-index-div" class="djangocss">
+ <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
+ {% block search %}{% search_form lanes %}{% endblock %}
+
+ {% block filters %}
+ {% if lanes.has_filters %}
+ <div id="changelist-filter">
+ <h2 class="djangocss">{% trans 'Filter' %}</h2>
+ {% for spec in lanes.filter_specs %}
+ {% admin_list_filter lanes spec %}
+ {% endfor %}
+ </div>
+ {% endif %}
+ {% endblock %}
+
+
+ {% block pagination %}{% pagination lanes %}{% endblock %}
+
+{% block body %}
+<table class="djangocss">
+ <thead class="djangocss">
+ <tr class="djangocss">
+ <td class="djangocss">Run Date</td>
+ <td class="djangocss">Flowcell Type</td>
+ <td class="djangocss">Cycles</td>
+ <td class="djangocss">Flowcell ID</td>
+ <td class="djangocss">Lane</td>
+ <td class="djangocss">Library ID</td>
+ <td class="djangocss">Library Name</td>
+ </tr>
+ </thead>
+ <tbody class="djangocss">
+ {% for lane in lanes.query_set %}
+ <tr class="djangocss">
+ <td class="djangocss">
+ {{ lane.flowcell.run_date|date:"Y-M-d" }}
+ </td>
+ <td class="djangocss">
+ {{ lane.flowcell.flowcell_type }}
+ </td>
+ <td class="djangocss">
+ {{ lane.flowcell.read_length }}
+ </td>
+ <td class="djangocss">
+ {{ lane.flowcell.flowcell_id }}
+ </td>
+ <td class="djangocss">
+ {{ lane.lane_number }}
+ </td>
+ <td class="djangocss">
+ <a href="/library/{{ lane.library_id }}">{{ lane.library_id }}</a>
+ </td>
+ <td class="djangocss">
+ <a href="/library/{{ lane.library_id }}">{{ lane.library.library_name }}</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+</div>
+{% endblock %}
+{% endblock %}
<table class="djangocss">
<thead class="djangocss">
<tr class="djangocss">
- <td class="djangocss">Parent</td>
- <td class="djangocss">Library ID</td>
- <td class="djangocss">Species</td>
- <td class="djangocss">Library Name</td>
- <td class="djangocss">Total Lanes</td>
- <td class="djangocss">HD</td>
+ <td class="djangocss">Parent</td>
+ <td class="djangocss">Library ID</td>
+ <td class="djangocss">Species</td>
+ <td class="djangocss">Library Name</td>
+ <td colspan="3" class="djangocss">Single</td>
+ <td colspan="3" class="djangocss">Paired</td>
+ <td class="djangocss">HD</td>
+ </tr>
+ <tr class="djangocss">
+ <td colspan="4"></td>
+ <td><40</td>
+ <td><100</td>
+ <td>100+</td>
+ <td><40</td>
+ <td><100</td>
+ <td>100+</td>
+ <td></td>
</tr>
</thead>
<tbody class="djangocss">
<td class="djangocss"><a href="/library/{{ lib.library_id }}">{{ lib.library_id }}</a></td>
<td class="djangocss"><a href="/library/{{ lib.library_id }}">{{ lib.species_name }}</a></td>
<td class="djangocss"><a href="/library/{{ lib.library_id }}">{{ lib.library_name }}</a></td>
- <td class="djangocss">{{ lib.lanes_run }}</td>
+ <td class="djangocss" bgcolor="#00BFFF">{{ lib.lanes_run.0.0 }}</td>
+ <td class="djangocss" bgcolor="#00BFFF">{{ lib.lanes_run.0.1 }}</td>
+ <td class="djangocss" bgcolor="#00BFFF">{{ lib.lanes_run.0.2 }}</td>
+ <td class="djangocss" bgcolor="#66CDAA">{{ lib.lanes_run.1.0 }}</td>
+ <td class="djangocss" bgcolor="#66CDAA">{{ lib.lanes_run.1.1 }}</td>
+ <td class="djangocss" bgcolor="#66CDAA">{{ lib.lanes_run.1.2 }}</td>
{% if lib.is_archived %}
<td class="djangocss"><img src="/static/img/hdd_unmount.png" alt="Archived" /></td>
{% else %}
(r'^library/$', 'htsworkflow.frontend.samples.views.library'),
(r'^library/(?P<lib_id>\w+)/$',
'htsworkflow.frontend.samples.views.library_to_flowcells'),
+ (r'^lanes_for/$', 'htsworkflow.frontend.samples.views.lanes_for'),
+ (r'^lanes_for/(?P<username>\w+)', 'htsworkflow.frontend.samples.views.lanes_for'),
# library id to admin url
(r'^library_id_to_admin_url/(?P<lib_id>\w+)/$',
'htsworkflow.frontend.samples.views.library_id_to_admin_url'),