GithubHelp home page GithubHelp logo

semaphoresolutions / s4-clarity-lib Goto Github PK

View Code? Open in Web Editor NEW
16.0 13.0 11.0 283 KB

A modern Python library for BaseSpace Clarity LIMS.

Home Page: https://s4-clarity-lib.readthedocs.io

License: MIT License

XSLT 4.36% Python 95.64%
lims clarity genologics illumina basespace ngs bioinformatics

s4-clarity-lib's Introduction

S4-Clarity Library

image

Used in numerous labs around the world, the S4-Clarity library provides an easy-to-use integration with the BaseSpace Clarity LIMS API. The package includes:
  • Classes representing familiar Clarity API entities that provide read-write access to most properties.
  • Helper methods that simplify common operations.
  • Base classes for scripts that integrate with Clarity: EPPs, DSAs, and shell scripts.
  • Utilities that help with Clarity-related tasks, such as managing config slices, or automating the completion of a Step.

The S4-Clarity library lets developers interact with the Clarity API in fewer lines of code. With HTTP and XML boilerplate out of the way, you'll have your integration built in no time at all.

from s4.clarity.scripts import TriggeredStepEPP

LibraryVolume = 2.0
MolWeightBasePair = 660 * 1e6  # micrograms / mol
AssumedBasePairs = 400.0
TargetMolarity = 4.0
Overage = 4


class Normalization (TriggeredStepEPP):
    def on_record_details_enter(self):
        self.prefetch(self.PREFETCH_INPUTS, self.PREFETCH_OUTPUTS)

        for iomap in self.step.details.iomaps:
            library_concentration = iomap.input["Concentration"]
            library_molarity = library_concentration / (AssumedBasePairs * MolWeightBasePair)
            iomap.output["Concentration"] = library_concentration
            iomap.output["Molarity (nM)"] = library_molarity
            iomap.output["Library Vol (uL)"] = LibraryVolume
            iomap.output["Tris HCl (uL)"] = LibraryVolume * (library_molarity / TargetMolarity - 1)

        self.lims.artifacts.batch_update(self.step.details.outputs)


if __name__ == "__main__":
    Normalization.main()

Installation

To install s4-clarity, simply use pip:

$ pip install s4-clarity

s4-clarity-lib's People

Contributors

bayersglassey-semaphore avatar g-meyer avatar katherine-epp avatar katrina-s4 avatar mark-swinkels avatar mgillis avatar nik-aleliunas avatar rickwalder avatar roxannebenoit avatar smallsco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s4-clarity-lib's Issues

broken in python 3.10 because the attribute MutableMapping has been removed from the module collections

`Python 3.10.6 (main, Aug 5 2022, 16:21:03) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Python shell history and tab completion are enabled.

from s4.clarity.scripts import TriggeredStepEPP
Traceback (most recent call last):
File "", line 1, in
File "/opt/pkg/lib/python3.10/site-packages/s4/clarity/init.py", line 12, in
from ._internal.lazy_property import lazy_property
File "/opt/pkg/lib/python3.10/site-packages/s4/clarity/_internal/init.py", line 6, in
from .fields import FieldsMixin
File "/opt/pkg/lib/python3.10/site-packages/s4/clarity/_internal/fields.py", line 163, in
class FieldsDict(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'`

container.artifact_at raises KeyError instead of returning None for empty, valid wells

docs suggest that container.artifact_at should return none if the well is empty:

def artifact_at(self, well):
        """
        :param well: String matching "Y:X" where Y is a column index and X is a row index.
            The string may use letters or numbers depending on the container type.
        :type well: str

        :rtype: Artifact or None

currently, artifact_at will throw a KeyError instead. This is the correct behavior for an invalid well.

artifact_at should consult self.container_type.row_major_order_wells to decide if it should throw a KeyError (preferably an InvalidWellError?) or return None

Typing dependency breaks deployments in AWS lambda

The explicit dependency on typing is no longer required given typing is part of the python Standard Library. When deploying this package in AWS lambda via the serverless application model, the order of dependency loading generates an error type object 'Callable' has no attribute '_abc_registry'. Is it possible to remove the explicit dependency on Typing for Python versions >= 3.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.