scriptutils.helpers

Module Contents

Functions

has_SO_uri(uri: str) → bool

Test if a given URI is in the ontology (effectively an exception-checking wrapper around get_term_by_uri)

remove_duplicate_prefix(name: str) → str

Remove extra prefixes common in insert names

sanitize_identifiers_for_synthesis(components: collections.Iterable[sbol3.Component], max_len: int = 32) → dict[sbol3.Component, str]

Generate a dictionary of sanitized names for elements in a synthesis order that are

truncate_by_underscores(name: str, max_len: int) → str

Shorten a name by lopping off front chunks, breaking it at underscores if possible

vector_to_insert(component: sbol3.Component) → sbol3.Component

If the component is a vector, peel it open to find the sub-component that is not the vector portion

has_SO_uri(uri: str) bool

Test if a given URI is in the ontology (effectively an exception-checking wrapper around get_term_by_uri)

Parameters
  • ontology – Ontology to check for term containment

  • str – URI to look up

Returns

true if this is a URI in the

remove_duplicate_prefix(name: str) str

Remove extra prefixes common in insert names TODO: remove on resolution of https://github.com/iGEM-Engineering/iGEM-distribution/issues/161 :param name: name to sanitize :return sanitized name

sanitize_identifiers_for_synthesis(components: collections.Iterable[sbol3.Component], max_len: int = 32) dict[sbol3.Component, str]

Generate a dictionary of sanitized names for elements in a synthesis order that are acceptable for a synthesis provides and contain no duplicates.

Parameters
  • components – Collection of components to generate sanitized names for

  • max_len – maximum length of a sanitized name

Returns

dictionary mapping each insert to its sanitized name

truncate_by_underscores(name: str, max_len: int) str

Shorten a name by lopping off front chunks, breaking it at underscores if possible

Parameters
  • name – name to truncate

  • max_len – cutoff size

Returns

truncated name

vector_to_insert(component: sbol3.Component) sbol3.Component

If the component is a vector, peel it open to find the sub-component that is not the vector portion If the component is not a vector, return it directly Throws a ValueError if the component is a vector but does not have precisely one insert

Parameters

component – SBOL3 component to extract from

Returns

component if not vector; otherwise the vector