Collections

class LabGuruAPI._collections.Collections(**kwargs)[source]
type_name

The LG name for the current type

class_display_name

The human-readable class name for the LG API

created_at

Datetime of the object’s creation. Searchable.

updated_at

Datetime of the object’s last update. Searchable

owner

Dict representation of the object’s owner

classmethod parse_api_data(json_data: ~typing.Dict[str, ~typing.Any], session: ~LabGuruAPI._base.Session = <LabGuruAPI._base.Session object>, include_custom=False) LGI[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

classmethod collection_type_from_url(api_url: str) Type[LGI][source]

Parses an API URL and returns the corresponding Collections subclass

classmethod from_api(session: ~LabGuruAPI._base.Session = <LabGuruAPI._base.Session object>, item_id: int | None = None, name: str | None = None, uuid: str | None = None, api_url: str | None = None, auto_name: str | None = None, include_custom=False) LGI | None[source]

Low-level function. Please use LabGuruItem.from_LG instead.

get_stocks(session: ~LabGuruAPI._base.Session = <LabGuruAPI._base.Session object>) List[Stock][source]

Returns a list of Stock objects associated with the item

async aio_get_stocks() List[Stock][source]

Returns a list of Stock objects associated with the item

async aio_rename(new_name: str) CI[source]

Updates the names and associated stocks of an LG collection item.

Parameters:

new_name (str) – The new name to assign to the current instance of Collections.

Returns:

The updated instance of Collections with the new name assigned.

Return type:

CI

rename(new_name: str, session=<LabGuruAPI._base.Session object>) CI[source]

Updates the names and associated stocks of an LG collection item.

Parameters:
  • new_name – The new name that the object will be renamed to.

  • session – The LabGuru session object used for the API request.

Returns:

The updated instance of Collections with the new name assigned.

Return type:

CI

add_stock(name: str, storage: Storage, well: str | None = None, update: bool = True, **kwargs) Stock[source]

Creates a new Stock for the item and in the provided storage

add_stocks(name: str, storage: Storage, count: int, **kwargs) List[Stock][source]

Creates multiple new Stock objects for the item and in the provided storage

class LabGuruAPI._collections.CI

TypeVar shortcut for all Collection subclasses

alias of TypeVar(‘CI’, bound=Collections)

class LabGuruAPI._collections.Parent(parent_type: Type[CI] | None = None, parent_type_name: str | None = None, search_field: str | None = None)[source]
class LabGuruAPI._collections.Library(**kwargs)[source]
xlsx_collection = 'Libraries'

The Dataset header/Plate upload name for the object class

theoretical_diversity

The maximum theoretical diversity of the library. Searchable.

diversification_method

The method of library generation. Searchable

library_key

The method of library generation. Searchable

property base_plasmid: Plasmid

The plasmid that the library was based on

property base_strain: Strain

The strain that the library was based on

class LabGuruAPI._collections.SelectableMixin(**kwargs)[source]
parent_selection: Selection | None = None

The selection that generated the item

parent_library: Library | None = <LG Collection Item : >

The library that the item came from

class LabGuruAPI._collections.Selection(**kwargs)[source]
xlsx_collection = 'Selections'

The Dataset header/Plate upload name for the object class

step

A count of how many selections have been run between this item and library generation

mechanism

The type of selective pressure being applied in this round

input_diversity

The type of selective pressure being applied in this round

output_diversity

The type of selective pressure being applied in this round

n_cells_in

The type of selective pressure being applied in this round

reporter

The type of selective pressure being applied in this round

class LabGuruAPI._collections.AnchorStrain(**kwargs)[source]
class_display_name = 'Anchor Strain'

The human-readable class name for the LG API

xlsx_collection = 'Anchor Strains'

The Dataset header/Plate upload name for the object class

full_genotype

The full genotype of the anchor strain. Searchable

chromosome_genotype

The chromosomal genotype of the anchor strain. Searchable

plasmid_genotype

The genotype of the anchor strain’s mobile elements. Searchable

class LabGuruAPI._collections.Strain(**kwargs)[source]
class_display_name = 'Strain'

The human-readable class name for the LG API

xlsx_collection = 'Strains'

The Dataset header/Plate upload name for the object class

parent_strain: Strain = None

The strain from which this strain was derived. Searchable.

strain_background

2x310k-T7, U63, DH5α. Searchable.

Type:

The generalized “type” of strain this is. Examples include

strain_genotype

The genotype of the strain. Searchable.

differentiating_modification

A short description of how this strain differs from its parent. Searchable.

plasmids

A comma-separated list of plasmids carried in the strain. Searchable.

barcode

A barcode sequnce contained in the strain’s genome. Searchable.

meaning_of_u

How the UAG codon is translated by the cell. Searchable

rf_status

The presence/absence of Release Factor 1. Searchable

lambda_status

The presence/absence of the lambda prophage. Searchable

tolc_variant

The tolC variant in the strain, if any. Searchable

diversity

String diversity field. Intended for strains associated with libraries and selections.

property plasmid_names: Set[str]

The names of the plasmids carried by the strain

get_plasmids() List[Plasmid][source]

Retrieves a list of Plasmid objects carried by the strain

async aio_get_plasmids() List[Plasmid][source]

Retrieves a list of Plasmid objects carried by the strain

add_colony(colony_name: str, store=False, plasmids: str | None = None) Strain[source]

Generates a copy of the current strain representing a single colony picked from a plate

Parameters:
  • colony_name – A name for the new colony (See Strain.iter_names())

  • store – If true, automatically adds the colony to LG and links the colony to this strain. Default: false

  • plasmids – A comma-separated list of plasmids carried by the colony. Default: plasmids in this strain

Returns:

a new strain

make_new_derived_strain(child_strain_name: str, differentiating_modification: str, additional_plasmids: str = '', cured_plasmids: str = '', additional_genotype: str = '', remove_genotype: str = '', strain_barcode: str | None = None, strain_description: str | None = None, meaning_of_u: str | None = None, commit: bool = True, **kwargs) Strain[source]

Generate a new strain derived from the current one

Parameters:
  • child_strain_name – Name of the new strain

  • differentiating_modification – A short description of how this strain differs from its child

  • additional_plasmids – A comma-separated list of plasmids added to the strain

  • cured_plasmids – A comma-separated list of plasmids removed from the strain

  • additional_genotype – New genome modification

  • remove_genotype – New genome reversions

  • strain_barcode – A barcode added to the child-strain genome

  • strain_description – A description of the child strain

  • meaning_of_u – The amino acid assigned to the UAG codon

  • commit – If true, adds the child strain to the LG database and links the child to its parent and plasmids. Default: True

  • kwargs – Any additional properties to set on the new strain (See Strain.bulk_property_update())

Returns:

the child Strain

calculate_genotype(chromosome_additions: List[str] | None = None, chromosome_reversions: List[str] | None = None, new_plasmids: List[Plasmid] | None = None, cured_plasmids: List[Plasmid] | None = None, depth=0) str[source]

Calculates an anchor-strain based genotype for the current strain. Deprecated. Please do not use.

Parameters:
  • chromosome_additions – List of additional genotype modification. Default: None

  • chromosome_reversions – List of additional genotype reversions. Default: None

  • new_plasmids – List of additional plasmids. Default: None

  • cured_plasmids – List of additional removed plasmids. Default: None

  • depth – current recursion depth. Used internally, please do not set this.

Returns:

a genotype for the strain

async classmethod aio_search_api(session: Session, query_data: Dict[str, Any], cur_page=1) List[LGI][source]

Deprecated since version Please: use LabGuruItem.async_find_all or LabGuruItem.async_find_one

class LabGuruAPI._collections.BiomassPellet(**kwargs)[source]
xlsx_collection = 'Biomass Pellets'

The Dataset header/Plate upload name for the object class

parent_strain: Strain = <Strain : >

The strain from which this item was derived. Searchable.

media_type

The media used to genenrate the biomass. Searchable.

antibiotics

The antibiotics used in the media. Searchable.

additives

Any additional compounds added to the media. Searchable.

expression_time

The number of hours between induction and harvest. Searchable.

induction

The biomass induction system. Searchable.

affinity_tags

Any affinity tags included on the target product. Searchable.

pellet_weight

Grams of wet cell weight. Searchable.

notes

Anything else. Searchable.

derived_inclusion_body(session: Session) InclusionBody | None[source]

Find an inclusion body derived from this item.

class LabGuruAPI._collections.InclusionBody(**kwargs)[source]
xlsx_collection = 'Inclusion Bodies'

The Dataset header/Plate upload name for the object class

weight

Weight of the inclusion body in grams. Searchable.

notes

Anything else. Searchable.

resuspension_volume

Volume of inclusion body resuspension in mL. Searchable.

parent_biomass: BiomassPellet = <LG Collection Item : >

BiomassPellet from which this item was derived. Searchable.

parent_strain = <Strain : >

Strain from which this item was derived. Searchable.

source

URL of the experiment where this was created. Not searchable

class LabGuruAPI._collections.Weighted[source]

An abstract base class that provides the mol_weight function.

abstract mol_weight() float[source]

The molecular mass of the item

class LabGuruAPI._collections.Compound(**kwargs)[source]
xlsx_collection = 'Compound'

The Dataset header/Plate upload name for the object class

molar_mass

Molar mass of the compound in g/mol. Searchable.

cas

The CAS ID of the compound. Searchable.

formula

The atomic formula of the compound. Searchable.

density

The density of the compound in g/mL. Searchable.

melting_point

The melting point of the compound in °C. Searchable.

boiling_point

The boiling point of the compound in °C. Searchable.

mol_weight() float[source]

The molecular mass of the item

class LabGuruAPI._collections.Consumable(**kwargs)[source]
xlsx_collection = 'Consumable'

The Dataset header/Plate upload name for the object class

classmethod from_api(session: ~LabGuruAPI._base.Session = <LabGuruAPI._base.Session object>, item_id: int | None = None, name: str | None = None, uuid: str | None = None, api_url: str | None = None, auto_name: str | None = None, include_custom=False) LGI | None[source]

Low-level function. Please use LabGuruItem.from_LG instead.

class LabGuruAPI._collections.SequenceKindInt(*args, **kwargs)[source]
class LabGuruAPI._collections.OldSequencedCollection(**kwargs)[source]
classmethod parse_api_data(json_data: Dict[str, Any], session: Session, include_custom=False) LGI[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

mol_weight() float[source]

The molecular mass of the item

update_api(session: Session, **kwargs) SCI[source]

Low-level function, please do not use. LabGuruItem.lg_sync is likely the method you want.

class LabGuruAPI._collections.Sequence(**kwargs)[source]
accession

The NCBI accession number of the sequence. Searchable.

organism

The organism from which the sequence was derived. Searchable.

to_dict(**kwargs) Dict[str, Any][source]

Generates a mapping of LG property fields to values for the object. Generally used for add/update calls.

Parameters:
  • include_other_properties – adds fields contained in other_properties to the dictionary.

  • include_links – will include the links and tags fields in the output dictionary

  • include_id – will include the item’s ID it the output dictionary

Returns:

a dictionary mapping of LG property fields to values

property kind: str

The type of the sequence. Searchable.

property sequence: SeqRecord | Dseqrecord

The nucleotide/amino acid sequence of the item. Searchable.

classmethod new_from_seq_record(seq_record: SeqRecord | Dseqrecord, seq_type: int, source: MSCI) Sequence[source]

Create a new sequence from a SeqRecord object

Parameters:
  • seq_record – the sequence to base this object off of

  • seq_type – the LG sequence type. See SequenceKindInt.

  • source – the MultiSequencedCollection item to associat this sequence with

Returns:

the new sequence

has_same_sequence_as(other: Sequence | SeqRecord | Seq | str, force_circular=False) bool[source]

Checks to see if two sequences are the same. Accounts for circular permutations and capitalization

seq_to_json() str[source]

Low-level method. Do not use.

static json_to_seq(json_dict: Dict[str, Any]) SeqRecord[source]

Low-level method. Do not use.

class LabGuruAPI._collections.DNASequence(**kwargs)[source]
static json_to_seq(json_dict: Dict[str, Any]) Dseqrecord[source]

Low-level method. Do not use.

class LabGuruAPI._collections.LGSeqList(seq_class: Type[Sequence] | None = None)[source]
base_type

alias of DNASequence

class LabGuruAPI._collections.MultiSequencedCollection(**kwargs)[source]
sequences

A list of Sequence objects associated with the item

get_attached_sequence(delete=False) SeqRecord | None[source]

Low-level function. Do not use.

property sequence: Dseqrecord | None

The first nucleotide/amino acid sequence associated with the object. Searchable.

mol_weight() float[source]

The molecular mass of the item

update_api(session: Session, retries=0) MSCI[source]

Low-level function, please do not use. LabGuruItem.lg_sync is likely the method you want.

async aio_rename(new_name: str) MSCI[source]

Updates the names and associated stocks of an LG collection item.

Parameters:

new_name (str) – The new name to assign to the current instance of Collections.

Returns:

The updated instance of Collections with the new name assigned.

Return type:

CI

class LabGuruAPI._collections.Plasmid(**kwargs)[source]
class_name = 'Biocollections::Plasmid'

The programmatic class name for the LG API

class_display_name = 'Plasmid'

The human-readable class name for the LG API

xlsx_collection = 'Plasmid'

The Dataset header/Plate upload name for the object class

clone_no

An ID associated with the plasmid during cloning. Searchable.

notes

Anything else. Searchable.

insert

The product of interest on the plasmid. Searchable.

promoter

The promoter used to express the insert. Searchable.

affinity_tag

Affinity tags included on the insert. Comma-separated. Searchable.

made_by

Initials of the individual who cloned the plasmid. Searchable.

temp_sensitive

Yes/No for if the plasmid only propagates at certain temperatures. Searchable.

genotype

Genotype of the plasmid. Searchable.

barcode

Barcode of the plasmid. Searchable.

u_count

Number of UAG codons in the target protein. Searchable.

parent_genetic_part = None

If this is a L0 plasmid, the genetic part it contains. Searchable.

diversity

String diversity field. Intended for plasmids associated with libraries and selections.

property origin: str

The plasmid’s origin of replication. Searchable.

property resistance: str

The plasmid’s selectable marker. Searchable.

calculated_genotype() str[source]

The genotype of the plasmid formatted for inclusion in strain genotypes

imply_mut_count(new_aa: str) int[source]

Calculates the number of mutations implied by a given new amino acid sequence.

This function uses regex to match mutation patterns in the insert string, based on the provided new_aa amino acid parameter. The pattern identifies amino acid mutations denoted by a specific structure combining letters, digits, and the provided new_aa. The function then returns the count of such matches.

Parameters:

new_aa (str) – The new amino acid for which mutation matches are to be searched within the insert string.

Returns:

The number of matches corresponding to the mutation pattern in the insert

string.

Return type:

int

guess_genotype(inplace=False) str[source]

Trys to determine the plasmid’s genotype given the origin, promoter, and insert fields.

If there are multiple inserts or promoters (defined by separating the fields by “, “), it will match them 1:1 in separate cistrons. If there are more promoters than inserts, the algorithm will assume that the last insert has multiple promoters. If there are more inserts than promoters, the algorithm will assume that the last promoter drives multiple ORFs (aka. an operon).

Genotype Examples

origin

promoter

insert

->

guessed genotype

o1

p1

i1

o1-(p1:i1)

o1

p1, p2

i1, i1

o1-(p1:i1)-(p2:i2)

o1

p1, p2

i1, i1, i3

o1-(p1:i1)-(p2:i2:i3)

o1

p1, p2, p3

i1, i1

o1-(p1:i1)-(p2-p3:i2)

Parameters:

inplace – If True, the plasmid’s genotype field will be set to the guessed value. Default: False

Returns:

The best guess at the genotype given the information on-hand

async aio_rename(new_name: str) Plasmid[source]

Updates the names and associated stocks of an LG collection item.

Parameters:

new_name (str) – The new name to assign to the current instance of Collections.

Returns:

The updated instance of Collections with the new name assigned.

Return type:

CI

class LabGuruAPI._collections.Oligo(**kwargs)[source]
xlsx_collection = 'Primer'

The Dataset header/Plate upload name for the object class

static get_idt_order_data(order_id: int) DataFrame[source]

This method retrieves IDT (Integrated DNA Technologies) order data for a given order ID. It returns the order data as a pandas DataFrame.

Parameters:

order_id (int) – The ID of the order for which the data is to be retrieved.

Returns:

The IDT order data as a pandas DataFrame.

Return type:

pd.DataFrame

class LabGuruAPI._collections.SyntheticGene(**kwargs)[source]
xlsx_collection = 'Synthesized dsDNA'

The Dataset header/Plate upload name for the object class

class LabGuruAPI._collections.Amplicon(**kwargs)[source]
xlsx_collection = 'PCR Products'

The Dataset header/Plate upload name for the object class

fwd_primer

The forward primer used in the PCR reaction. Searchable.

rev_primer

The reverse primer used in the PCR reaction. Searchable.

pcr_conditions

A brief description of the PCR cycle. Searchable.

usage_notes

Intended use of the amplicon. Searchable.

made_by

Initials of the individual who ran the PCR. Searchable.

parent_plasmid = <Plasmid : >

The plasmid used as a PCR template. Searchable.

parent_strain = <Strain : >

The strain used as the PCR template. Searchable.

parent_synthetic_gene = <LG Collection Item : >

The synthetic DNA used as the PCR template. Searchable.

parent_amplicon = None

The amplicon used as the PCR template. Searchable.

classmethod make_new(overwrite=False, **properties) LGI[source]

Creates a new item without adding it to the database :param overwrite: if true, will get an object by the same name if it exists and overwrite that object :param properties: The initial properties of the object :return: A new instance of the class

async classmethod aio_search_api(session: Session, query_data: Dict[str, Any], cur_page=1) List[LGI][source]

Deprecated since version Please: use LabGuruItem.async_find_all or LabGuruItem.async_find_one

static new_from_template_and_primers(name: str, template: MSCI, oligo1: Oligo, oligo2: Oligo, **props) Amplicon[source]

Simulates a PCR reaction and creates a new Amplicon object from the sequence.

Parameters:
  • name – the name of the resulting amplicon

  • template – the object representing the PCR template. this must have a sequence to be successful

  • oligo1 – one of the two PCR oligos, generally the sense (forward) oligo

  • oligo2 – one of the two PCR oligos, generally the antisense (reverse) oligo

  • **props – other amplicon properties that can be set in the initial object creation

Returns:

The amplicon generated by the template and oligos

Raises:

ValueError – The PCR could not be simulated

class LabGuruAPI._collections.GeneticPart(**kwargs)[source]
xlsx_collection = 'Genetic Parts'

The Dataset header/Plate upload name for the object class

part_type

The type of the genetic part. Searchable.

strength

If known, the strength magnitude of the part. Searchable.

strength_units

If known, the units of the part strength. Searchable.

genotype

The part’s contribution to a plasmid genotype. Searchable.

class LabGuruAPI._collections.RodentStrain(**kwargs)[source]
xlsx_collection = 'Rodent strains'

The Dataset header/Plate upload name for the object class

species

The species of the rodent strain. Searchable.

genotype

The genotype of the rodent strain. Searchable.

phenotype

The phenotype of the rodent strain. Searchable.

transgene

The transgene of the rodent strain. Searchable.

source

The source of the rodent strain. Searchable.

alternative_name

The alternative name of the rodent strain. Searchable.

classmethod from_name(name: str) LGI[source]

Retrieves a LabGuruItem from the API via its name.

Examples

Get plasmid pGRO-S0081:

p = Plasmid.from_name('pGRO-S0081')
Parameters:

name – The exact name of the desired item

Returns:

The requested LabGuruItem

class LabGuruAPI._collections.LGNamedEnum(*args, **kwargs)[source]
class LabGuruAPI._collections.Rodent(**kwargs)[source]
class LabGuruAPI._collections.Tissue(**kwargs)[source]