# some core functions of analysis manager module
-from django.http import HttpResponse
+
from datetime import datetime
from string import *
import re
-from htswfrontend import settings
-from htswfrontend.analys_track.models import Task, Project
+
+from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
+from django.http import HttpResponse
+
+from htsworkflow.frontend.analysis.models import Task, Project
def updStatus(request):
ClIP = request.META['REMOTE_ADDR']
#Check client access permission
granted = False
- if (settings.ALLOWED_ANALYS_IPS.has_key(ClIP)): granted = True
+ if (ClIP in settings.ALLOWED_ANALYS_IPS): granted = True
if not granted: return HttpResponse("access denied.")
output=''
taskid=-1;
# Check required param
- if request.has_key('taskid'): taskid = request['taskid']
+ if 'taskid' in request: taskid = request['taskid']
else: return HttpResponse('missing param task id')
try:
rec = Task.objects.get(id=taskid)
mytimestamp = datetime.now().__str__()
mytimestamp = re.sub(pattern=":[^:]*$",repl="",string=mytimestamp)
- if request.has_key('msg'):
+ if 'msg' in request:
rec.task_status += ", "+request['msg']+" ("+mytimestamp+")"
else :
rec.task_status = "Registered ("+mytimestamp+")"
ClIP = request.META['REMOTE_ADDR']
#Check client access permission
granted = False
- if (settings.ALLOWED_ANALYS_IPS.has_key(ClIP)): granted = True
+ if (ClIP in settings.ALLOWED_ANALYS_IPS): granted = True
if not granted: return HttpResponse("access denied.")
outputfile = ''
All=False
- if (request.has_key('mode')):
+ if ('mode' in request):
if request['mode']=='all':
All=True
outputfile += '\n'
if (t.apply_calc == 'QuEST' or t.apply_calc == 'WingPeaks' or t.apply_calc == 'MACS'):
outputfile += '\n<PeakCalling TaskId="'+t.id.__str__()+'" Name="'+t.task_name+'" Caller="'+t.apply_calc+'" Genome="'+t.subject1.library_species.use_genome_build+'">'
- outputfile += '\n<Signal Library="'+t.subject1.library_id+'"/>'
- outputfile += '\n<Background Library="'+t.subject2.library_id+'"/>'
+ if t.subject1:
+ outputfile += '\n<Signal Library="'+t.subject1.id+'"/>'
+ if t.subject2:
+ outputfile += '\n<Background Library="'+t.subject2.id+'"/>'
+ else:
+ outputfile += '\n<Err>Background Library Missing</Err>'
+ else:
+ outputfile += '\n<Err>Signal Library Missing</Err>'
+ outputfile += '\n<params>'+t.task_params.__str__()+'</params>'
outputfile += '\n</PeakCalling>'
+
+ if (t.apply_calc == 'Methylseq'):
+ outputfile += '\n<Methylseq TaskId="'+t.id.__str__()+'" Name="'+t.task_name+'" Genome="'+t.subject1.library_species.use_genome_build+'">'
+ if t.subject1:
+ outputfile += '\n<Hpa2 Library="'+t.subject1.id+'"/>'
+ if t.subject2:
+ outputfile += '\n<Msp1 Library="'+t.subject2.id+'"/>'
+ else:
+ outputfile += '\n<Err>Msp1 Library Missing</Err>'
+ else:
+ outputfile += '\n<Err>Hpa2 Library Missing</Err>'
+ outputfile += '\n<params>'+t.task_params.__str__()+'</params>'
+ outputfile += '\n</Methylseq>'
if (t.apply_calc == 'ProfileReads' or t.apply_calc == 'qPCR'):
- outputfile += '\n<'+t.apply_calc+' TaskId="'+t.id.__str__()+'" Name="'+t.task_name+'" Genome="'+t.subject1.library_species.use_genome_build+'" Library="'+t.subject1.library_id+'"/>'
+ outputfile += '\n<'+t.apply_calc+' TaskId="'+t.id.__str__()+'" Name="'+t.task_name+'" Genome="'+t.subject1.library_species.use_genome_build+'" Library="'+t.subject1.id+'"/>'
if (t.apply_calc == 'CompareLibs'):
outputfile += '\n<CompareLibraries TaskId="'+t.id.__str__()+'" TF="'+t.task_name+'" Genome="'+t.subject1.library_species.use_genome_build+'">'
- outputfile += '\n<Library Library="'+t.subject1.library_id+'"/>'
- outputfile += '\n<Library Library="'+t.subject2.library_id+'"/>'
+ if t.subject1:
+ outputfile += '\n<Library Library="'+t.subject1.id+'"/>'
+ else:
+ outputfile += '\n<Err>Library Missing</Err>'
+ if t.subject2:
+ outputfile += '\n<Library Library="'+t.subject2.id+'"/>'
+ else:
+ outputfile += '\n<Err>Library Missing</Err>'
+ outputfile += '\n<params>'+t.task_params.__str__()+'</params>'
outputfile += '\n</CompareLibraries>'
#if (t.apply_calc == 'ComparePeakCalls'):