Skip to content

Commit

Permalink
Merge pull request #898 from aanil/queues_update
Browse files Browse the repository at this point in the history
Link and search for element FCs
  • Loading branch information
aanil authored Nov 14, 2024
2 parents f84f6e2 + 4aab030 commit a14b77e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
6 changes: 5 additions & 1 deletion run_dir/design/bioinfo_tab/run_lane_sample_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@
<tbody class="text-center">
{% for flowcell_id, flowcell in sorted(bioinfo['run_lane_sample_view'].items()) %}
{% set disabled = True if flowcell.get('flowcell_status') in ['Demultiplexing', 'Transferring', 'Sequencing', 'ERROR', 'Failed', 'Delivered'] else False %}
{% set url_addition = "" %}
{% if flowcell.get("instrument_type") == "element"%}
{% set url_addition = "_element" %}
{% end %}
<tr class="bioinfo-fc {% if disabled %} bioinfo-status-disabled {% end %}"
id="bioinfo-fc-{{ flowcell_id }}" data-parent="#bioinfo-project-{{ project_id }}">
<td class="bioinfo-status-expand"><a class="bioinfo-expand text-decoration-none" href="#bioinfo-fc-{{ flowcell_id }}">
<span class="fa fa-chevron-right"></span></a></td>
<td></td>
<td><samp><a class="text-decoration-none" href="/flowcells/{{ flowcell_id }}">{{ flowcell_id }}</a></samp></td>
<td><samp><a class="text-decoration-none" href="/flowcells{{url_addition}}/{{ flowcell_id }}">{{ flowcell_id }}</a></samp></td>
<td class="bioinfo-status-runstate"><span class="badge {{ status_css.get(flowcell['flowcell_status'], 'bg-secondary') }}">{{ flowcell['flowcell_status'] }}</span></td>
<td class="bioinfo-status-row ?"><span class="fa fa-arrow-alt-right"></span></td>
<td class="bioinfo-status-qc undemultiplexedreads unknown">?</td>
Expand Down
6 changes: 5 additions & 1 deletion run_dir/design/bioinfo_tab/sample_run_lane_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,17 @@
</td>
</tr>
{% for flowcell_id, flowcell in sorted(sample['flowcells'].items()) %}
{% set url_addition = "" %}
{% if flowcell.get("instrument_type") == "element"%}
{% set url_addition = "_element" %}
{% end %}
<tr class="bioinfo-fc {% if flowcell.get('flowcell_status') in ['Demultiplexing', 'Transferring', 'Sequencing', 'ERROR', 'Failed', 'Delivered'] %} bioinfo-status-disabled {% end %}"
id="bioinfo-fc-{{ sample_id }}-{{ flowcell_id }}"
data-parent="#bioinfo-sample-{{ sample_id }}" style="display:none;">
<td></td>
<td class="bioinfo-status-expand"><a href="#bioinfo-fc-{{ sample_id }}-{{ flowcell_id }}" class="bioinfo-expand">
<span class="fa fa-chevron-right"></span></a></td>
<td><samp><a class="text-decoration-none" href="/flowcells/{{ flowcell_id }}">{{ flowcell_id }}</a></samp></td>
<td><samp><a class="text-decoration-none" href="/flowcells{{url_addition}}/{{ flowcell_id }}">{{ flowcell_id }}</a></samp></td>
<td class="bioinfo-status-runstate"><span class="badge {{ status_css.get(flowcell['flowcell_status'], 'bg-secondary') }}">{{ flowcell['flowcell_status'] }}</span></td>
<td class="bioinfo-status-row ?"><span class="fa fa-arrow-alt-right"></span></td>
<td class="bioinfo-status-qc undemultiplexedreads unknown">?</td>
Expand Down
12 changes: 10 additions & 2 deletions status/bioinfo_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,24 @@ def get(self, project_id):
edit_history = {}
for row in view[project_id].rows:
flowcell_id = row.value.get("run_id")
instrument_type = row.value.get("instrument_type", "illumina")
lane_id = row.value.get("lane")
sample_id = row.value.get("sample")
changes = row.value.get("values", {})
last_timestamp = max(list(changes))
bioinfo_qc = changes.get(last_timestamp, {})
bioinfo_data["instrument_type"] = instrument_type

# building first view
bioinfo1 = bioinfo_data["sample_run_lane_view"]
if sample_id not in bioinfo1:
bioinfo1[sample_id] = {
"flowcells": {flowcell_id: {"lanes": {lane_id: bioinfo_qc}}}
"flowcells": {
flowcell_id: {
"lanes": {lane_id: bioinfo_qc},
"instrument_type": instrument_type,
}
}
}
elif flowcell_id not in bioinfo1[sample_id]["flowcells"]:
bioinfo1[sample_id]["flowcells"][flowcell_id] = {
Expand All @@ -129,7 +136,8 @@ def get(self, project_id):
bioinfo2 = bioinfo_data["run_lane_sample_view"]
if flowcell_id not in bioinfo2:
bioinfo2[flowcell_id] = {
"lanes": {lane_id: {"samples": {sample_id: bioinfo_qc}}}
"lanes": {lane_id: {"samples": {sample_id: bioinfo_qc}}},
"instrument_type": instrument_type,
}
elif lane_id not in bioinfo2[flowcell_id]["lanes"]:
bioinfo2[flowcell_id]["lanes"][lane_id] = {
Expand Down
19 changes: 19 additions & 0 deletions status/flowcells.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class FlowcellSearchHandler(SafeHandler):
cached_fc_list = None
cached_xfc_list = None
cached_ont_fc_list = None
cached_element_fc_list = None
last_fetched = None

def get(self, search_string):
Expand Down Expand Up @@ -287,6 +288,13 @@ def search_flowcell_names(self, search_string=""):
)
FlowcellSearchHandler.cached_ont_fc_list = [row.key for row in ont_fc_view]

element_fc_view = self.application.element_runs_db.view(
"info/name", descending=True
)
FlowcellSearchHandler.cached_element_fc_list = [
row.key for row in element_fc_view
]

FlowcellSearchHandler.last_fetched = datetime.datetime.now()

search_string = search_string.lower()
Expand Down Expand Up @@ -314,6 +322,17 @@ def search_flowcell_names(self, search_string=""):
except AttributeError:
pass

for row_key in FlowcellSearchHandler.cached_element_fc_list:
try:
if search_string in row_key.lower():
fc = {
"url": f"/flowcells_element/{row_key}",
"name": row_key,
}
flowcells.append(fc)
except AttributeError:
pass

for row_key in FlowcellSearchHandler.cached_fc_list:
try:
if search_string in row_key.lower():
Expand Down

0 comments on commit a14b77e

Please sign in to comment.