+import logging
import urlparse
from django.db import models
from django.contrib.auth.models import User, UserManager
from django.db.models.signals import pre_save, post_save
from django.db import connection
-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)
max_length=20,
blank=True,
null=True,
- db_index=True,
- verbose_name = 'Short Name'
+ db_index=True
)
catalog = models.CharField(max_length=50, unique=True, db_index=True)
antibodies = models.CharField(max_length=500, db_index=True)
nickname = models.CharField(max_length=20,
blank=True,
null=True,
- db_index=True,
- verbose_name = 'Short Name')
+ db_index=True)
+
notes = models.TextField(blank=True)
def __unicode__(self):
return unicode(self.cellline_name)
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')
# New field Aug/19/08
# SQL to add column: alter table fctracker_library add column "replicate" smallint unsigned NULL;
REPLICATE_NUM = ((1,1),(2,2),(3,3),(4,4))
- replicate = models.PositiveSmallIntegerField(choices=REPLICATE_NUM,default=1)
+ replicate = models.PositiveSmallIntegerField(choices=REPLICATE_NUM,blank=True,null=True)
experiment_type = models.ForeignKey(ExperimentType)
library_type = models.ForeignKey(LibraryType, blank=True, null=True)
creation_date = models.DateField(blank=True, null=True)
('1A', 'Ligation, then gel'),
('PCR', 'Ligation, then PCR'),
('1Ab', 'Ligation, PCR, then gel'),
- ('1Aa', 'Ligation, gel, then PCR'),
+ ('1Ac', 'Ligation, gel, then 12x PCR'),
+ ('1Aa', 'Ligation, gel, then 18x PCR'),
('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>'
+ str ='<a target=_self href="/admin/samples/antibody/'+self.antibody.id.__str__()+'/" title="'+self.antibody.__str__()+'">'+self.antibody.label+'</a>'
return str
antibody_name.allow_tags = True
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 = []
@models.permalink
def get_absolute_url(self):
return ('htsworkflow.frontend.samples.views.library_to_flowcells', [str(self.id)])
-
-
-
class HTSUser(User):