Skip to content

Commit

Permalink
Merge a3a632f into bcf4a24
Browse files Browse the repository at this point in the history
  • Loading branch information
ElDeveloper committed Jun 19, 2014
2 parents bcf4a24 + a3a632f commit fed6944
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 180 deletions.
48 changes: 47 additions & 1 deletion qiita_pet/handlers/analysis_handlers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from tornado.web import authenticated
from collections import defaultdict

from qiita_pet.handlers.base_handlers import BaseHandler
from qiita_db.user import User
from qiita_db.analysis import Analysis
from qiita_db.study import Study
from qiita_db.data import ProcessedData
from qiita_db.metadata_template import SampleTemplate
# login code modified from https://gist.github.com/guillaumevincent/4771570


Expand Down Expand Up @@ -31,4 +34,47 @@ def post(self):
analysis = Analysis.create(User(user), name, description)

self.render('select_studies.html', user=user, aid=analysis.id,
studies=studies)
studies=studies)


class SelectCommandsHandler(BaseHandler):
"""Select commands to be executed"""
@authenticated
def post(self):
analysis_id = self.get_argument('analysis-id')
study_args = self.get_arguments('studies')
split = [x.split("#") for x in study_args]

# build dictionary of studies and datatypes selected
# as well a set of unique datatypes selected
study_dts = defaultdict(list)
data_types = set()
for study_id, data_type in split:
study_dts[study_id].append(data_type)
data_types.add(data_type)

# make sure the data types are unique
data_types = sorted(list(data_types))

# FIXME: Pull out from the database!!
commands = {'16S': ['Alpha Diversity', 'Beta Diversity',
'Summarize Taxa'],
'18S': ['Alpha Diversity', 'Beta Diversity',
'Summarize Taxa'],
'Metabolomic': ['Summarize Taxa']}

self.render('select_commands.html', user=self.get_current_user(),
commands=commands, data_types=data_types, aid=analysis_id)

analysis = Analysis(analysis_id)

for study_id in study_dts:
study = Study(study_id)
processed_data = {ProcessedData(pid).data_type: pid for pid in
study.processed_data}

sample_ids = SampleTemplate(study.id).keys()
for data_type in study_dts[study.id]:
samples = [(processed_data[data_type], sid) for sid in
sample_ids]
analysis.add_samples(samples)
72 changes: 0 additions & 72 deletions qiita_pet/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,3 @@
padding: 20px;
}

/* navbar code from http://line25.com/tutorials/how-to-create-a-pure-css-dropdown-menu */
nav {
padding: 0px;
margin: 0px;
font-size: 18px;
text-align: center;
}

nav ul ul {
display: none;
}

nav ul li:hover > ul {
display: block;
}


nav ul {
background: #A7A9AC;
padding: 0 20px;
list-style: none;
position: relative;
}
nav ul:after {
content: "";
clear: both;
display: block;
}

nav ul li {
float: left;
}
nav ul li:hover {
background: #999;
}
nav ul li:hover a {
color: #000;
}

nav ul li a {
display: block;
padding: 10px 10px;
color: #000;
text-decoration: none;

}


nav ul ul {
background: #999;
border-radius: 0px;
padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #999;
border-bottom: 1px solid #999;
position: relative;
}
nav ul ul li a {
padding: 10px 10px;
color: #000;
}
nav ul ul li a:hover {
background: #888;
}

nav ul ul ul {
position: absolute; left: 100%;
top:0;
}
Binary file added qiita_pet/static/img/favicon.ico
Binary file not shown.
Binary file modified qiita_pet/static/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion qiita_pet/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%extends base.html%}
{%extends sitebase.html%}
{%block content%}
<h1>404: Page not found!</h1>
{%end%}
21 changes: 0 additions & 21 deletions qiita_pet/templates/create_analysis.html

This file was deleted.

13 changes: 11 additions & 2 deletions qiita_pet/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

{%block content %}
<div class="jumbotron">
<h2>Welcome to Qiita.</h2>
<h1>Welcome to Qiita</h1>
<p align="justify">
Qiita is a development effort powering the data analysis and storage for the Human Microbiome Project phase two of the Human Microbiome Project, a new three-year "multi-omic" study investigating the roles played by microbes and their interactions with the human body. Using inflammatory bowel disease as our focus, this project will delve into the relationship between the microbiome and disease.
</p>
</ br>
<p align="right">
<small>
<i>Text taken from <a href="https://ibdmdb.org">https://ibdmdb.org</a>.</i>
</small>
</p>
</div>
{% end %}
{% end %}
48 changes: 48 additions & 0 deletions qiita_pet/templates/select_commands.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% extends sitebase.html %}
{% autoescape None %}

{%block head%}
<script>
$(function () {
$('#data-types-tabs a:first').tab('show')
})
</script>
{%end%}

{%block content %}

<h1>Select Commands</h1>

<ul class="nav nav-tabs" id="data-types-tabs">
{% for data_type in data_types %}
<li><a href="#{{ data_type }}" data-toggle="tab">{{ data_type }}</a></li>
{% end %}
</ul>

<form role="form" action="/analysis/wait/" method="post">
<input type="hidden" name="analysis-id" value="{{aid}}">
<div class="tab-content" style="height:300px">
{% for data_type in data_types %}
<div class="tab-pane" id="{{ data_type }}">
<table class="table">
<tr>
<th style="width:20px;"></th>
<th>Command</th>
</tr>
{% for command in commands[data_type] %}
<tr>
<td style="width:20px;">
<input id="{{data_type}}#{{command}}" type="checkbox" name="commands" value="{{data_type}}#{{command}}">
</td>
<td>
<label style="font-weight:normal;" for="{{data_type}}#{{command}}">{{command}}</label>
</td>
</tr>
{% end %}
</table>
</div>
{% end %}
</div>
<button type="submit" class="btn btn-default">Start Processing</button>
</form>
{% end %}
15 changes: 10 additions & 5 deletions qiita_pet/templates/select_studies.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ <h1>Studies</h1>
<input type="hidden" name="analysis-id" value="{{aid}}">
<table class="table table-hover">
<tr>
<th> </th>
<th>Data Types</th>
<th>Study Name</th>
<th>Description</th>
</tr>
{% for study in studies %}
<tr>
<td><input type="checkbox" name="studies" value="{{study.id}}"></td>
<td>{{study.title}}</td>
<td>{{study.info["study_description"]}}</td>
<td>
{% for data_type in study.data_types %}
<input type="checkbox" name="studies" value="{{study.id}}#{{data_type}}">{{data_type}}
<br />
{% end %}
</td>
<td style="vertical-align:middle;">{{study.title}}</td>
<td style="vertical-align:middle;">{{study.info["study_description"]}}</td>
</tr>
{% end %}
</table>
<button type="submit" class="btn btn-default">Select studies</button>
</form>
</div>

{% end %}
{% end %}
Loading

0 comments on commit fed6944

Please sign in to comment.