Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
217ff91
commit 1d35a31
Showing
13 changed files
with
243 additions
and
2 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
Empty file.
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,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
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,66 @@ | ||
from django import forms | ||
|
||
from public_interface.models import Genes | ||
from public_interface.models import GeneSets | ||
from public_interface.models import TaxonSets | ||
|
||
|
||
class CreateDatasetForm(forms.Form): | ||
file_format = forms.ChoiceField( | ||
label='Choose file format', | ||
choices=[ | ||
('TNT', 'TNT format'), | ||
('NEXUS', 'NEXUS format'), | ||
('PHY', 'PHYLIP format'), | ||
('FASTA', 'Unaligned FASTA format'), | ||
] | ||
) | ||
|
||
outgroup = forms.CharField( | ||
label='Outgroup (code, for NEXUS and TNT)', | ||
help_text='Voucher code for using that specimen\'s sequence as ' | ||
'outgroup in NEXUS and TNT datasets.', | ||
) | ||
""" | ||
taxonset = forms.ModelChoiceField( | ||
TaxonSets.objects.all(), | ||
label='Choose taxonset', | ||
required=False, | ||
empty_label='Choose taxonset', | ||
) | ||
geneset = forms.ModelChoiceField( | ||
GeneSets.objects.all(), | ||
label='Choose geneset', | ||
required=False, | ||
empty_label='Choose geneset', | ||
) | ||
gene_codes = forms.ModelMultipleChoiceField( | ||
Genes.objects.all(), | ||
label='Check to select your alignment/gene', | ||
required=False, | ||
widget=forms.CheckboxSelectMultiple(), | ||
) | ||
voucher_codes = forms.CharField( | ||
widget=forms.Textarea, | ||
label='... and/or a list of voucher codes', | ||
required=False, | ||
) | ||
""" | ||
|
||
def clean(self): | ||
"""Overwriting validator method of class form.""" | ||
cleaned_data = super(GenBankFastaForm, self).clean() | ||
taxonset = cleaned_data.get("taxonset") | ||
voucher_codes = cleaned_data.get("voucher_codes") | ||
|
||
geneset = cleaned_data.get("geneset") | ||
gene_codes = cleaned_data.get("gene_codes") | ||
print(gene_codes) | ||
|
||
if taxonset is None and voucher_codes.strip() == '': | ||
raise forms.ValidationError("You need to enter at least some " | ||
"voucher codes or select a taxonset.") | ||
|
||
if geneset is None and len(gene_codes) < 1: | ||
raise forms.ValidationError("You need to enter at least some " | ||
"gene codes or select a geneset.") |
Empty file.
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,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
138 changes: 138 additions & 0 deletions
138
voseq/create_dataset/templates/create_dataset/index.html
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,138 @@ | ||
{% extends 'public_interface/base.html' %} | ||
|
||
|
||
{% block additional_css %} | ||
{% load staticfiles %} | ||
<link rel="stylesheet" href="{% static 'css/jquery-ui.min.css' %}"> | ||
<link rel="stylesheet" href="{% static 'css/jquery-ui.structure.min.css' %}"> | ||
<link rel="stylesheet" href="{% static 'css/jquery-ui.theme.min.css' %}"> | ||
{% endblock additional_css %} | ||
|
||
|
||
{% block content %} | ||
<div class="explorer-container"> | ||
<div class="container"> | ||
<h3>Create dataset:</h3> | ||
|
||
<div class="alert alert-info" role="alert"> | ||
<b>Select sequences you want for a dataset by entering the voucher codes and gene codes.</b> | ||
</div> | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
|
||
<div class="col-xs-12 col-sm-12 col-md-11 col-lg-9 col-lg-offset-1"> | ||
|
||
<form action="/genbank_fasta/results/" method="post"> | ||
<div class="panel panel-primary" style="min-width: 790px;"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title"><b>Enter the required info to make yourself a ready-to-run dataset</b></h3> | ||
</div> | ||
|
||
|
||
|
||
{{ form.as_p }} | ||
<i class="fa fa-exclamation-triangle"></i> Warning! your dataset will not necessarily be properly aligned! | ||
<a title="You need to be sure that your data is aligned!" href="#"><i class="fa fa-question-circle"></i></a> | ||
{% csrf_token %} | ||
|
||
{% for i in form.non_field_errors %} | ||
<div class="alert alert-warning">{{ i }}</div> | ||
{% endfor %} | ||
<table class="table table-bordered"><!-- big --> | ||
<tr> | ||
<td> | ||
<table class="table table-bordered"> | ||
<tr> | ||
<td> | ||
<label for="id_taxonset">Choose taxonset: </label> | ||
</td> | ||
<td> | ||
{% for i in form.taxonset.errors %} | ||
<div class="alert alert-warning">{{ i }}</div> | ||
{% endfor %} | ||
{{ form.taxonset }} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<label for="id_voucher_codes">... and/or a list of voucher codes: </label> | ||
</td> | ||
<td> | ||
{% for i in form.voucher_codes.errors %} | ||
<div class="alert alert-warning">{{ i }}</div> | ||
{% endfor %} | ||
{{ form.voucher_codes }} | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
|
||
<td> | ||
<table class="table table-bordered"> | ||
<tr> | ||
<td> | ||
<label for="id_geneset">Choose geneset: </label> | ||
</td> | ||
<td> | ||
{% for i in form.geneset.errors %} | ||
<div class="alert alert-warning">{{ i }}</div> | ||
{% endfor %} | ||
{{ form.geneset }} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
Check to select your alignment/gene:<br /> | ||
<br /> | ||
(if geneset chosen, adds extra genes) | ||
</td> | ||
<td> | ||
<table class="table table-condensed table-striped"> | ||
<tr> | ||
{% for i in form.gene_codes %} | ||
<td> | ||
{{ i }} | ||
</td> | ||
{% endfor %} | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
|
||
</tr> | ||
</table><!-- big --> | ||
|
||
</div><!-- panel --> | ||
|
||
<button type="submit" class="btn btn-info" id="submit_button"> | ||
Make GenBank FASTA1 | ||
</button> | ||
</form> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div><!-- col --> | ||
|
||
</div><!-- row --> | ||
</div><!-- container --> | ||
|
||
|
||
</div> | ||
</div> | ||
{% endblock content %} | ||
|
||
|
||
{% block additional_javascript_footer %} | ||
<script> | ||
$(function() { | ||
$( document ).tooltip(); | ||
}); | ||
</script> | ||
{% endblock additional_javascript_footer %} |
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,10 @@ | ||
from django.conf.urls import patterns | ||
from django.conf.urls import url | ||
|
||
from . import views | ||
|
||
|
||
urlpatterns = patterns( | ||
'', | ||
url(r'^/$', views.index, name='index'), | ||
) |
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,14 @@ | ||
from django.shortcuts import render | ||
|
||
from .forms import CreateDatasetForm | ||
|
||
|
||
def index(request): | ||
form = CreateDatasetForm() | ||
|
||
return render(request, | ||
'create_dataset/index.html', | ||
{ | ||
'form': form, | ||
}, | ||
) |
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
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
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