Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
First version
- Loading branch information
Showing
6 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Simple Gene Expression Database on Google App Engine. | ||
The software can be distributed and modified under the terms of GPL. | ||
|
||
Itoshi NIKAIDO <dritoshi at gmail dot com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
application: gaexpr2 | ||
version: 1 | ||
runtime: python | ||
api_version: 1 | ||
|
||
handlers: | ||
- url: /load | ||
script: myloader.py | ||
login: admin | ||
|
||
- url: /.* | ||
script: gaexpr2.py |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import wsgiref.handlers | ||
|
||
from google.appengine.ext import webapp | ||
from google.appengine.ext import search | ||
from google.appengine.ext.webapp.util import run_wsgi_app | ||
|
||
class MainPage(webapp.RequestHandler): | ||
def get(self): | ||
|
||
url = "http://chart.apis.google.com/chart?cht=lc&chco=1E5692,3E9A3B&chs=200x125&chxt=x,y&chxl=0:|0|2|4|6|8|10|1:|2|4|6|8|10&chds=2,10&chd=t:" | ||
self.response.headers['Content-Type'] = 'text/html' | ||
self.response.out.write('<html><body>') | ||
|
||
# I use the webapp framework to retrieve the keyword | ||
keyword = self.request.get('keyword') | ||
|
||
if not keyword: | ||
self.response.out.write("No keyword has been set") | ||
else: | ||
# Search the 'Expression' Entity based on our keyword | ||
query = search.SearchableQuery('Expression') | ||
query.Search(keyword) | ||
for result in query.Run(): | ||
# Annotation | ||
self.response.out.write('<div><pre>') | ||
self.response.out.write('Affy ID: %s\n' % result['affy_id']) | ||
self.response.out.write('Gene Symbol: %s\n' % result['gene_symbol']) | ||
self.response.out.write('Gene Name: %s\n' % result['gene_name']) | ||
self.response.out.write('Entrez Gene: <a href="http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&cmd=Retrieve&dopt=full_report&list_uids=%s">' % result['entrezid'] + "%s</a>\n" % result['entrezid']) | ||
self.response.out.write('</pre></div>') | ||
|
||
# Graph (Using Google Chart API) | ||
evector = ",".join([`result['evector_day' + suffix]` for suffix in ["0", "2", "4", "10"]]) | ||
ppargox = ",".join([`result['ppargox_day' + suffix]` for suffix in ["0", "2", "4", "10"]]) | ||
graph = url + evector + "|" + ppargox | ||
self.response.out.write('<img src="%s">' % graph) | ||
|
||
self.response.out.write('<div><a href="search">Back</a></div>') | ||
self.response.out.write('</body></html>') | ||
|
||
class IdSearchForm(webapp.RequestHandler): | ||
def get(self): | ||
self.response.headers['Content-Type'] = 'text/html' | ||
self.response.out.write(""" | ||
<html> | ||
<body> | ||
<h1>Gene Expression Database</h1> | ||
<form action="/" method="get"> | ||
<div> | ||
Keyword: <input type="text" name="keyword" rows="1" cols="12"> | ||
<input type="submit" value="Search"> (ex. 100005_at, Traf4) | ||
</div> | ||
</form> | ||
<hr/> | ||
<a href="http://itoshi.tv/">Itoshi NIKAIDO, Ph. D.</a>, dritoshi at gmail dot com | ||
</body> | ||
</html>""") | ||
|
||
|
||
application = webapp.WSGIApplication( | ||
[('/', MainPage), | ||
('/search', IdSearchForm)], | ||
debug=True) | ||
|
||
def main(): | ||
run_wsgi_app(application) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
indexes: | ||
|
||
# AUTOGENERATED | ||
|
||
# This index.yaml is automatically updated whenever the dev_appserver | ||
# detects that a new type of query is run. If you want to manage the | ||
# index.yaml file manually, remove the above marker line (the line | ||
# saying "# AUTOGENERATED"). If you want to manage some indexes | ||
# manually, move them above the marker line. The index.yaml file is | ||
# automatically uploaded to the admin console when you next deploy | ||
# your application using appcfg.py. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from google.appengine.api import users | ||
from google.appengine.ext import bulkload | ||
from google.appengine.api import datastore_types | ||
from google.appengine.ext import search | ||
|
||
class ExpressionLoader(bulkload.Loader): | ||
def __init__(self): | ||
# Our 'Expression' entity contains a affyid string and an expression float data | ||
bulkload.Loader.__init__(self, 'Expression', | ||
[('affy_id', str), | ||
('gene_symbol', str), | ||
('entrezid', str), | ||
('gene_name', str), | ||
('evector_day0', float), | ||
('evector_day2', float), | ||
('evector_day4', float), | ||
('evector_day10', float), | ||
('ppargox_day0', float), | ||
('ppargox_day2', float), | ||
('ppargox_day4', float), | ||
('ppargox_day10', float), | ||
]) | ||
|
||
def HandleEntity(self, entity): | ||
ent = search.SearchableEntity(entity) | ||
return ent | ||
|
||
if __name__ == '__main__': | ||
bulkload.main(ExpressionLoader()) |