Skip to content

Commit

Permalink
Merge with upstream master
Browse files Browse the repository at this point in the history
  • Loading branch information
alneberg committed Jan 29, 2025
2 parents f03f370 + 310de67 commit c7fce4e
Show file tree
Hide file tree
Showing 14 changed files with 394 additions and 128 deletions.
6 changes: 0 additions & 6 deletions .github/pr_labels.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/check_pr_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Label on PR
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]

jobs:
check-pr_label:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Check if the PR contains the label validation or no validation
id: prlabel_check
if: |
! contains( github.event.pull_request.labels.*.name, 'validation') && ! contains( github.event.pull_request.labels.*.name, 'no validation')
run: |
echo "Neither 'validation' nor 'no validation' labels are present."
exit 1 # Exit with a failure
8 changes: 7 additions & 1 deletion run_dir/design/deliveries.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ <h3>
<td class="bioinfo-status-expand"><a href="#bioinfo-fc-{{ project_id }}-{{ flowcell_id }}" class="bioinfo-expand">
<span class="fa fa-chevron-right"></span></a></td>
<td></td>
<td class="bioinfo-granularity"><samp><a class="text-decoration-none" href="/flowcells/{{ flowcell_id }}">{{ flowcell_id }}</a></samp></td>
{% set url_addition = "" %}
{% if flowcell.get("instrument_type") == "element"%}
{% set url_addition = "_element" %}
{% elif flowcell.get("instrument_type") == "ont"%}
{% set url_addition = "_ont" %}
{% end %}
<td class="bioinfo-granularity"><samp><a class="text-decoration-none" href="/flowcells{{url_addition}}/{{ flowcell_id }}">{{ flowcell_id }}</a></samp></td>
<td><span class="bioinfo-status badge {{ status_css.get(flowcell['flowcell_status'], 'bg-primary') }}">{{ flowcell['flowcell_status'] }}</span></td>
<td class="bi-run-pwf hide-incoming {% if flowcell['checklist']['total'] == flowcell['checklist']['completed'] %} table-success {% else %} table-warning {% end %}">
<div class="progress">
Expand Down
33 changes: 22 additions & 11 deletions run_dir/design/project_samples_old.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,34 @@ <h4>User project description
<li class="nav-item"><a class="nav-link" href="#tab_running_notes_content" role="tab" data-toggle="tab">Running Notes</a></li>
<li class="nav-item"><a class="nav-link" href="#tab_com_content" role="tab" data-toggle="tab" id="tab_communication">User communication</a></li>
<li class="nav-item"><a class="nav-link" href="#tab_links_content" role="tab" data-toggle="tab">Links</a></li>
{% if not multiqc %}
<li class="nav-item" data-toggle="tooltip" data-html="true" data-placement="bottom" title="No MultiQC report available" ><a class="nav-link disabled">Open MultiQC reports</a></li>
{% else %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Open MultiQC reports</a>
<div class="dropdown-menu">
{% for key in multiqc %}
<li class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" id="reports_dropdown">Reports</a>
<div class="dropdown-menu" aria-labelledby="reports_dropdown">
{% if not reports%}
<a class="dropdown-item" href="#" disabled>No reports to show</a>
{% end %}
{% if 'multiqc' in reports%}
{% for key in reports['multiqc'] %}
{% if 'qc' in key %}
{% set rep_name = ' QC' %}
{% else %}
{% set rep_name = ' '+key.strip('_').capitalize() %}
{% end %}
<a class="dropdown-item" href="/multiqc_report/{{ project }}?type={{ key }}" target="_blank">Open{{ rep_name }} MultiQC report</a>
<a class="dropdown-item" href="/multiqc_report/{{ project }}?type={{ key }}" target="_blank">MultiQC {{ rep_name }}</a>
{% end %}
</div>
</li>
{% end %}
{% end %}
{% if 'project_summary' in reports %}
<a class="dropdown-item" href="/proj_summary_report/{{ project }}" target="_blank">Project Summary</a>
{% end %}
{% if 'sample_summary_reports' in reports %}
<h6 class="dropdown-header">Single Cell Sample Summary</h6>
{% for sample, values in reports['sample_summary_reports'].items() %}
{% for method, report in values.items() %}
<a class="dropdown-item" href="/singlecell_sample_summary_report/{{ project }}/{{ sample }}/{{ report }}" target="_blank"> {{ sample }} {{ method }} </a>
{% end %}
{% end %}
{% end %}
</div>
</li>
<li class="nav-item"><a class="nav-link" href="/bioinfo/{{ project }}" target="_blank">Open bioinfo tab</a></li>
<li class="nav-item"><a class="nav-link" href="#tab_agreements_content" role="tab" data-toggle="tab" id="tab_agreements">Agreements</a></li>
</ul>
Expand Down
5 changes: 3 additions & 2 deletions status/bioinfo_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import dateutil

from status.reports import MultiQCReportHandler
from status.util import SafeHandler


Expand Down Expand Up @@ -282,8 +283,8 @@ def get(self, project_id):
if application in app_classes[key]:
application = key
break
# to check if multiqc report exists (get_multiqc() is defined in util.BaseHandler)
multiqc = self.get_multiqc(project_id) or ""

multiqc = MultiQCReportHandler.get_multiqc(self.application, project_id) or ""
self.write(
t.generate(
gs_globals=self.application.gs_globals,
Expand Down
55 changes: 35 additions & 20 deletions status/clone_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,21 @@ class LIMSProjectCloningHandler(SafeHandler):
"""

def get(self, project_identifier):
# Check if the project_identifier matches a project id.
# If not, assuming it's a project name, try to get the project id from the project name,
# since the LIMS API only accepts project ids
if not re.match("^(P[0-9]{3,7})", project_identifier):
try:
projectid = (
self.application.projects_db.view("projects/name_to_id")[
project_identifier
]
.rows[0]
.value
)
except IndexError:
self.set_status(404)
return self.write({"error": "Project not found"})
else:
projectid = project_identifier
projectid = self.get_project_id(project_identifier)
if not projectid:
self.set_status(404)
return self.write({"error": "Project not found"})

proj_values = self.get_project_data_from_lims(projectid, "get")
if not proj_values:
self.set_status(404)
self.write({"error": "Project not found"})
return

self.set_header("Content-type", "application/json")
self.write(proj_values)

def post(self, projectid):
def post(self, project_identifier):
if not (
self.get_current_user().is_proj_coord
or self.get_current_user().is_any_admin
Expand All @@ -63,6 +52,11 @@ def post(self, projectid):
"Error: You do not have the permissions for this operation!"
)

projectid = self.get_project_id(project_identifier)
if not projectid:
self.set_status(404)
return self.write({"error": "Project not found"})

new_proj = self.get_project_data_from_lims(projectid, "post")
if "error" in new_proj:
self.set_status(400)
Expand All @@ -72,7 +66,7 @@ def post(self, projectid):
self.set_status(201)
self.write(new_proj)

def get_project_data_from_lims(self, projectid, type):
def get_project_data_from_lims(self, projectid, req_type):
copy_udfs = {
"Customer project reference",
"Project Comment",
Expand Down Expand Up @@ -128,7 +122,7 @@ def get_project_data_from_lims(self, projectid, type):
udfs[udf] = existing_project.udf[udf]
proj_values["udfs"] = udfs

if type == "get":
if req_type == "get":
return proj_values

else:
Expand All @@ -149,3 +143,24 @@ def get_project_data_from_lims(self, projectid, type):
return {"error": e.message}

return {"project_id": new_project.id, "project_name": new_project.name}

def get_project_id(self, project_identifier):
"""Return projectid for the provided identifier"""
# Check if the project_identifier matches a project id.
# If not, assuming it's a project name, try to get the project id from the project name,
# since the LIMS API only accepts project ids
projectid = None
if re.match("^(P[0-9]{3,7})", project_identifier):
projectid = project_identifier
else:
try:
projectid = (
self.application.projects_db.view("projects/name_to_id")[
project_identifier
]
.rows[0]
.value
)
except IndexError:
pass
return projectid
2 changes: 2 additions & 0 deletions status/deliveries.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def get(self):

# define bioinfo checklist
sample_data = flowcells[flowcell_id][lane_id][sample_id]
instrument_type = sample_data.get("instrument_type")
checklist = self.__fill_checklist(sample_data)
if checklist["total"] and len(checklist["total"]) == len(
checklist["passed"]
Expand Down Expand Up @@ -233,6 +234,7 @@ def get(self):
flowcell_status = self.__aggregate_status(flowcell_statuses)
runs_bioinfo[flowcell_id]["flowcell_status"] = flowcell_status
runs_bioinfo[flowcell_id]["checklist"] = flowcell_checklists
runs_bioinfo[flowcell_id]["instrument_type"] = instrument_type

# add flowcell_status to the status_list (needed for filtering)
if flowcell_status not in status_list:
Expand Down
20 changes: 14 additions & 6 deletions status/flowcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,9 @@ def __init__(self, application, request, **kwargs):
super(SafeHandler, self).__init__(application, request, **kwargs)

def get(self, name):
reports_dir = self.application.minknow_reports_path
report_path = os.path.join(reports_dir, f"report_{name}.html")
report_path = os.path.join(
self.application.report_path["minknow"], f"report_{name}.html"
)

self.write(open(report_path).read())

Expand All @@ -483,8 +484,9 @@ def __init__(self, application, request, **kwargs):
super(SafeHandler, self).__init__(application, request, **kwargs)

def get(self, name):
reports_dir = self.application.toulligqc_reports_path
report_path = os.path.join(reports_dir, f"report_{name}.html")
report_path = os.path.join(
self.application.report_path["toulligqc"], f"report_{name}.html"
)

self.write(open(report_path).read())

Expand Down Expand Up @@ -758,10 +760,16 @@ def get(self, name):
barcodes=self.fetch_barcodes(name),
args=self.fetch_args(name),
has_minknow_report=os.path.exists(
f"{self.application.minknow_reports_path}/report_{name}.html"
os.path.join(
self.application.report_path["minknow"],
f"report_{name}.html",
)
),
has_toulligqc_report=os.path.exists(
f"{self.application.toulligqc_reports_path}/report_{name}.html"
os.path.join(
self.application.report_path["tooulligqc"],
f"report_{name}.html",
)
),
user=self.get_current_user(),
)
Expand Down
20 changes: 0 additions & 20 deletions status/multiqc_report.py

This file was deleted.

Loading

0 comments on commit c7fce4e

Please sign in to comment.