Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable copy_field_art2samp to copy values from Aggregate QC steps #303

Merged
merged 6 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions VERSIONLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Scilifelab_epps Version Log

## 20240122.1

Enable copy_field_art2samp to copy values from Aggregate QC steps

## 20230111.1

Add CI-check to see versionlog is updated for a given pull request
Expand Down
28 changes: 24 additions & 4 deletions scripts/copy_field_art2samp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""

import logging
import re
import sys
from argparse import ArgumentParser

Expand All @@ -28,6 +29,8 @@

from scilifelab_epps.epp import CopyField, EppLogger

NGISAMPLE_PAT = re.compile("P[0-9]+_[0-9]+")


def main(lims, args, epp_logger):
source_udfs = args.source_udf
Expand All @@ -53,10 +56,21 @@ def main(lims, args, epp_logger):
for artifact in artifacts:
if source_udf in artifact.udf:
correct_artifacts = correct_artifacts + 1
copy_sesion = CopyField(
artifact, artifact.samples[0], source_udf, dest_udf
)
test = copy_sesion.copy_udf(changelog_f)
# Special case for copying values from Aggregate QC step;
# Only copy for NGI samples and skip controls
if NGISAMPLE_PAT.findall(artifact.samples[0].name):
if args.aggregate:
art_sample_dest = artifact.samples[0].artifact
else:
art_sample_dest = artifact.samples[0]

copy_sesion = CopyField(
artifact, art_sample_dest, source_udf, dest_udf
)
test = copy_sesion.copy_udf(changelog_f)
else:
test = ""

if test:
no_updated = no_updated + 1
else:
Expand Down Expand Up @@ -134,6 +148,12 @@ def main(lims, args, epp_logger):
"Prepends the old changelog file by default."
),
)
parser.add_argument(
"--aggregate",
dest="aggregate",
action="store_true",
help=("Used for Aggregate QC step specially."),
)
args = parser.parse_args()

lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand Down
16 changes: 9 additions & 7 deletions scripts/write_notes_to_couchdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ def write_note_to_couch(pid, timestamp, note, lims):
trans_table = proj_coord_name.maketrans("áéíóú", "aeiou")
proj_coord_name_trans = proj_coord_name.translate(trans_table)
proj_coord = ".".join(proj_coord_name_trans.split()) + "@scilifelab.se"
text = "A note has been created from LIMS in the project {}, {}! The note is as follows\n\
text = (
"A note has been created from LIMS in the project {}, {}! The note is as follows\n\
>{} - {}{}\
>{}".format(
pid,
doc["project_name"],
note["user"],
time_in_format,
note.get("category"),
note,
pid,
doc["project_name"],
note["user"],
time_in_format,
note.get("category"),
note,
)
)

html = '<html>\
Expand Down
Loading