ELN
- class LabGuruAPI._eln.Element(**kwargs)[source]
- class_name = 'Element'
The programmatic class name for the LG API
- class_display_name = 'Experiments'
The human-readable class name for the LG API
- element_type
equipment/sample/text/steps/plate/excel
- data
The element’s data. Will vary depending on the type
- position
The element’s position within a section
- format_data(**kwargs: Any) str[source]
Used to replace values in templated text with actual values for an experiment. Template text is contained in Foundry protocols and denoted by double curly brackets.
Example
Let’s say that protocol #27 has an element containing the text: Transfer {{move_vol}} μL of {{reagent}} into the tube. It would be replaced in a function like this:
protocol = Protocol.from_id(27) current_experiment_text = protocol.sections[0].elements[0].format_data(move_vol=33, reagent='water') print(current_experiment_text) # Result # Transfer 33 μL of water into the tube.
- Parameters:
kwargs
- Returns:
the formatted text
- class LabGuruAPI._eln.Section(**kwargs)[source]
- class_name = 'ExperimentProcedure'
The programmatic class name for the LG API
- class_display_name = 'Sections'
The human-readable class name for the LG API
- elements
A list of elements contained in the section
- collapsed
True if the section should be collapsed
- container_id
ID of the container experiment/protocol
- container_type
the type of the container - Projects::Experiment, Knowledgebase::Protocol, Knowledgebase::Report
- classmethod parse_api_data(json_data: ~typing.Dict[str, ~typing.Any], session: Session = <LabGuruAPI._base.Session object>, include_custom=False) Section[source]
Generates a python object from the LabGuru API’s JSON response. This is a low-level function that should not be used routinely.
- Parameters:
json_data – the JSON dictionary read from the API
session – the active LG session. Please leave as the default value.
include_custom – add the LG “custom###” fields to LGI.other_properties. Default: false
- Returns:
the python version of the LG object
- add_text_element(html: str, name=None) Element[source]
Adds a “text” element to the end of the current section.
- Parameters:
html – The HTML that will be displayed by the element
name – Optional value. Will only appear in a link.
- Returns:
the new element
- add_plate_element(plate: Plate, add_stocks=True) Element[source]
Add a plate element to a section. Actual LG plates are awful to work with, so this actually creates a “text” element and adds the platemap via an HTML table.
- Parameters:
plate – the Plate object that will be displayed as a map
add_stocks – if True, add the plate’s stocks as samples to the section
- Returns:
the text element
- add_samples_element(items: List[Sample | Collections]) Element[source]
Adds a “samples” element. Can be initialized with a list of samples to add.
- add_stock(item: Stock)[source]
Adds a Stock to the section’s sample element. Will create an element if it does not exist.
- add_stocks(items: Iterable[Stock])[source]
Adds a list of Stock items to the section’s sample element. Will create an element if it does not exist.
- add_attachments(*paths: Path | str | CSVRobofile, att_id: int | None = None) Element[source]
Adds one or many files to an attachment element in the section.
- Parameters:
paths – Paths to files to upload (Path or str). Can also add CSVRobofile objects, which will render as a csv
att_id – The ID of an existing attachment element. One will be created if this is None.
- Returns:
the attachment element
- class LabGuruAPI._eln.Protocol(**kwargs)[source]
- sections
A list of sections contained in the protocol
- class LabGuruAPI._eln.Experiment(**kwargs)[source]
- class_name = 'Projects::Experiment'
The programmatic class name for the LG API
- class_display_name = 'Experiments'
The human-readable class name for the LG API
- sections
A list of Sections contained in the experiment
- classmethod new_from_protocol(title: str, protocol_id: int, project_id: int = 18, milestone_id: int = 38) Experiment[source]
Creates a new LabGuru experiment from the specified protocol and appends the experiment ID to the beginning of the experiment’s title.
- Parameters:
title – A string representing the title of the experiment.
protocol_id – An integer representing the ID of the protocol associated with the experiment.
project_id – An optional integer representing the ID of the project the experiment belongs to. Default is 18 for the “Foundry” project.
milestone_id – An optional integer representing the ID of the milestone the experiment belongs to. Default is 38 for the “Requests” folder.
- Returns:
An instance of the Experiment class.
- Raises:
None –
Example
experiment = Experiment.new_from_protocol(title=”Experiment 1”, protocol_id=1234)
- property base_id: int
ID of this experiment’s base experiment (converts the first 4 characters of the expt name into an int)