Skip to content

Commit

Permalink
family page restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Oct 27, 2016
1 parent c8c7596 commit b43e45d
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 41 deletions.
6 changes: 4 additions & 2 deletions planet/controllers/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def sequence_find(sequence_name):
families=current_sequence.families.all(),
expression_profiles=current_sequence.expression_profiles.all(),
network_nodes=current_sequence.network_nodes.all(),
coexpression_clusters=current_sequence.coexpression_clusters.all()
coexpression_clusters=current_sequence.coexpression_clusters.all(),
ecc_query_associations=current_sequence.ecc_query_associations.all()
)


Expand All @@ -54,7 +55,8 @@ def sequence_view(sequence_id):
families=current_sequence.families.all(),
expression_profiles=current_sequence.expression_profiles.all(),
network_nodes=current_sequence.network_nodes.all(),
coexpression_clusters=current_sequence.coexpression_clusters.all()
coexpression_clusters=current_sequence.coexpression_clusters.all(),
ecc_query_associations=current_sequence.ecc_query_associations.all()
)


Expand Down
56 changes: 31 additions & 25 deletions planet/templates/family.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,46 @@
<div class="top-pad">

{% if family %}
<h1><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='gene_family') }}" data-target="#helpModal">Gene Family</abbr>: <strong>{{ family.name }}</strong></h1>
<ol class="breadcrumb">
<li><a href="{{ url_for('main.screen') }}">Home</a></li>
<li><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='gene_family') }}" data-target="#helpModal">Gene Family</abbr></li>
<li class="active"><strong>{{ family.name }}</strong></li>
</ol>

<h1><strong>{{ family.name }}</strong> <small>({{ family.method.method }})</small></h1>

{% if family.clade_id %}
<p>Specific for <strong><a href="{{ url_for('clade.clade_view', clade_id=family.clade_id) }}">{{ family.clade.name}}</a></strong></p>
{% endif %}
<p>{{ family.method.method }}</p>

<br />
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-body">
<p>There are <strong>{{ count }}</strong> sequences with this label.</p>
{% if count > 0 %}
<div id="canvas-holder" class="center-block">
<div id="canvas-holder" class="center-block" style="height:300px;max-height:300px">
<canvas id="chart-area" class="center-block" width="300" height="300"/>
</div>
{% endif %}
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12">

</div>

{{ macro.pagination(
'Sequences',
url_for('family.family_sequences', family_id=family.id),
count,
url_for('family.family_sequences_table', family_id=family.id)
) }}

<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">External Links</div>
{% if xrefs|count > 0 %}
<div class="panel-scroll">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
Expand All @@ -40,27 +55,20 @@ <h1><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='
<a href="{{ xref.url }}">{{ xref.name }} <i class="fa fa-external-link"></i></a>
</td>
</tr>
{% else %}
<tr>
<td>
<p>No external references for this sequences in the database.</p>
</td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% else %}
<div class="panel-body panel-scroll">
<p>No external references for this sequences in the database.</p>
</div>
{% endif %}
</div>
</div>
</div>

{{ macro.pagination(
'Sequences',
url_for('family.family_sequences', family_id=family.id),
count,
url_for('family.family_sequences_table', family_id=family.id)
) }}

{% endif %}
</div>

Expand All @@ -72,10 +80,8 @@ <h1><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='
{% if count > 0 %}
<script src="{{ url_for('static', filename='js/Chart.min.js') }}"></script>
<script>
$.getJSON( "{{ url_for('family.family_json_species', family_id=family.id) }}", function( data ) {
var ctx = document.getElementById("chart-area").getContext("2d");
var myPie = new Chart(ctx, data);
});
{% import "macros/chartjs.html" as chartjs %}
{{ chartjs.pie_chart("chart-area", url_for('family.family_json_species', family_id=family.id)) }}
</script>
{% endif %}
{% endblock %}
13 changes: 13 additions & 0 deletions planet/templates/macros/chartjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,17 @@
var myChart = new Chart(ctx, data);
});
});
{%- endmacro %}

{% macro pie_chart(target, url) -%}
$( document ).ready(function() {
$.getJSON( "{{ url}}", function( data ) {
var ctx = document.getElementById("{{ target }}").getContext("2d");
data['options'] = {
'responsive': true,
'maintainAspectRatio': false
}
var myChart = new Chart(ctx, data);
});
});
{%- endmacro %}
32 changes: 19 additions & 13 deletions planet/templates/sequence.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1><strong>{{ sequence.name }}</strong> <small>({{ sequence.readable_type }})</
{%endif%}
{% if sequence.description %}

<p><strong>Description: </strong> {{sequence.description}}</p>
<p><strong>Description : </strong> {{sequence.description}}</p>

{% else %}

Expand All @@ -30,10 +30,10 @@ <h1><strong>{{ sequence.name }}</strong> <small>({{ sequence.readable_type }})</

<br />
<div>
<p><strong><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='gene_family') }}" data-target="#helpModal">Gene families</abbr>: </strong>{%- if families|count > 0 -%}{%- for family in families -%}
<p><strong><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='gene_family') }}" data-target="#helpModal">Gene families</abbr> : </strong>{%- if families|count > 0 -%}{%- for family in families -%}
<a href="{{ url_for('family.family_view', family_id=family.id) }}">{{ family.name }}</a> ({{ family.method.method }}) {%- if not loop.last -%}, {% endif %}
{% endfor %} {% else %}<em>No families found for this sequence</em>{% endif %}</p>
<p><strong>Sequence:</strong> <a href="{{ url_for('sequence.sequence_modal_coding', sequence_id=sequence.id) }}" data-target="#profileModal">coding</a> (<a href="{{ url_for('sequence.sequence_fasta_coding', sequence_id=sequence.id) }}">download</a>) {%- if sequence.type == 'protein_coding' -%}, <a href="{{ url_for('sequence.sequence_modal_protein', sequence_id=sequence.id) }}" data-target="#profileModal">protein</a> (<a href="{{ url_for('sequence.sequence_fasta_protein', sequence_id=sequence.id) }}">download</a>) {% endif %}</p>
<p><strong>Sequence :</strong> <a href="{{ url_for('sequence.sequence_modal_coding', sequence_id=sequence.id) }}" data-target="#profileModal">coding</a> (<a href="{{ url_for('sequence.sequence_fasta_coding', sequence_id=sequence.id) }}">download</a>) {%- if sequence.type == 'protein_coding' -%}, <a href="{{ url_for('sequence.sequence_modal_protein', sequence_id=sequence.id) }}" data-target="#profileModal">protein</a> (<a href="{{ url_for('sequence.sequence_fasta_protein', sequence_id=sequence.id) }}">download</a>) {% endif %}</p>
</div>

{% if expression_profiles|count > 0 %}
Expand Down Expand Up @@ -108,6 +108,7 @@ <h3 class="banner-blue">Co-expression Networks</h3>
</div>
<br />
<h3 class="banner-blue">Expression Context Conservation (<abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='ecc') }}" data-target="#helpModal">ECC</abbr>)</h3>
{% if ecc_query_associations|count > 0 %}
<div class="table-responsive">
<table class="table table-striped" id="ecc_hits_table">
<thead>
Expand All @@ -122,7 +123,7 @@ <h3 class="banner-blue">Expression Context Conservation (<abbr title="Click to s
</tr>
</thead>
<tbody>
{% for ecc_query_association in sequence.ecc_query_associations %}
{% for ecc_query_association in ecc_query_associations %}
<tr>
<td><a href="{{ url_for('sequence.sequence_view', sequence_id=ecc_query_association.target_id) }}">{{ ecc_query_association.target_sequence.name }}</a></td>
<td>{{ ecc_query_association.ecc|round(2) }}</td>
Expand All @@ -135,6 +136,9 @@ <h3 class="banner-blue">Expression Context Conservation (<abbr title="Click to s
</tbody>
</table>
</div>
{% else %}
<p><span class="text-muted"><em>No conserved co-expression found</em></span></p>
{% endif %}
<br />
<h3 class="banner-blue">Functional Annotation</h3>
<div class="panel with-nav-tabs panel-default">
Expand Down Expand Up @@ -177,7 +181,9 @@ <h3 class="banner-blue">Functional Annotation</h3>
<a href="#" id="go_toggle">Toggle parental</a>
</div>
{% else %}
<div class="panel-body">
<p>No GO annotation available for this sequence</p>
</div>
{% endif %}
</div>
<div class="tab-pane fade" id="tab2default">
Expand Down Expand Up @@ -215,7 +221,9 @@ <h3 class="banner-blue">Functional Annotation</h3>
</table>
</div>
{% else %}
<div class="panel-body">
<p>No InterPro domains available for this sequence</p>
</div>
{% endif %}
</div>
</div>
Expand All @@ -225,12 +233,10 @@ <h3 class="banner-blue">Functional Annotation</h3>
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">External Links</div>
{% if sequence.xrefs|count > 0 %}
<div class="panel-scroll">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
{% for xref in sequence.xrefs %}
{% for xref in sequence.xrefs if xref.platform != 'token' %}
<tr>
<td><strong>{{ xref.platform }}</strong></td>
<td>
Expand All @@ -241,16 +247,16 @@ <h3 class="banner-blue">Functional Annotation</h3>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td><em>No external refs found!</em></td>
</td>
</tr>

{% endfor %}
</tbody>
</table>
</div>
</div>
{% else %}
<div class="panel-body panel-scroll">
<p>No external references for this sequences in the database.</p>
</div>
{% endif %}
</div>
</div>
</div>
Expand Down
11 changes: 10 additions & 1 deletion planet/templates/species.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
<div class="top-pad">

{% if species %}
<h1>Species: <strong>{{ species.name }}</strong> <small>({{ species.code }})</small></h1>
<ol class="breadcrumb">
<li><a href="{{ url_for('main.screen') }}">Home</a></li>
<li><a href="{{ url_for('species.species_overview') }}">Species</a></li>
<li class="active"><strong><em>{{ species.name }}</em></strong></li>
</ol>
<h1><strong>{{ species.name }}</strong> <small>({{ species.code }})</small></h1>

Transcripts: {{ species.sequence_count }}
<br />
Expand Down Expand Up @@ -37,6 +42,10 @@ <h1>Species: <strong>{{ species.name }}</strong> <small>({{ species.code }})</sm
{{ macro.pagination('Sequences', url_for('species.species_sequences', species_id=species.id), species.sequence_count, none) }}

{% elif all_species %}
<ol class="breadcrumb">
<li><a href="{{ url_for('main.screen') }}">Home</a></li>
<li class="active"><strong>Species</strong></li>
</ol>
<h1>Species Overview</h1>
<div class="table-responsive">
<table class="table" style="margin-bottom:100px;" id="species_table">
Expand Down

0 comments on commit b43e45d

Please sign in to comment.