from django.db import models
from gaworkflow.frontend import settings
-# Create your models here.
+class Antibody(models.Model):
+
+ antibody_name = models.CharField(max_length=100, unique=True, db_index=True, core=True)
+ notes = models.TextField(blank=True)
+ def __str__(self):
+ return self.antibody_name
+ class Meta:
+ verbose_name_plural = "antibodies"
+ ordering = ["antibody_name"]
+ class Admin:
+ fields = (
+ (None, {
+ 'fields': (('antibody_name','notes'),)
+ }),
+ )
+
+class Cellline(models.Model):
+
+ cellline_name = models.CharField(max_length=100, unique=True, db_index=True, core=True)
+ notes = models.TextField(blank=True)
+ def __str__(self):
+ return self.cellline_name
+
+ class Meta:
+ ordering = ["cellline_name"]
+
+ class Admin:
+ fields = (
+ (None, {
+ 'fields': (('cellline_name','notes'),)
+ }),
+ )
+
+class Condition(models.Model):
+
+ condition_name = models.CharField(max_length=2000, unique=True, db_index=True, core=True)
+ notes = models.TextField(blank=True)
+ def __str__(self):
+ return self.condition_name
+
+ class Meta:
+ ordering = ["condition_name"]
+
+ class Admin:
+ fields = (
+ (None, {
+ 'fields': (('condition_name','notes'),)
+ }),
+ )
class Species(models.Model):
scientific_name = models.CharField(max_length=256, unique=False, db_index=True, core=True)
common_name = models.CharField(max_length=256, blank=True)
- use_genome_build = models.CharField(max_length=100, blank=False, null=False)
+ use_genome_build = models.CharField(max_length=100, blank=True) #blank=False, null=False)
def __str__(self):
return '%s (%s)|%s' % (self.scientific_name, self.common_name, self.use_genome_build)
class Library(models.Model):
- library_id = models.IntegerField(primary_key=True, db_index=True, core=True)
+ library_id = models.CharField(max_length=30, unique=True, db_index=True, core=True)
library_name = models.CharField(max_length=100, unique=True, core=True)
library_species = models.ForeignKey(Species, core=True)
#use_genome_build = models.CharField(max_length=100, blank=False, null=False)
- RNAseq = models.BooleanField()
-
- made_by = models.CharField(max_length=50, blank=True, default="Lorian")
+ #RNAseq = models.BooleanField()
+ cell_line = models.ForeignKey(Cellline, blank=True, core=True)
+ condition = models.ForeignKey(Condition,blank=True,core=True)
+ antibody = models.ForeignKey(Antibody,blank=True,core=True)
+
+ EXPERIMENT_TYPES = (
+ ('INPUT_RXLCh','INPUT_RXLCh'),
+ ('ChIP-seq', 'ChIP-seq'),
+ ('Sheared', 'Sheared'),
+ ('RNA-seq', 'RNA-seq'),
+ ('Methyl-seq', 'Methyl-seq'),
+ ('DIP-seq', 'DIP-seq'),
+ )
+ experiment_type = models.CharField(max_length=50, choices=EXPERIMENT_TYPES, default='ChIP-seq')
+
+ made_by = models.CharField(max_length=50, blank=True)
creation_date = models.DateField(blank=True, null=True)
made_for = models.CharField(max_length=50, blank=True)
+ made_by = models.CharField(max_length=50, blank=True)
PROTOCOL_END_POINTS = (
+ ('Completed','Completed'),
('?', 'Unknown'),
('Sample', 'Raw sample'),
('Gel', 'Ran gel'),
('2A', '2nd PCR'),
('Progress', 'In progress'),
)
- stopping_point = models.CharField(max_length=50, choices=PROTOCOL_END_POINTS)
+ stopping_point = models.CharField(max_length=50, choices=PROTOCOL_END_POINTS, default='Completed')
amplified_from_sample = models.ForeignKey('self', blank=True, null=True)
- undiluted_concentration = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True)
+ undiluted_concentration = models.DecimalField("Template concentr. (ng/ul)",max_digits=5, decimal_places=2, blank=True, null=True)
ten_nM_dilution = models.BooleanField()
- successful_pM = models.IntegerField(blank=True, null=True)
-
+ successful_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=True, null=True)
+ avg_lib_size = models.IntegerField()
notes = models.TextField(blank=True)
def __str__(self):
save_as = True
save_on_top = True
search_fields = ['library_name']
- list_display = ('library_id', 'library_name', 'made_for', 'creation_date', 'ten_nM_dilution', 'stopping_point', 'successful_pM')
+ list_display = ('library_id', 'library_name', 'made_by', 'creation_date', 'ten_nM_dilution', 'stopping_point', 'successful_pM')
list_display_links = ('library_id', 'library_name')
list_filter = ('stopping_point', 'ten_nM_dilution', 'library_species', 'made_for', 'made_by')
fields = (
(None, {
- 'fields': (('library_id', 'library_name'), ('library_species', 'RNAseq'),)
+ 'fields': (('library_id', 'library_name'), ('library_species'),)
}),
('Creation Information:', {
- 'fields' : (('made_for', 'made_by', 'creation_date'), ('stopping_point', 'amplified_from_sample'), ('undiluted_concentration', 'ten_nM_dilution', 'successful_pM'), 'notes',)
+ 'fields' : (('made_for', 'made_by', 'creation_date'), ('stopping_point', 'amplified_from_sample'), ('avg_lib_size','undiluted_concentration', 'ten_nM_dilution', 'successful_pM'), 'notes',)
}),
- )
+ )
class FlowCell(models.Model):
flowcell_id = models.CharField(max_length=20, unique=True, db_index=True, core=True)
run_date = models.DateTimeField(core=True)
advanced_run = models.BooleanField(default=False)
- read_length = models.IntegerField(default=32)
+ read_length = models.IntegerField(default=32) #Stanford is currenlty 25
lane_1_library = models.ForeignKey(Library, related_name="lane_1_library")
lane_2_library = models.ForeignKey(Library, related_name="lane_2_library")
lane_7_library = models.ForeignKey(Library, related_name="lane_7_library")
lane_8_library = models.ForeignKey(Library, related_name="lane_8_library")
- lane_1_pM = models.IntegerField(default=4)
- lane_2_pM = models.IntegerField(default=4)
- lane_3_pM = models.IntegerField(default=4)
- lane_4_pM = models.IntegerField(default=4)
- lane_5_pM = models.IntegerField(default=4)
- lane_6_pM = models.IntegerField(default=4)
- lane_7_pM = models.IntegerField(default=4)
- lane_8_pM = models.IntegerField(default=4)
+ lane_1_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
+ lane_2_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
+ lane_3_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
+ lane_4_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
+ lane_5_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
+ lane_6_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
+ lane_7_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
+ lane_8_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5)
lane_1_cluster_estimate = models.IntegerField(blank=True, null=True)
lane_2_cluster_estimate = models.IntegerField(blank=True, null=True)
lane_7_cluster_estimate = models.IntegerField(blank=True, null=True)
lane_8_cluster_estimate = models.IntegerField(blank=True, null=True)
+ #Machine Names
+ CLUSTER_MAC = (
+ ('M304','M304'),
+ ('R349','R349'),
+ ('Tinkerbell','Tinkerbell'),
+ ('BitBit','BitBit'),
+ )
+
+ SEQ_MAC = (
+ ('EAS149','EAS149'),
+ ('EAS46','EAS46'),
+ ('EAS45','Paris'),
+ ('Britney','Britney'),
+ )
+
+ #kit_id = models.CharField(max_length=50, blank=True)
+ cluster_mac_id = models.CharField(max_length=50, choices=CLUSTER_MAC, default='M304')
+ seq_mac_id = models.CharField(max_length=50, choices=SEQ_MAC, default='EAS149')
+
notes = models.TextField(blank=True)
def __str__(self):
- return '%s (%s)' % (self.flowcell_id, self.run_date)
-
+ #return '%s (%s)' % (self.flowcell_id, self.run_date)
+ return '%s' % (self.flowcell_id)
+
class Meta:
ordering = ["run_date"]
class Admin:
+ save_on_top = True
date_hierarchy = "run_date"
save_on_top = True
search_fields = ['lane_1_library', 'lane_2_library', 'lane_3_library', 'lane_4_library', 'lane_5_library', 'lane_6_library', 'lane_7_library', 'lane_8_library']
list_display = ('flowcell_id', 'run_date', 'lane_1_library', 'lane_2_library', 'lane_3_library', 'lane_4_library', 'lane_5_library', 'lane_6_library', 'lane_7_library', 'lane_8_library')
fields = (
(None, {
- 'fields': ('run_date', 'flowcell_id', ('read_length', 'advanced_run'),)
+ 'fields': ('run_date', ('flowcell_id','cluster_mac_id','seq_mac_id'), ('read_length'),)
}),
('Lanes:', {
'fields' : (('lane_1_library', 'lane_1_pM', 'lane_1_cluster_estimate'), ('lane_2_library', 'lane_2_pM', 'lane_2_cluster_estimate'), ('lane_3_library', 'lane_3_pM', 'lane_3_cluster_estimate'), ('lane_4_library', 'lane_4_pM', 'lane_4_cluster_estimate'), ('lane_5_library', 'lane_5_pM', 'lane_5_cluster_estimate'), ('lane_6_library', 'lane_6_pM', 'lane_6_cluster_estimate'), ('lane_7_library', 'lane_7_pM', 'lane_7_cluster_estimate'), ('lane_8_library', 'lane_8_pM', 'lane_8_cluster_estimate'),)
}),
)
-class ElandResult(models.Model):
-
- class Admin: pass
-
- flow_cell = models.ForeignKey(FlowCell)
- config_file = models.FileField(upload_to=settings.UPLOADTO_CONFIG_FILE)
- eland_result_pack = models.FileField(upload_to=settings.UPLOADTO_ELAND_RESULT_PACKS)
- bed_file_pack = models.FileField(upload_to=settings.UPLOADTO_BED_PACKS)
-
- notes = models.TextField(blank=True)
+#class ElandResult(models.Model):
+#
+# class Admin: pass
+#
+# flow_cell = models.ForeignKey(FlowCell)
+# config_file = models.FileField(upload_to=settings.UPLOADTO_CONFIG_FILE)
+# eland_result_pack = models.FileField(upload_to=settings.UPLOADTO_ELAND_RESULT_PACKS)
+# bed_file_pack = models.FileField(upload_to=settings.UPLOADTO_BED_PACKS)
+#
+# notes = models.TextField(blank=True)