Controls display of Lanes on the Flowcell form.
"""
model = Lane
- max_num = 8
extra = 8
form = LaneForm
raw_id_fields = ('library',)
"pM": "8"
}
},
+ {"pk": 1192, "model": "experiments.lane",
+ "fields": {
+ "comment": "Other library",
+ "library": "11070",
+ "cluster_estimate": 132000,
+ "flowcell": 153,
+ "lane_number": 1,
+ "pM": "7"
+ }
+ },
+
{"pk": "10981", "model": "samples.library",
"fields": {
"ten_nM_dilution": false,
LANE_STATUS_MAP = dict((int(k),v) for k,v in LANE_STATUS_CODES )
LANE_STATUS_MAP[None] = "Unknown"
+def is_valid_lane(value):
+ if value >= 1 and value <= 8:
+ return True
+ else:
+ return False
+
class Lane(models.Model):
flowcell = models.ForeignKey(FlowCell)
- lane_number = models.IntegerField(choices=[(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8)])
+ lane_number = models.IntegerField(validators=[is_valid_lane])
library = models.ForeignKey(Library)
pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
cluster_estimate = models.IntegerField(blank=True, null=True)
@models.permalink
def get_absolute_url(self):
- flowcell_id, status = parse_flowcell_id(self.flowcell.flowcell_id)
return ('htsworkflow.frontend.experiments.views.flowcell_lane_detail',
- [str(flowcell_id), str(self.lane_number)])
+ [str(self.id)])
+ def __unicode__(self):
+ return self.flowcell.flowcell_id + ':' + unicode(self.lane_number)
### -----------------------
class DataRun(models.Model):
from django.template import RequestContext
from django.template.loader import get_template
-from htsworkflow.frontend.experiments.models import DataRun, DataFile, FlowCell
+from htsworkflow.frontend.experiments.models import \
+ DataRun, \
+ DataFile, \
+ FlowCell, \
+ Lane
from htsworkflow.frontend.experiments.experiments import \
estimateFlowcellDuration, \
estimateFlowcellTimeRemaining, \
return HttpResponse("I've got nothing.")
-def flowcell_detail(request, flowcell_id):
+def flowcell_detail(request, flowcell_id, lane_number=None):
fc = get_object_or_404(FlowCell, flowcell_id__startswith=flowcell_id)
fc.update_data_runs()
+
+ if lane_number is not None:
+ lanes = fc.lane_set.filter(lane_number=lane_number)
+ else:
+ lanes = fc.lane_set.all()
+
context = RequestContext(request,
- {'flowcell': fc})
+ {'flowcell': fc,
+ 'lanes': lanes})
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__startswith=flowcell_id)
- lane = get_object_or_404(fc.lane_set, lane_number=lane_number)
-
- fc.update_data_runs()
+def flowcell_lane_detail(request, lane_pk):
+ lane = get_object_or_404(Lane, id=lane_pk)
+ lane.flowcell.update_data_runs()
dataruns = []
- for run in fc.datarun_set.all():
+ for run in lane.flowcell.datarun_set.all():
dataruns.append((run, lane.lane_number, run.lane_files()[lane.lane_number]))
context = RequestContext(request,
{'lib': lane.library,
'lane': lane,
- 'flowcell': fc,
+ 'flowcell': lane.flowcell,
'filtered_dataruns': dataruns})
return render_to_response('experiments/flowcell_lane_detail.html',
self.check_literal_object(model, ['Drosophila melanogaster'], p=libNS['species'])
self.check_uri_object(model,
- [u'http://localhost/flowcell/303TUAAXX/1/'],
+ [u'http://localhost/lane/1193'],
p=libNS['has_lane'])
self.check_literal_object(model,
</tr>
</thead>
<tbody>
- {% for lane in flowcell.lane_set.all %}
+ {% for lane in lanes %}
<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>
# Experiments:
(r'^experiments/', include('htsworkflow.frontend.experiments.urls')),
# Flowcell:
- (r'^flowcell/(?P<flowcell_id>\w+)/(?P<lane_number>\w+)/',
+ (r'^lane/(?P<lane_pk>\w+)',
'htsworkflow.frontend.experiments.views.flowcell_lane_detail'),
- (r'^flowcell/(?P<flowcell_id>\w+)/$',
+ (r'^flowcell/(?P<flowcell_id>\w+)/((?P<lane_number>\w+)/)?$',
'htsworkflow.frontend.experiments.views.flowcell_detail'),
# AnalysTrack:
#(r'^analysis/', include('htsworkflow.frontend.analysis.urls')),