Skip to content

Commit

Permalink
genbank fasta: result page
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosp420 committed Jan 20, 2015
1 parent 96c2f4c commit dc0109d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 75 deletions.
129 changes: 58 additions & 71 deletions voseq/genbank_fasta/templates/genbank_fasta/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,97 +4,84 @@
{% block content %}
<div class="explorer-container">
<div class="container">
<h3>Create GenBank FASTA file:</h3>
<h3>Results:</h3>


<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 FASTA file to be submitted to GenBank</b></h3>
<h3 class="panel-title"><b>Sequences that already have GenBank accession numbers:
<span class="badge"><b>{{ items_with_accession|length }}</b></span>
<br />
These will be ignored</b></h3>
</div>

{% csrf_token %}
<ul class="list-group">
{% for i in items_with_accession %}
<li class="list-group-item">{{ i.voucher_code }} for {{ i.gene_code }} = {{ i.accession }}</li>
{% endfor %}
</ul>
</div><!-- panel -->

<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_gene_code_list">... and/or a list of codes: </label>
</td>
<td>
{% for i in form.gene_code_list.errors %}
<div class="alert alert-warning">{{ i }}</div>
{% endfor %}
{{ form.gene_code_list }}
</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>

<h3>
This is your nucleotide FASTA file to import into Sequin
(<a href="http://www.ncbi.nlm.nih.gov/Sequin/">http://www.ncbi.nlm.nih.gov/Sequin/</a>)
</h3>

<button type="submit" class="btn btn-info" id="submit_button">
<i class="fa fa-download"></i>
Download nucleotide file
</button>
<br />
<br />
<div class="panel panel-primary" style="min-width: 790px;">
<div class="panel-heading">
<h3 class="panel-title"><b>Your nucleotide file:</b></h3>
</div>

<table class="table table-bordered">
<tr>
<td>
<textarea readonly style="height: 250px; white-space: nowrap;" class="form-control">{{ fasta }}</textarea>
</td>
</tr>
</table><!-- big -->
</table>

</div><!-- panel -->

<button type="submit" class="btn btn-info" id="submit_button">
Make GenBank FASTA
</button>
</form>


<h3>
This is your protein file to use in case you have introns.
Load it in Sequin after your nucleotide file to link nucleotides to
protein and identify the introns.
</h3>

<button type="submit" class="btn btn-info" id="submit_button">
<i class="fa fa-download"></i>
Download protein file
</button>
<br />
<br />
<div class="panel panel-primary" style="min-width: 790px;">
<div class="panel-heading">
<h3 class="panel-title"><b>Your protein file:</b></h3>
</div>

<table class="table table-bordered">
<tr>
<td>
<textarea readonly style="height: 250px; white-space: nowrap;" class="form-control">{{ protein }}</textarea>
</td>
</tr>
</table>

</div><!-- panel -->



Expand Down
8 changes: 7 additions & 1 deletion voseq/genbank_fasta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ def get_datasets(self):
continue

if s.accession.strip() != '':
self.items_with_accession.append((code, gene_code, s.accession))
self.items_with_accession.append(
{
'voucher_code': code,
'gene_code': gene_code,
'accession': s.accession,
},
)
else:
seq_id = v.genus + '_' + v.species + '_' + code
seq_description = '[org=' + v.genus + ' ' + v.species + ']'
Expand Down
11 changes: 8 additions & 3 deletions voseq/genbank_fasta/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ def results(request):
gene_codes = utils.get_gene_codes(cleaned_data)

print(voucher_codes, gene_codes)
items_with_accession, fasta, proteins = utils.get_results(voucher_codes, gene_codes)
result = ''
res = utils.Results(voucher_codes, gene_codes)
res.get_datasets()
items_with_accession = res.items_with_accession
fasta = res.fasta
protein = res.protein

return render(request, 'genbank_fasta/results.html',
{
'result': result,
'items_with_accession': items_with_accession,
'fasta': fasta,
'protein': protein,
'version': version,
'stats': stats,
},
Expand Down

0 comments on commit dc0109d

Please sign in to comment.