[879b32]: / qiita_pet / templates / stats.html

Download this file

210 lines (196 with data), 6.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{% extends sitebase.html %}
{% block head %}
<link rel="stylesheet" href="{% raw qiita_config.portal_dir %}/static/vendor/css/ol.css" type="text/css">
<style type="text/css">
#map-canvas { height: 500px; }
.ol-popup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 180px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
}
</style>
<script src="{% raw qiita_config.portal_dir %}/static/vendor/js/ol.js"></script>
<script type="text/javascript">
// -> Borrowed from https://stackoverflow.com/q/32102584
// internal function to avoid duplication of code
function _generate_iconFeature(sid, lat, lng) {
var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([lng, lat], 'EPSG:4326', 'EPSG:3857')),
study_id: sid,
});
return iconFeature;
}
// adding features via the lat/long
var iconFeatures = [];
{% for sid, lat, lng in lat_longs %}
{% if lat > -90 and lat < 90 and lng > -180 and lng < 180 %}
iconFeatures.push(_generate_iconFeature({% raw sid %}, {% raw lat %}, {% raw lng %}));
{% end %}
{% end %}
// creating new verctor &layer for the markers
var vectorSource = new ol.source.Vector({ features: iconFeatures });
var vectorLayer = new ol.layer.Vector({ source: vectorSource });
$( document ).ready(function() {
// creating map
var map = new ol.Map({
target: 'map-canvas',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
vectorLayer
],
view: new ol.View({
center: ol.proj.fromLonLat([{% raw qiita_config.stats_map_center_longitude %}, {% raw qiita_config.stats_map_center_latitude %}]),
zoom: 4
})
});
var closer = document.getElementById('map-canvas-popup-closer');
closer.onclick = function() {
overlay.setPosition(undefined);
closer.blur();
return false;
};
var container = document.getElementById('map-canvas-popup');
var overlay = new ol.Overlay({
element: container,
positioning: 'bottom-center',
autoPan: true,
offset: [0, 0],
autoPanAnimation: {
duration: 250
}
});
map.addOverlay(overlay);
map.on('click', function(evt) {
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature) {
return feature;
});
if (feature) {
var coordinates = feature.getGeometry().getCoordinates();
var content = document.getElementById('map-canvas-popup-content');
var study_id = feature.get('study_id');
var text = 'Sample from study: ' + study_id;
{% if user is not None %}
content.innerHTML = '<a target="_blank" href="{% raw qiita_config.portal_dir %}/study/description/' + study_id + '">' + text + '</a>';
{% else %}
content.innerHTML = text;
{% end %}
overlay.setPosition(coordinates);
}
});
});
</script>
{% end %}
{% block content %}
<div id="jumbotron" class="jumbotron">
<small>Generated on: {{time}}</small>
<br/><br/>
<table width="100%">
<thead>
<tr>
<th>Studies</th>
<th>Unique Samples per Visibility Status</th>
<th>Public Samples per Data Type</th>
<th>Users</th>
<th>Jobs</th>
</tr>
</thead>
<tr>
<td>
{% for k in number_studies %}
<i>{{k}}</i>: {{ "{:,}".format(int(number_studies[k])) }} <br/>
{% end %}
{% if num_studies_ebi and num_studies_ebi is not None %}
<i>submitted to EBI</i>: {{ "{:,}".format(int(num_studies_ebi)) }}
{% end %}
</td>
<td>
{% for k, v in number_of_samples.items() %}
<i>{{k}}</i>: {{ "{:,}".format(int(v)) }} <br/>
{% end %}
{% if num_samples_ebi and num_samples_ebi is not None %}
<i>submitted to EBI</i>: {{ "{:,}".format(int(num_samples_ebi)) }} <br/>
{% end %}
{% if number_samples_ebi_prep and number_samples_ebi_prep is not None %}
<i>submitted to EBI (prep)</i>: {{ "{:,}".format(int(number_samples_ebi_prep)) }}
{% end %}
</td>
<td>
{% for k, v in per_data_type_stats.items() %}
<i>{{k}}</i>: {{ "{:,}".format(int(v)) }} <br/>
{% end %}
</td>
{% if num_users and num_users is not None %}
<td>{{ "{:,}".format(int(num_users)) }}</td>
{% end %}
{% if num_processing_jobs and num_processing_jobs is not None %}
<td>{{ "{:,}".format(int(num_processing_jobs)) }}</td>
{% end %}
</tr>
</table>
</div>
<div id="map-canvas"></div>
<div id="map-canvas-popup" class="ol-popup">
<a href="#" id="map-canvas-popup-closer" class="ol-popup-closer"></a>
<div id="map-canvas-popup-content"></div>
</div>
{% if random_study_id is not None %}
<div id="jumbotron" class="jumbotron">
<h2>Check out this random public study from the database!</h2>
<h3>{{ random_study_title }}</h3>
<p align="justify">{{ random_study_info['study_abstract'] }}</p>
<p>
{% if user is not None %}
<a href="{% raw qiita_config.portal_dir %}/study/description/{{ random_study_id }}">Go to the study <span class="glyphicon glyphicon-arrow-right"></span></a>
{% else %}
<h4>Log in above to see this and other public studies</h4>
{% end %}
</p>
</div>
{% end %}
{% if img and img is not None %}
<div>
<h5>Data usage</h5>
<img height="100%" width="100%" src="{% raw img %}"/>
</div>
{% end %}
{% end %}