Skip to content

6. Main Functions

Taisiia Sherstiukova edited this page Apr 16, 2025 · 1 revision

The following section has the information on the main encoding functions contained within library2.py file.

  1. proteinSequence

Processes and adds protein sequence information to a ComponentDefinition object

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj (ComponentDefinition): The SBOL object to which the sequence is linked
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents.

Process:

  • iterates through the columns in ‘rowobj.col_cell_dict’
  • if the value is a URL, it is appended to the ‘sequence’ attribute of the SBOL object
  • if the value is a string of valid amino acid characters, it is cleaned (whitespace and * removed) and added as an SBOL Sequence object with appropriate encoding
  • adds the Sequence object to the SBOL document and links it to the SBOL ComponentDefinition
  1. encodesFor

Generates an SBOL ModuleDefinition for a DNA sequence that encodes a protein.

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj_uri (str): URI of the DNA sequence
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents.
      • “Encodes for" column in col_cell_dict, specifying the protein URI this DNA sequence encodes for

Process:

  • extracts DNA component URI and protein component URI
  • creates an SBOL ModuleDefinition with two functional components: DNA and protein
  • adds an interaction of type 'genetic production' where the DNA acts as a template and the protein is the product
  • ModuleDefinition and all associated entities (functional components, interactions, participations) are added to the SBOL document.
  1. repressor

Generates an SBOL ModuleDefinition for a DNA sequence and its repressor protein(s).

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj_uri (str): URI of the DNA sequence
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents

Process:

  • extracts DNA component URI and protein component URI
  • iterates through the list of protein URIs from the appropriate column (which represents repressors)
  • adds an interaction of type 'inhibition' where the DNA is inhibited by the repressor protein
  • ModuleDefinition and all associated entities (functional components, interactions, participations) are added to the SBOL document
  1. activator

Generates an SBOL ModuleDefinition for a DNA sequence and its activator protein(s).

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj_uri (str): URI of the DNA sequence
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents

Process:

  • extracts DNA component URI and protein component URI
  • iterates through the list of protein URIs from the appropriate column (which represents activators)
  • adds an interaction of type “stimulation” where the DNA is stimulated by the activator protein
  • ModuleDefinition and all associated entities (functional components, interactions, participations) are added to the SBOL document
  1. complexComponent

Generates an SBOL ModuleDefinition for the formation of a complex involving a protein and/or another molecule

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj_uri (str): URI of the DNA sequence
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents

Process:

  • extracts DNA component URI from ‘rowobj.obj_uri’
  • iterates through the columns to identify the protein and molecule URIs
  • creates an SBOL ModuleDefinition with functional components for the product, protein, and molecule
  • adds an interaction of type 'non-covalent binding' where the protein and molecule react to form the product
  • ModuleDefinition and all associated entities (functional components, interactions, participations) are added to the SBOL document
  1. displayId

Online mode:

  • if master collection is provided, checks if part name exists within the master collection
  • if master collection isn’t provided, but the private collections is provide, checks if part name exists in the private collection
  • if both master collection and private collection aren’t provided, checks if part name exists the domain

Offline mode:

  • this function is skipped

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj_uri (str): URI of the part name
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents

Process:

  • extracts the information from the welcome page about the domain, master collection, and private collection if present
  • depending on the entry parameters (see online mode vs offline mode), connects to the corresponding URL using PartShop and checks the presence of the part name
  1. funcComp

Creates a ModuleDefinition with a FunctionalComponent(s) that links to a ComponentDefinition

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj_uri (str): A URI representing an object (used to get a module name)
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents

Process:

  • extracts ModuleDefinition name from ‘obj_uri’
  • if it doesn’t already exist, it creates a new ModuleDefinition
  • iterates through the columns to identify the FunctionalComponent URI(s)
  • creates an SBOL ModuleDefinition with functional component(s)
  • ModuleDefinition is added to the document
  1. module

Creates a ModuleDefinition with a Module(s) that links to another ModuleDefinition

  • Args:
    • rowobj:
      • an object that holds a row of data in a spreadsheet
      • should include:
        • obj_uri (str): A URI representing an object (used to get a module name)
        • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents

Process:

  • extracts ModuleDefinition name from ‘obj_uri’
  • if it doesn’t already exist, it creates a new ModuleDefinition
  • iterates through the columns to identify the Module URI(s)
  • creates an SBOL ModuleDefinition with the modulet(s)
  • ModuleDefinition is added to the document
  1. biochemical reaction

Creates a ModuleDefinition for a biochemical reaction

Args:

  • rowobj:
    • an object that holds a row of data in a spreadsheet
    • should include:
      • obj_uri (str): URI representing the chemical product (used to define the module name)
      • col_cell_dict (dict): Dictionary where keys are column names and values are cell contents

Process:

  • Extracts the chemical name from obj_uri to generate the ModuleDefinition name
  • If the ModuleDefinition does not already exist, it creates a new one
  • Iterates through the columns to identify enzyme and substrate names and URIs
  • Validates provided URIs, if any
  • Creates FunctionalComponent(s) for enzyme, substrate, and product as needed
  • If only enzyme or substrate is provided, creates and saves the corresponding FunctionalComponent only
  • If both enzyme and substrate are provided:
    • Creates a biochemical reaction Interaction
    • Adds Participation objects assigning proper SBO roles:
    • Substrate (reactant)
    • Enzyme (modifier)
    • Product (product)
  • Adds the Interaction to the ModuleDefinition
  • Adds the ModuleDefinition to the document
Clone this wiki locally