+import logging
+
+from django.core.exceptions import ObjectDoesNotExist
+from django.core import urlresolvers
from django.db import models
+
from htsworkflow.frontend.samples.models import *
from htsworkflow.frontend.settings import options
-from django.core.exceptions import ObjectDoesNotExist
-import logging
class ClusterStation(models.Model):
name = models.CharField(max_length=50, unique=True)
except ValueError,e:
logging.error("invalid value for frontend.default_pm")
-
-
-
class FlowCell(models.Model):
flowcell_id = models.CharField(max_length=20, unique=True, db_index=True)
advanced_run = models.BooleanField(default=False)
paired_end = models.BooleanField(default=False)
read_length = models.IntegerField(default=32) #Stanford is currenlty 25
+ control_lane = models.IntegerField(choices=[(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(0,'All Lanes')], null=True)
cluster_station = models.ForeignKey(ClusterStation, default=3)
sequencer = models.ForeignKey(Sequencer, default=1)
class Meta:
ordering = ["-run_date"]
-
+
+ def get_admin_url(self):
+ # 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"
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('htsworkflow.frontend.experiments.views.flowcell_detail',
+ [str(self.flowcell_id)])
+
### -----------------------
class DataRun(models.Model):
ConfTemplate = "CONFIG PARAMS WILL BE GENERATED BY THE PIPELINE SCRIPT.\nYOU'LL BE ABLE TO EDIT AFTER IF NEEDED."
return str
Flowcell_Info.allow_tags = True
+LANE_STATUS_CODES = [(0, 'Failed'),
+ (1, 'Marginal'),
+ (2, 'Good'),]
+LANE_STATUS_MAP = dict((int(k),v) for k,v in LANE_STATUS_CODES )
+LANE_STATUS_MAP[None] = "Unknown"
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)])
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)
+ 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)])