From: Rami Rauch Date: Fri, 20 Feb 2009 22:17:07 +0000 (+0000) Subject: added grey highlight for bad libraries (by tag text) X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=071c3c408bb57a8c946720fe52f518724528c099 added grey highlight for bad libraries (by tag text) --- diff --git a/htswfrontend/htswfrontend/htsw_reports/reports.py b/htswfrontend/htswfrontend/htsw_reports/reports.py index 251bc49..88db4ab 100755 --- a/htswfrontend/htswfrontend/htsw_reports/reports.py +++ b/htswfrontend/htswfrontend/htsw_reports/reports.py @@ -3,9 +3,11 @@ from django.http import HttpResponse from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render_to_response, get_object_or_404 -def getBgColor(reads_cnt,exp_type): +badLibBgColor = '#cccccc' +def getBgColor(reads_cnt,exp_type,isBadLib): + if isBadLib: return badLibBgColor # Color Scheme: green is more than 12M, blue is more than 5M, orange is more than 3M and red is less. For RNAseq, all those thresholds are ~ double - bgcolor = '#ff3300' # Red is the color for minimum read counts + bgcolor = '#ffcdd0' # Red is the color for minimum read counts rc_thr = [12000000,5000000,3000000] # Default for ChIP-Seq and Methyl-Seq if exp_type == 'RNA-seq': rc_thr = [20000000,10000000,6000000] @@ -25,6 +27,10 @@ def getBgColor(reads_cnt,exp_type): return bgcolor def report1(request): + if not request.user.is_authenticated(): + str= 'Please log in first' + return render_to_response('htsw_reports/report.html',{'main':str}) + EXP = 'ChIP-seq' if request.has_key('aflid'): @@ -33,7 +39,7 @@ def report1(request): AFL = Affiliation.objects.get(id=AFL_Id).name AFL_CNT = Affiliation.objects.get(id=AFL_Id).contact except ObjectDoesNotExist: - return HttpResponse("ERROR: Affiliation Record Not Found for: '"+AFL_ID+"'") + return HttpResponse("ERROR: Affiliation Record Not Found for: '"+AFL_Id+"'") else: AFL = 'ENCODE_Tier1' AFL_CNT = '' @@ -41,6 +47,9 @@ def report1(request): AFL_Id = Affiliation.objects.get(name=AFL,contact=AFL_CNT).id.__str__() except ObjectDoesNotExist: return HttpResponse("ERROR: Affiliation Record Not Found for: '"+AFL+"'") + + if request.user.username == 'caltech': + if AFL.find('ENCODE') < 0: return HttpResponse('Record Not Found
HOME
') TFall = Library.objects.values('antibody').order_by('antibody').distinct() CLLall = Library.objects.values('cell_line').order_by('cell_line').distinct() @@ -55,17 +64,23 @@ def report1(request): ######## str = '' - str += 'Main Page' + str += 'HOME' ##str += 'Max Replicates: '+MaxRep.replicate.__str__()+'' - str += 'Select another '+EXP+' Report: ' + + if request.user.username == 'caltech': + Affil_List = Affiliation.objects.filter(name__contains='ENCODE').distinct() + else: + Affil_List = Affiliation.objects.distinct() + + for af in Affil_List: str += '' + str += '>'+af.name+' '+af.contact+'' str += '' - str += 'color scheme: > 12 M > 5 M > 3 M < 3 M' + str += 'color scheme: > 12 M > 5 M > 3 M < 3 MBad Library' str += '' str += 'Switch to: '+AFL+' '+AFL_CNT+' RNA-Seq Report' @@ -111,10 +126,10 @@ def report1(request): else: cnt = rres[1] if cnt > 0: - str += "
" + str += "
" str += "%1.2f" % (cnt/1000000.0)+" M" - else: str += "
0 Reads" - str += "
"+R1.library_id+", "+R1.condition.nickname + else: str += "
0 Reads" + str += "
"+R1.library_id+", "+R1.condition.nickname if R1.libtags().find('Data submitted to DCC') != -1: str += "
data submitted
" str += "
" @@ -145,16 +160,16 @@ def report1(request): cnt = 0 for R1 in repReads: rres = R1.aligned_m_reads() - # Check data sanlty + # Check data sanity if rres[2] != 'OK': str += '
'+rres[2] else: cnt = rres[1] if cnt > 0: - str += "
" + str += "
" str += "%1.2f" % (cnt/1000000.0)+" M" - else: str += "
0 Reads" - str += "
"+R1.library_id+", "+R1.condition.nickname + else: str += "
0 Reads" + str += "
"+R1.library_id+", "+R1.condition.nickname if R1.libtags().find('Data submitted to DCC') != -1: str += "
data submitted
" str += "
" @@ -170,6 +185,10 @@ def report1(request): def report_RM(request): #for RNA-Seq and Methyl-Seq + if not request.user.is_authenticated(): + str= 'Please log in first' + return render_to_response('htsw_reports/report.html',{'main':str}) + EXP = 'RNA-seq' if request.has_key('exp'): @@ -181,7 +200,7 @@ def report_RM(request): #for RNA-Seq and Methyl-Seq AFL = Affiliation.objects.get(id=AFL_Id).name AFL_CNT = Affiliation.objects.get(id=AFL_Id).contact except ObjectDoesNotExist: - return HttpResponse("ERROR: Affiliation Record Not Found for: '"+AFL_ID+"'") + return HttpResponse("ERROR: Affiliation Record Not Found for: '"+AFL_Id+"'") else: AFL = 'ENCODE_Tier1' AFL_CNT = '' @@ -190,6 +209,9 @@ def report_RM(request): #for RNA-Seq and Methyl-Seq except ObjectDoesNotExist: return HttpResponse("ERROR: Affiliation Record Not Found for: '"+AFL+"'") + if request.user.username == 'caltech': + if AFL.find('ENCODE') < 0: return HttpResponse('Record Not Found ') + CLLall = Library.objects.values('cell_line').order_by('cell_line').distinct() CLLs = CLLall.filter(experiment_type=EXP,affiliations__name=AFL,affiliations__contact=AFL_CNT) @@ -200,23 +222,29 @@ def report_RM(request): #for RNA-Seq and Methyl-Seq if len(RepRecs) > 0: Reps = RepRecs[0].replicate str = '' - str += 'Main Page' - str += 'Select another '+EXP+' Report: ' + + if request.user.username == 'caltech': + Affil_List = Affiliation.objects.filter(name__contains='ENCODE').distinct() + else: + Affil_List = Affiliation.objects.distinct() + + for af in Affil_List: str += '' + str += '>'+af.name+' '+af.contact+'' str += '' if EXP == 'RNA-seq': - str += 'color scheme: > 20 M > 10 M > 6 M < 6 M' + str += 'color scheme: > 20 M > 10 M > 6 M < 6 MBad Library' str += '' str += 'Switch to: '+AFL+' '+AFL_CNT+' ChIP-Seq Report' str += ' | ' str += 'Methyl-Seq Report' else: - str += 'color scheme: > 12 M > 5 M > 3 M < 3 M' + str += 'color scheme: > 12 M > 5 M > 3 M < 3 MBad Library' str += '' str += 'Switch to: '+AFL+' '+AFL_CNT+' ChIP-Seq Report' str += ' | ' @@ -262,10 +290,10 @@ def report_RM(request): #for RNA-Seq and Methyl-Seq else: cnt = rres[1] if cnt > 0: - str += "
" + str += "
" str += "%1.2f" % (cnt/1000000.0)+" M" - else: str += "
0 Reads" - str += "
"+R1.library_id+", "+R1.condition.nickname+", "+R1.library_species.common_name+"
" + else: str += "
0 Reads" + str += "
"+R1.library_id+", "+R1.condition.nickname+", "+R1.library_species.common_name+"
" str += "
\""+R1.library_name+"\"" if R1.libtags().find('Data submitted to DCC') != -1: str += "
data submitted
" @@ -281,6 +309,10 @@ def report_RM(request): #for RNA-Seq and Methyl-Seq return render_to_response('htsw_reports/report.html',{'main': str}) def getNotRanFCs(request): + if not request.user.is_authenticated(): + str= 'Please log in first' + return render_to_response('htsw_reports/report.html',{'main':str}) + FCall = FlowCell.objects.order_by('-run_date').distinct() str = '' for f in FCall: @@ -292,6 +324,10 @@ def getNotRanFCs(request): return render_to_response('htsw_reports/report.html',{'main':str}) def test_Libs(request): + if not request.user.is_authenticated(): + str= 'Please log in first' + return render_to_response('htsw_reports/report.html',{'main':str}) + str = '' str += '
FlowCellLanesCreation Date
' allLibs = Library.objects.all()
Lib IDCurrent Libaray Name (Free Text)Auto-composed Libaray Name (antibody + celline + libid + species + [replicate])