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

Release v1.6.0 #62

Merged
merged 5 commits into from
Jul 19, 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Release History
===============
1.6.0
-
- (#60) Added support for Python 3.12.
- (#55) Step placements can now be updated without having to clear existing placements first.
- (#53) Fix an issue that prevented `StepRunner.add_default_reagents()` from working correctly on Clarity 6.1+ if the step being run contains an archived reagent kit.
- (#51) Fix an issue that could cause log messages to become duplicated, or disappear, when `s4-clarity-lib` is being used in tandem with an LLTK/LITK on the same step in Clarity 6.0+.
- (#51) Added `lims.versions` and `lims.current_minor_version` properties.

1.5.0
-
- (#45) Added the `permitted_containers` property to `StepConfiguration`.
Expand Down
31 changes: 31 additions & 0 deletions s4/clarity/lims.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
import logging
import re
import time

try:
import urllib.parse as urlparse # Python 3
except ImportError:
import urlparse # Python 2

from xml.etree import cElementTree as ETree

import requests
Expand Down Expand Up @@ -247,6 +253,31 @@ def properties(self):
properties = root.findall("property")
return dict( (property.get("name"), property.get("value")) for property in properties )

@lazy_property
def versions(self):
"""
:type: list[dict]
"""
root = self.request("get", self.root_uri + "/..")
versions = root.findall("version")
return list({
"uri": version.get("uri"),
"major": version.get("major"),
"minor": version.get("minor")
} for version in versions)

@lazy_property
def current_minor_version(self):
"""
:type: str
"""
path = urlparse.urlparse(self.root_uri).path
current_major_version = [x for x in path.split("/") if x][-1]
root = self.request("get", self.root_uri + "/..")
xpath = "version[@major='%s']" % current_major_version
version = root.findall(xpath)[0]
return version.get("minor")

def raw_request(self, method, uri, **kwargs):
"""
:type method: str
Expand Down
17 changes: 15 additions & 2 deletions s4/clarity/scripts/stepepp.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,24 @@ def open_log_output_stream(self):
Use step's logfile.
"""
if self.options.logfile:

# Log files that are shared by Python and LLTK/LITKs on a step must
# use the same file name in order to prevent bugs. In Clarity 5 and
# earlier, the file name used by LLTK/LITKs is simply the limsid of
# the ResultFile. But in Clarity 6 and later it has "LogFile"
# appended to the name, and so we need to check the active Clarity
# version and adjust our behaviour accordingly.

filename = self.options.logfile
revision = int(self.lims.current_minor_version[1:])
if revision >= 31: # Clarity 6.0 has an API minor version of 31
filename = "%s-LogFile" % filename

if self.options.log_type == 'html':
filename = "%s.html" % self.options.logfile
filename = "%s.html" % filename
content_type = 'text/html'
elif self.options.log_type == 'text':
filename = "%s.log" % self.options.logfile
filename = "%s.log" % filename
content_type = 'text/plain'
else:
raise Exception("Unrecognized log type %s", self.options.log_type)
Expand Down
4 changes: 3 additions & 1 deletion s4/clarity/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ def create_placement(self, artifact, container, well_string):
:param well_string: The location on the plate to place the artifact
"""
placement_root = self.xml_root.find("./output-placements")
placement_node = ETree.SubElement(placement_root, "output-placement", {"uri": artifact.uri})
placement_node = self.xml_root.find("./output-placements/output-placement[@uri='" + artifact.uri + "']")
if not placement_node:
placement_node = ETree.SubElement(placement_root, "output-placement", {"uri": artifact.uri})
location_subnode = ETree.SubElement(placement_node, "location")
ETree.SubElement(location_subnode, "container", {"uri": container.uri})
ETree.SubElement(location_subnode, "value").text = well_string
Expand Down
5 changes: 5 additions & 0 deletions s4/clarity/steputils/step_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,15 @@ def add_default_reagents(self):
"""
For every required reagent kit in the step, the first active lot
will be selected. If there are no active lots it will be omitted.

Archived kits will be ignored on Clarity 6.1 (api revision 32) and later.
"""
revision = int(self.lims.current_minor_version[1:])
log.info("Adding default reagent lots.")
lots = []
for kit in self.step.configuration.required_reagent_kits:
if revision >= 32 and kit.archived:
continue
for lot in kit.related_reagent_lots:
if lot.status == "ACTIVE":
lots.append(lot)
Expand Down
2 changes: 1 addition & 1 deletion s4/clarity/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 Semaphore Solutions, Inc.
# ---------------------------------------------------------------------------

__version__ = '1.5.0'
__version__ = '1.6.0'
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: PyPy'
],
install_requires=(
Expand Down