From: Rami Rauch Date: Tue, 7 Oct 2008 21:56:06 +0000 (+0000) Subject: Added a display column (not DB) to show the total count of alligned reads for each... X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=7e2817f11e42fdc5aa33cf310bc50e6346bed3ca Added a display column (not DB) to show the total count of alligned reads for each library record --- diff --git a/htswfrontend/htswfrontend/fctracker/models.py b/htswfrontend/htswfrontend/fctracker/models.py index 3dfd513..b7d3abd 100644 --- a/htswfrontend/htswfrontend/fctracker/models.py +++ b/htswfrontend/htswfrontend/fctracker/models.py @@ -1,5 +1,6 @@ from django.db import models from htswfrontend import settings +from htswfrontend.htsw_reports.libinfopar import * class Primer(models.Model): primer_name = models.CharField(max_length=100, db_index=True) @@ -170,11 +171,14 @@ class Library(models.Model): class Meta: verbose_name_plural = "libraries" - ordering = ["-library_id"] + ordering = ["-creation_date"] #["-library_id"] def antibody_name(self): return self.antibody.nickname + def org(self): + return self.library_species.common_name + def affiliation(self): affs = self.affiliations.all().order_by('name') tstr = '' @@ -183,13 +187,39 @@ class Library(models.Model): ar.append(t.__str__()) return '%s' % (", ".join(ar)) + + def aligned_reads(self): + res = getLibReads(self.library_id) + rc = "%1.2f" % (res[1]/1000000.0) + # Color Scheme: green is more than 10M, blue is more than 5M, orange is more than 3M and red is less. For RNAseq, all those thresholds should be doubled + if res[0] > 0: + bgcolor = '#ff3300' # Red + rc_thr = [10000000,5000000,3000000] + if self.experiment_type == 'RNA-seq': + rc_thr = [20000000,10000000,6000000] + + if res[1] > rc_thr[0]: + bgcolor = '#66ff66' # Green + else: + if res[1] > rc_thr[1]: + bgcolor ='#00ccff' # Blue + else: + if res[1] > rc_thr[2]: + bgcolor ='#ffcc33' # Orange + tstr = '
' + tstr += res[0].__str__()+' Lanes, '+rc+' M Reads' + tstr += '
' + else: tstr = 'not processed yet' + return tstr + aligned_reads.allow_tags = True + class Admin: date_hierarchy = "creation_date" save_as = True save_on_top = True ##search_fields = ['library_id','library_name','affiliations__name','affiliations__contact','made_by','made_for','antibody__antigene','antibody__catalog','antibody__antibodies','antibody__source','cell_line__cellline_name','library_species__scientific_name','library_species__common_name','library_species__use_genome_build'] search_fields = ['library_id','library_name','cell_line__cellline_name','library_species__scientific_name','library_species__common_name','library_species__use_genome_build'] - list_display = ('affiliation','library_id', 'library_name','experiment_type','replicate','antibody_name','cell_line','made_by','creation_date') + list_display = ('affiliation','library_id','aligned_reads','library_name','experiment_type','org','replicate','antibody_name','cell_line','made_by','creation_date') list_display_links = ('library_id', 'library_name') list_filter = ('experiment_type','affiliations','library_species','made_for', 'made_by','replicate') fields = (