Exemple #1
0
	def checkLogedIn(self):
		if request.POST.get('username'):
		  if request.POST.get('username') == request.cookies.get("usernameCIS3210"):
		    return render("/manageUsers.mako")
		  else:
		    response.set_cookie("usernameCIS3210" , request.cookies.get("usernameCIS3210"), max_age= -1)
		    return render("/login.mako")
		else:
		  response.set_cookie("usernameCIS3210" , request.cookies.get("usernameCIS3210"), max_age= -1)
		  return render("/login.mako")
Exemple #2
0
	def index(self, id=None):
		"""
		2009-2-19
			snp context
			snp annotation
			snp frequency
			geographic distribution colored by phenotype
			which accession has which allele
			phenotype distribution stratified according to allele
			significant associations (top 1k) in other phenotypes
			
		"""
		# Return a rendered template
		#   return render('/template.mako')
		# or, Return a response
		self.readInRequestParams(request, c)
		
		start_pos = c.position-40000
		stop_pos = c.position+40000
		track_id = '%s_%s_%s'%(c.call_method_id, c.phenotype_method_id, c.analysis_method_id)
		c.gbrowseLink = config['app_conf']['GBrowseURL']%(start_pos, stop_pos, c.chromosome)+track_id+"-"+track_id+"_SNP"
		
		phenotype_method = model.Stock_250kDB.PhenotypeMethod.get(c.phenotype_method_id)
		c.pageTitle = "SNP chromosome %s position %s Phenotype %s %s"%\
			(c.chromosome, c.position, c.phenotype_method_id, phenotype_method.short_name)
		#return render('/snp.html')
		return render('/SNP.html')
Exemple #3
0
	def index(self):
		# Return a rendered template
		#   return render('/template.mako')
		# or, Return a response
		# return 'Hello World'
		c.find250kAccessionsURL = h.url_for(controller="Accession", action="find250kAccessions", id=None)
		return render('/Accession.html')
Exemple #4
0
 def index(self):
     # Return a rendered template
     #return render('/main.mako')
     # or, return a string
     if request.cookies.get( 'username' ):
     	return redirect(url('/dashboard'))
     else:
     	return render('/index.mako')
Exemple #5
0
	def index(self):
		#c.call_method_ls = DisplayresultsController.getCallMethodLsJson()		
		c.callMethodLsURL = h.url_for(controller="DisplayResults", action="getCallMethodLsJson", id=None)
		#c.gene_list_ls = DisplayresultsgeneController.getGeneListTypeLsGivenTypeAndPhenotypeMethodAndAnalysisMethodJson()
		c.geneListLsURL = h.url_for(controller="DisplayResultsGene", action="getGeneListTypeLsGivenTypeAndPhenotypeMethodAndAnalysisMethodJson", id=None)
		c.callMethodOnChangeURL = h.url_for(controller="DisplayResults", action="getPhenotypeMethodLsJson", id=None)
		c.haplotypeImgURL = h.url_for(controller='HaplotypeView', action='getPlot', id=None)
		return render('/HaplotypeView.html')
Exemple #6
0
	def login(self):
		sql = 'SELECT * FROM users WHERE BINARY username = "******" AND BINARY password = "******";'
		cur.execute(sql)
		row = cur.fetchone()
		if row:
		  response.set_cookie("usernameCIS3210" , request.POST.get('userName'), max_age=180*24*3600)
		  return json.dumps({'code': render("/manageUsers.mako")})
		else:
		  return json.dumps({'error':'Authentication error.'})
Exemple #7
0
 def index(self):
     # Return a rendered template
     #return render('/dashboard.mako')
     # or, return a string
     if request.cookies.get('username'):
         c.test = 'cool'
         return render('/dashboard.mako')
     else:
         return redirect(url('/'))
 def contact(self):
     if request.method == 'POST':
         redirect_url = self._process_contact()
         redirect(redirect_url)
     log1.info ('Generating a form ...')
     c.csrf_token_field = secure_form.auth_token_hidden_field()
     c.errors = session.get('contactform.errors', None)
     c.values = session.get('contactform.values', {})
     return render('contactform/contact.html')
Exemple #9
0
 def results(self):
     log.info ('Viewing poll results')
     db_session = model.Session()
     q1 = db_session.query(model.Vote.vote, model.func.count(model.Vote.vote)).group_by(model.Vote.vote)
     c.vote_freqs = q1.all()
     q2 = db_session.query(model.Vote)
     c.vote_count = q2.count()
     db_session.close()
     return render('poll/results.html')
 def index(self):
     # Return a rendered template
     #return render('/dashboard.mako')
     # or, return a string
     if request.cookies.get( 'username' ):
     	c.test='cool';
     	return render('/dashboard.mako')
     else:
     	return redirect(url('/')) 
Exemple #11
0
	def trend(self, id=None): 
		"""
		2009-5-3
			
		"""
		c.trendDataURL = h.url_for(controller='Phenotype', action='getTrendData', id=None)
		c.trendAnnotationDataURL = h.url_for(controller='Phenotype', action='getTrendAnnotationData', id=None)
		c.multiPhenotypeDataURL = h.url_for(controller='Phenotype', action='getMultiPhenotypeData', id=None,\
										call_method_id=int(config['app_conf']['good_call_method_id']))
		return render('/PhenotypeTrend.html')
Exemple #12
0
	def haploGroup(self, id=None):
		"""
		2009-4-5
			server end to return haplotype group json data structure
		"""
		if id is None:
			id = 1
		c.haplo_group_id = id
		c.getHaploGroupURL = h.url_for(controller="Accession", action="getHaploGroup", id=id)
		return render('/HaploGroup.html')
Exemple #13
0
	def index(self):
		"""
		2009-11-30
		"""
		# Return a rendered template
		#   return render('/template.mako')
		# or, Return a response
		c.getCallMethodLsJsonURL = h.url_for(controller="associationoverlap", action="getCallMethodLsJson")
		c.getOverlappingDataAcrossPhenotypesURL = h.url_for(controller="associationoverlap", action="getOverlappingDataAcrossPhenotypes")
		c.getNoOfTopSNPsLsJsonURL = h.url_for(controller="associationoverlap", action="getNoOfTopSNPsLsJson")
		return render("AssociationOverlap.html")
Exemple #14
0
	def form(self, id=None):
		"""
		2009-1-30
		"""
		if id is None:
			id = request.params.get('id', 1)
		defaults = {'call_method_id': id,
				"remove_old_plots":"on"}
		c.call_method_ls = self.getCallMethodLs()
		c.call_method_ls.insert(0, [0, u'Please Choose ...'])
		html = render('/display_results_form.html')
		return htmlfill.render(html, defaults)
    def test_render(self):
        ''' An example of using Pylons globals after the test request
        has been completed.
        '''
        
        response = self.app.get(url(controller='greet', action='index'))
        
        self._setup_template_context()
        self._setup_request_globals(response)
       
        from pylons import tmpl_context as c
        c.author = 'Foo'
        c.maintainer = 'Boo'
        
        markup = render('greet/index-1.html', extra_vars={ 'foo': 'bar' })

        self._teardown_request_globals()
        self._teardown_template_context()
Exemple #16
0
	def index(self):
		"""
		2009-11-11
			add c.getPhenotypeURL
		2009-10-8
			first try to get the call_method_id from the URL parameters. if it's null, use the published_call_method_id instead.
		2009-7-2
			update c.displayResultsGeneURL to h.url_for(controller="DisplayResultsGene", action='showResultsGeneForOnePhenotype')
		"""
		# Return a rendered template
		#   return render('/template.mako')
		# or, Return a response
		c.call_method_id = request.params.get('call_method_id', config['app_conf']['published_call_method_id'])
		c.getPhenotypeCategoryLsURL = h.url_for(controller="DisplayResults", action="getPhenotypeCategoryLs")
		c.getPhenotypeTableDataURL = h.url_for(controller="DisplayResults", action="getPhenotypeTableData")
		c.getGWAURL = h.url_for(controller="DisplayResults", action="showGWA")
		c.getPhenotypeURL = h.url_for(controller='Phenotype')
		c.displayResultsGeneURL = h.url_for(controller="DisplayResultsGene", action='showResultsGeneForOnePhenotype')
		
		return render("GWASPhenotypes.html")
 def index(self):
     ''' Display a directory listing '''
     relpath = request.params.get('path', '/')
     relpath = re.sub(r'[\.]+', ".", relpath)
     abspath = os.path.join (STORAGE_ROOT_DIR, relpath.strip(' /'))
     if not os.path.isdir(abspath):
         abort (400, detail=u'The path (%s) does not map to a directory' %(abspath))
     listing = []
     for f in os.listdir(abspath):
         pf = os.path.join (abspath, f)
         is_dir = os.path.isdir(pf)
         is_file = os.path.isfile(pf)
         if (is_dir or is_file):
             sf = os.stat(pf)
             target = None
             if is_dir:
                 target = url(controller='storage', action='index',
                     path = relpath.strip(' /') + '/' + f)
             else:
                 target = url(controller='storage', action='file',
                     path = relpath.strip(' /') + '/' + f)
             entry = dict(
                 is_dir = is_dir,
                 is_file = is_file,
                 name = f,
                 target = target,
                 size = sf.st_size,
                 created = datetime.fromtimestamp(sf.st_ctime),
                 modified = datetime.fromtimestamp(sf.st_mtime))
             listing.append (entry)
     c.storage_index = {
         'listing': listing,
         'path': relpath,
         'upload_url': url(controller='storage', action='upload_handle')
     }
     return render('storage/index.html')
     pass
Exemple #18
0
	def index(self, id=None):
		"""
		2009-4-6
			display a summary page given a phenotype id
		"""
		# Return a rendered template
		#   return render('/template.mako')
		# or, Return a response
		c.phenotype_method_id = request.params.get('phenotype_method_id', id)
		if c.phenotype_method_id:
			c.phenotype_method_id = int(c.phenotype_method_id)
		pm = model.Stock_250kDB.PhenotypeMethod.get(c.phenotype_method_id)
		c.phenotype_method_short_name = pm.short_name
		c.phenotype_method_description = pm.method_description
		
		c.call_method_id = request.params.get('call_method_id', int(config['app_conf']['published_call_method_id']))
		c.callInfoURL = h.url_for(controller='DisplayResults', action='fetchCallInfoData', id=None,\
							phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.phenotypeHistImageURL = h.url_for(controller='DisplayResults', action='getPhenotypeHistImage', id=None, \
										phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.callPhenotypeQQImageURL = h.url_for(controller='DisplayResults', action='getCallPhenotypeQQImage', id=None,\
											phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.phenotypeHistogramDataURL = h.url_for(controller='Phenotype', action='getPhenotypeHistogramData', id=c.phenotype_method_id)
		return render('/OnePhenotype.html')
Exemple #19
0
	def showGWA(self):
		"""
		2009-4-23
		"""
		
		c.phenotype_method_id = int(request.params.get('phenotype_method_id', 1))
		c.call_method_id = int(request.params.get('call_method_id', config['app_conf']['published_call_method_id']))
		c.phenotypeSummaryURL = h.url_for(controller="Phenotype", action=None, phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.GWABaseURL = h.url_for(controller='DisplayResults', action='fetchOne', phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.SNPBaseURL = h.url_for(controller='SNP', action=None, phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.getAnalysisMethodLsURL = h.url_for(controller='DisplayResults', action='getAnalysisMethodLsJson', phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		"""
		# 2009-4-25 no way to pass this 2D (int, string) array to the template! 
		analysis_method_ls = self.getAnalysisMethodLs(c.call_method_id, c.phenotype_method_id)
		c.analysis_method_ls = []
		str_func = lambda x: '%s'%x
		for analysis_method_entry in analysis_method_ls:
			analysis_method_entry = map(str_func, analysis_method_entry)
			c.analysis_method_ls.append('[' + ','.join(analysis_method_entry) + ']')
			#c.analysis_method_ls.append(analysis_method_entry)
		#c.analysis_method_ls = simplejson.dumps(c.analysis_method_ls)
		c.analysis_method_ls = '[' + ','.join(c.analysis_method_ls) + ']'
		"""
		pm = model.Stock_250kDB.PhenotypeMethod.get(c.phenotype_method_id)
		c.phenotype_method_short_name = pm.short_name
		c.phenotype_method_description = pm.method_description
		
		c.callInfoURL = h.url_for(controller='DisplayResults', action='fetchCallInfoData', id=None,\
							phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.phenotypeHistImageURL = h.url_for(controller='DisplayResults', action='getPhenotypeHistImage', id=None, \
										phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.callPhenotypeQQImageURL = h.url_for(controller='DisplayResults', action='getCallPhenotypeQQImage', id=None,\
											phenotype_method_id=c.phenotype_method_id, call_method_id=c.call_method_id)
		c.phenotypeHistogramDataURL = h.url_for(controller='Phenotype', action='getPhenotypeHistogramData', id=c.phenotype_method_id)
		
		return render('/GWASOnePhenotype.html')
Exemple #20
0
 def vote(self):
     if request.method == 'POST':
         return self._vote_save()
     log.info ('Generating a form to vote')
     c.csrf_token_field = secure_form.auth_token_hidden_field()
     return render('poll/vote.html')
Exemple #21
0
 def greet(self, id=None):
     c.author = u'φουφουτος'
     c.maintainer = u'λαλάκης'
     markup = render('greet/index-1.html', extra_vars={ 'foo': 'Bazz'})
     return markup
Exemple #22
0
 def index(self):
     return render('/hello.mako')
Exemple #23
0
 def index(self):
     # Return a rendered template
     #return render('/hello.mako')
     # or, return a string
     #return 'Hello World'
     return render('/hello.mako')
Exemple #24
0
 def index(self):
     c.name = 'test'  #这个参数可以传递到模版
     c.person = meta.Session.query(Person).filter(Person.name == 'Mr Jones').first()                
     #result = conn.execute(s)        
     # Return a rendered template
     return render('/hello.mako')
Exemple #25
0
 def index(self):
     return render('/hello.mako')
Exemple #26
0
 def onePerson(self):
     c.person = meta.Session.query(Person).filter(Person.name == 'Mr Jones').first()                
     return render('/onePerson.mako')
Exemple #27
0
	def logout(self):
		response.set_cookie("usernameCIS3210" , request.cookies.get("usernameCIS3210"), max_age= -1)
		return render("/login.mako")
Exemple #28
0
 def allPerson(self):
     c.persons = meta.Session.query(Person)[0:2]
     
     return render('/allPerson.mako')
Exemple #29
0
	def index(self):
		# Return a rendered template
		#   return render('/template.mako')
		# or, Return a response
		c.motionChartFormActionURL = h.url_for(controller="utils", action="uploadForMotionChart");
		return render('/Utils.html')
Exemple #30
0
 def index(self):
     # Return a rendered template
     #return render('/hello.mako')
     # or, return a string
     #return 'Hello World'
     return render('/hello.mako')