### Inline modification examples Source: https://scadnano-python-package.readthedocs.io Examples of creating modification objects for specific sequence extensions. ```python t6_5p = Modification5Prime(display_text='6T', vendor_code='TTTTTT') ``` ```python t6_3p = Modification3Prime(display_text='6T', vendor_code='TTTTTT') # ERROR ``` -------------------------------- ### StrandBuilder Example Source: https://scadnano-python-package.readthedocs.io Illustrates building a Strand using chained methods starting from Design.draw_strand(). StrandBuilder is an intermediate object and should not be instantiated directly. ```python design.draw_strand(0, 0).to(10).cross(1).to(5).with_modification_5p(mod.biotin_5p).as_scaffold() ``` -------------------------------- ### Example: Creating a Hairpin Strand Source: https://scadnano-python-package.readthedocs.io Demonstrates how to create a Strand representing a hairpin using Domain and Loopout objects. ```APIDOC ## Example: Creating a Hairpin Strand ### Description This example shows how to create a `Strand` that represents a hairpin with a stem length of 10 and a loop length of 5. ### Code ```python import scadnano as sc domain_f = sc.Domain(helix=0, forward=True, start=0, end=10) loop = sc.Loopout(length=5) domain_r = sc.Domain(helix=0, forward=False, start=0, end=10) hairpin = sc.Strand([domain_f, loop, domain_r]) ``` ``` -------------------------------- ### Get DNA Sequence Start Index Source: https://scadnano-python-package.readthedocs.io The `dna_index_start_domain()` method returns the starting index of a given domain within the strand's DNA sequence. This is useful for sequence manipulation or analysis. ```python 012 3 45 678 9 AAA-C-GG-TTT-ACGT ``` -------------------------------- ### Example: Creating a Strand with Chained Methods Source: https://scadnano-python-package.readthedocs.io Demonstrates creating a Strand using chained method calls on a Design object. ```APIDOC ## Example: Creating a Strand with Chained Methods ### Description This example shows how to create a `Strand` using chained method calls, including a loopout, on a `Design` object. ### Code ```python import scadnano as sc design = sc.Design(helices=[sc.Helix(max_offset=10)]) design.draw_strand(0,0).move(10).loopout(0,5).move(-10) ``` ``` -------------------------------- ### Example Plate Map Table Source: https://scadnano-python-package.readthedocs.io An example of a plate map generated in Markdown table format, showing monomer synthesis layout with associated domains and modifications. ```markdown plate "5 monomer synthesis" | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |-----|------|--------|--------|------|----------|-----|-----|-----|-----|------|------|------| | A | mon0 | mon0_F | | adp0 | | | | | | | | | | B | mon1 | mon1_Q | mon1_F | adp1 | adp_sst1 | | | | | | | | | C | mon2 | mon2_F | mon2_Q | adp2 | adp_sst2 | | | | | | | | | D | mon3 | mon3_Q | mon3_F | adp3 | adp_sst3 | | | | | | | | | E | mon4 | | mon4_Q | adp4 | adp_sst4 | | | | | | | | | F | | | | adp5 | | | | | | | | | | G | | | | | | | | | | | | | ``` -------------------------------- ### Example Usage of origami_rectangle.create Source: https://scadnano-python-package.readthedocs.io Example call to create a DNA origami rectangle with 8 helices and 10 columns, using the staggered nick pattern. The scaffold strand resulting from this call is visualized. ```python create(num_helices=8, num_cols=10, nick_pattern=origami_rectangle.staggered) ``` -------------------------------- ### Domain Start/End Setting Source: https://scadnano-python-package.readthedocs.io Methods to set the start and end positions of a domain. ```APIDOC ## Set Domain End ### Description Sets the `end` attribute of a `Domain` to the specified value. ### Parameters * **domain** (Domain) - Required - The domain to modify. * **end** (int) - Required - The new end position for the domain. ### Returns None ### Return type None ``` ```APIDOC ## Set Domain Start ### Description Sets the `start` attribute of a `Domain` to the specified value. ### Parameters * **domain** (Domain) - Required - The domain to modify. * **start** (int) - Required - The new start position for the domain. ### Returns None ### Return type None ``` -------------------------------- ### Strand.dna_index_start_domain Source: https://scadnano-python-package.readthedocs.io Finds the starting index of a domain within the strand's DNA sequence. ```APIDOC ## Strand.dna_index_start_domain ### Description Given a `Domain` or `Loopout` object, this method returns the starting index of that domain within the strand's overall DNA sequence string. For example, if a strand's sequence is 'AAA-C-GG-TTT-ACGT' and it has five domains, the indices returned for these domains would be 0, 3, 4, 6, and 9, respectively. ### Method `Strand.dna_index_start_domain(domain)` ### Parameters - **domain** (Domain | Loopout) - The domain or loopout for which to find the starting DNA index. ### Returns An integer representing the index within the DNA sequence string where the specified domain's sequence begins. ### Example ```python # Assuming 'my_strand' is a Strand object and 'target_domain' is one of its domains start_index = my_strand.dna_index_start_domain(target_domain) ``` ``` -------------------------------- ### Plate Map with well_marker set to '*' Source: https://scadnano-python-package.readthedocs.io Example output when well_marker is set to '*' to indicate occupied wells. ```markdown | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|------|------| | A | * | * | | * | | | | | | | | | | B | * | * | * | * | * | | | | | | | | | C | * | * | * | * | * | | | | | | | | | D | * | * | * | * | * | | | | | | | | | E | * | | * | * | * | | | | | | | | | F | | | | * | | | | | | | | | | G | | | | | | | | | | | | | | H | | | | | | | | | | | | | ``` -------------------------------- ### GET /domain_at Source: https://scadnano-python-package.readthedocs.io Returns the domain that overlaps a specific offset on a helix. ```APIDOC ## GET /domain_at ### Description Return Domain that overlaps offset on helix with idx helix and has Domain.forward = True, or None if there is no such Domain. ### Parameters #### Query Parameters - **helix** (int) - Required - **offset** (int) - Required - **forward** (bool) - Required ``` -------------------------------- ### Get 5' Offset Source: https://scadnano-python-package.readthedocs.io Returns the inclusive 5' offset of the entire strand. ```python strand.offset_5p() ``` -------------------------------- ### Markdown Plate Map Output Source: https://scadnano-python-package.readthedocs.io Example of the default Markdown table output generated by to_table(). ```markdown plate "5 monomer synthesis" | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |-----|------|--------|--------|------|----------|-----|-----|-----|-----|------|------|------| | A | mon0 | mon0_F | | adp0 | | | | | | | | | | B | mon1 | mon1_Q | mon1_F | adp1 | adp_sst1 | | | | | | | | | C | mon2 | mon2_F | mon2_Q | adp2 | adp_sst2 | | | | | | | | | D | mon3 | mon3_Q | mon3_F | adp3 | adp_sst3 | | | | | | | | | E | mon4 | | mon4_Q | adp4 | adp_sst4 | | | | | | | | | F | | | | adp5 | | | | | | | | | | G | | | | | | | | | | | | | | H | | | | | | | | | | | | | ``` -------------------------------- ### Create Strand with Multiple Domains Source: https://scadnano-python-package.readthedocs.io Assign StrandBuilder to a variable for complex strand creation, especially when using loops. This example demonstrates creating a scaffold strand with several domains and a 5' modification. ```python sb = design.draw_strand(0, 0) sb.to(10) sb.cross(1) sb.to(5) sb.with_modification_5p(mod.biotin_5p) sb.as_scaffold() ``` -------------------------------- ### Create a Hairpin Strand Source: https://scadnano-python-package.readthedocs.io Demonstrates creating a hairpin structure using Domain and Loopout objects. Ensure scadnano is imported as sc. ```python import scadnano as sc domain_f = sc.Domain(helix=0, forward=True, start=0, end=10) loop = sc.Loopout(length=5) domain_r = sc.Domain(helix=0, forward=False, start=0, end=10) hairpin = sc.Strand([domain_f, loop, domain_r]) ``` -------------------------------- ### Create Strand with Extensions Source: https://scadnano-python-package.readthedocs.io Use this to create a `Strand` with `Extension`s on both the 5' and 3' ends, flanking a central `Domain`. Ensure `scadnano` is imported. ```python import scadnano as sc domain = sc.Domain(helix=0, forward=True, start=0, end=10) left_toehold = sc.Extension(num_bases=3) right_toehold = sc.Extension(num_bases=2) strand = sc.Strand([left_toehold, domain, right_toehold]) ``` -------------------------------- ### Create Strand with Chained Methods Source: https://scadnano-python-package.readthedocs.io Illustrates creating a strand using chained method calls on a Design object. Requires scadnano imported as sc. ```python import scadnano as sc design = sc.Design(helices=[sc.Helix(max_offset=10)]) design.draw_strand(0,0).move(10).loopout(0,5).move(-10) ``` -------------------------------- ### Draw a strand using chained methods Source: https://scadnano-python-package.readthedocs.io Demonstrates building a strand domain by domain from 5' to 3' using chained method calls. ```python design.draw_strand(0, 7).to(10).cross(1).to(5).cross(2).to(15) ``` -------------------------------- ### Strands by Helix Source: https://scadnano-python-package.readthedocs.io Retrieves lists of strands that start or end on a specific helix. ```APIDOC ## Strands Ending on Helix ### Description Returns a list of `Strand` objects whose 3' end is located on the specified helix. ### Parameters * **helix** (int) - Required - The index of the helix. ### Returns A list of `Strand` objects ending on the specified helix. ### Return type List[Strand] ``` ```APIDOC ## Strands Starting on Helix ### Description Returns a list of `Strand` objects whose 5' end is located on the specified helix. ### Parameters * **helix** (int) - Required - The index of the helix. ### Returns A list of `Strand` objects starting on the specified helix. ### Return type List[Strand] ``` -------------------------------- ### Loading Designs from Files Source: https://scadnano-python-package.readthedocs.io Details on how to load `Design` objects from cadnano v2 files, scadnano JSON files, and JSON strings. ```APIDOC ## Loading Designs from Files ### Description This section covers the static methods available on the `Design` class for loading DNA designs from various sources, including cadnano v2 JSON files or dictionaries, and scadnano-specific JSON files or strings. ### Methods #### `static Design.from_cadnano_v2(directory='', filename=None, json_dict=None)` Creates a `Design` from a cadnano v2 JSON file or a Python dictionary representing the JSON content. Requires exactly one of `filename` or `json_dict` to be specified. **Parameters:** * `directory` (str): Directory containing the `filename`. Ignored if `json_dict` is provided. * `filename` (str | None): Name of the cadnano v2 JSON file. * `json_dict` (dict | None): A Python dictionary representing the cadnano v2 JSON content. **Returns:** * `Design`: An equivalent `Design` object. #### `static Design.from_scadnano_file(filename)` Loads a `Design` from a specified scadnano JSON file (ending in `.sc`). **Parameters:** * `filename` (str): The path to the scadnano JSON file. **Returns:** * `Design`: The `Design` object described in the file. #### `static Design.from_scadnano_json_map(json_map)` Loads a `Design` from a Python dictionary (JSON object). **Parameters:** * `json_map` (dict): A dictionary representing the `Design` structure. **Returns:** * `Design`: The `Design` object described by the dictionary. #### `static Design.from_scadnano_json_str(json_str)` Loads a `Design` from a JSON string. **Parameters:** * `json_str` (str): A string containing the JSON description of the `Design`. **Returns:** * `Design`: The `Design` object described in the JSON string. ### Request Example ```python # Load from cadnano v2 file design1 = Design.from_cadnano_v2(filename='my_design.json') # Load from scadnano file design2 = Design.from_scadnano_file('my_scadnano_design.sc') # Load from JSON string json_data = '{"helices": [], "strands": []}' design3 = Design.from_scadnano_json_str(json_data) ``` ``` -------------------------------- ### Set Strand as Scaffold Using Method Source: https://scadnano-python-package.readthedocs.io Alternatively, create a `sc.Strand` object and then call the `.set_scaffold()` method to designate it as a scaffold. Ensure `scadnano` is imported as `sc`. ```python import scadnano as sc scaffold_domains = [ ... ] scaffold_strand = sc.Strand(domains=scaffold_domains) scaffold_strand.set_scaffold() ``` -------------------------------- ### Get 3' Offset Source: https://scadnano-python-package.readthedocs.io Returns the inclusive 3' offset of the entire strand. ```python strand.offset_3p() ``` -------------------------------- ### StrandBuilder.move() Source: https://scadnano-python-package.readthedocs.io Extends the StrandBuilder with a new Domain relative to the current offset. If two instances of move() are chained, the offsets must move in the same direction. ```APIDOC ## POST /strandbuilder/move ### Description Extends the StrandBuilder with a new Domain relative to the current offset. If two instances of move() are chained, the offsets must move in the same direction. ### Method POST ### Endpoint /strandbuilder/move ### Parameters #### Query Parameters - **delta** (int) - Required - Distance to new offset to extend to, compared to current offset. If less than current offset, the new Domain is reverse, otherwise it is forward. ### Request Example ```json { "delta": 5 } ``` ### Response #### Success Response (200) - **self** (StrandBuilder) - Returns the StrandBuilder instance. #### Response Example ```json { "self": "" } ``` ``` -------------------------------- ### Get Helix Pitch Source: https://scadnano-python-package.readthedocs.io Retrieves the pitch of a given helix, which is the same as the pitch of its associated HelixGroup. ```python pitch_of_helix(_helix_) ``` -------------------------------- ### POST /strand/as_scaffold Source: https://scadnano-python-package.readthedocs.io Marks the strand currently being built as a scaffold. ```APIDOC ## POST /strand/as_scaffold ### Description Makes the Strand being built a scaffold. ### Method POST ### Response #### Success Response (200) - **self** (StrandBuilder) - The current StrandBuilder instance. ``` -------------------------------- ### GET /base_pairs Source: https://scadnano-python-package.readthedocs.io Retrieves a mapping of helix indices to offsets where base pairs exist. ```APIDOC ## GET /base_pairs ### Description Returns a dictionary mapping each helix index to a list of offsets where base pairs are located. ### Parameters #### Query Parameters - **allow_mismatches** (bool) - Optional - If True, includes all offsets where there is both a forward and reverse domain. ``` -------------------------------- ### scadnano.write_file_same_name_as_running_python_script Source: https://scadnano-python-package.readthedocs.io Writes a text file with contents whose name is (by default) the same as the name of the currently running script, but with extension `.py` changed to extension. ```APIDOC ## scadnano.write_file_same_name_as_running_python_script ### Description Writes a text file with contents whose name is (by default) the same as the name of the currently running script, but with extension `.py` changed to extension. ### Method N/A (Function) ### Endpoint N/A (Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **contents** (str) - contents of file to write * **extension** (str) - extension to use * **directory** (str) - directory in which to write file. If not specified, the current working directory is used. (Optional, defaults to '.') * **add_extension** (bool) - whether to replace .py with extension (Optional) * **filename** (str or None) - filename to use instead of the currently running script (Optional) ### Request Example ```python scadnano.write_file_same_name_as_running_python_script("Hello, world!", ".txt", directory="/tmp") ``` ### Response #### Success Response (200) * **None**: This function does not return any value. #### Response Example ```json { "example": null } ``` ``` -------------------------------- ### Create Scaffold Strand with StrandBuilder Source: https://scadnano-python-package.readthedocs.io Use the `StrandBuilder.as_scaffold()` method after defining a strand with `design.strand()` to set it as a scaffold. This method is chained after strand definition and movement operations. ```python import scadnano as sc design = sc.Design(helices=[sc.Helix(max_offset=100) for _ in range(2)]) scaffold_strand = design.strand(0, 0).move(100).cross(1).move(-100).as_scaffold() ``` -------------------------------- ### Strand Creation and Scaffold Assignment Source: https://scadnano-python-package.readthedocs.io Demonstrates different ways to create a Strand object and designate it as a scaffold. ```APIDOC ## Strand Creation and Scaffold Assignment ### Description This section illustrates how to create a `sc.Strand` object and set it as a scaffold using various methods. ### Methods 1. **Constructor**: Initialize a `Strand` with `is_scaffold=True`. 2. **`set_scaffold()` method**: Call this method on an existing `Strand` object. 3. **`StrandBuilder.as_scaffold()`**: Use the builder pattern when creating a strand via `Design.strand()`. ### Parameters for `sc.Strand` constructor: - **domains** (List[Domain | Loopout | Extension]) - Required - The domains that make up the strand. - **circular** (bool) - Optional - If True, the strand is circular. - **color** (Color | None) - Optional - The color to display the strand. - **vendor_fields** (VendorFields | None) - Optional - Vendor-specific fields. - **is_scaffold** (bool) - Optional - If True, this strand is a scaffold. - **modification_5p** (Modification5Prime | None) - Optional - 5' modification. - **modification_3p** (Modification3Prime | None) - Optional - 3' modification. - **modifications_int** (Dict[int, ModificationInternal]) - Optional - Internal modifications. - **name** (str | None) - Optional - The name of the strand. - **label** (str | None) - Optional - A label for the strand. - **_helix_idx_domain_map** (Dict[int, List[Domain]]) - Internal mapping. - **dna_sequence** (Optional[str]) - Optional - The DNA sequence of the strand. ### Request Example (Constructor) ```python import scadnano as sc scaffold_domains = [ ... ] scaffold_strand = sc.Strand(domains=scaffold_domains, is_scaffold=True) ``` ### Request Example (`set_scaffold()`) ```python import scadnano as sc scaffold_domains = [ ... ] scaffold_strand = sc.Strand(domains=scaffold_domains) scaffold_strand.set_scaffold() ``` ### Request Example (`StrandBuilder.as_scaffold()`) ```python import scadnano as sc design = sc.Design(helices=[sc.Helix(max_offset=100) for _ in range(2)]) scaffold_strand = design.strand(0, 0).move(100).cross(1).move(-100).as_scaffold() ``` ### Notes By default, scaffold strands are assigned a color that cadnano uses for scaffolds. ``` -------------------------------- ### Get Domain Deletions Source: https://scadnano-python-package.readthedocs.io Returns a list of integer positions representing deletions within this Domain. ```python deletions _: List[int]_¶ ``` -------------------------------- ### Design Creation and Strand Manipulation Source: https://scadnano-python-package.readthedocs.io Demonstrates how to add strands with domains and loopouts to a Design object, and how StrandBuilder methods modify the Design. ```APIDOC ## Design Creation and Strand Manipulation ### Description This section illustrates the creation of `Strand` objects with multiple `Domain`s and the inclusion of `Loopout`s. It also explains how methods on the `StrandBuilder` object, such as `to()`, `cross()`, and `loopout()`, modify the `Design` by updating `Strand` objects. ### Methods #### `design.add_strand(strand)` Adds a `Strand` to the `Design`. #### `design.draw_strand(helix, offset)` Initiates the drawing of a new `Strand` on a specified `Helix` at a given `offset`. Returns a `StrandBuilder` object. #### `StrandBuilder.to(offset)` Extends the current `Strand` to a new `offset` on the same helix. Modifies the `Design`. #### `StrandBuilder.cross(helix)` Initiates a crossover to a different `Helix` at the current offset. Modifies the `Design`. #### `StrandBuilder.loopout(length)` Adds a `Loopout` of a specified `length`. Modifies the `Design`. ### Request Example ```python design.add_strand(Strand([ sc.Domain(0, True, 7, 10), sc.Domain(1, False, 5, 10), sc.Domain(2, True, 5, 15), ])) design.draw_strand(0, 7).to(10).cross(1).to(5).loopout(2, 3).to(15) ``` ### Response Example ```python # The design object is modified in place. # The second example results in: design.add_strand(Strand([ sc.Domain(0, True, 7, 10), sc.Domain(1, False, 5, 10), sc.Loopout(3), sc.Domain(2, True, 5, 15), ])) ``` ``` -------------------------------- ### Get Yaw of Helix Source: https://scadnano-python-package.readthedocs.io Retrieves the yaw value of a given helix, which is equivalent to the yaw of its HelixGroup. ```python yaw_of_helix(_helix_)[source]¶ ``` -------------------------------- ### Create Scaffold Strand in Constructor Source: https://scadnano-python-package.readthedocs.io Use the `is_scaffold=True` argument in the `sc.Strand` constructor to designate a strand as a scaffold. Ensure `scadnano` is imported as `sc`. ```python import scadnano as sc scaffold_domains = [ ... ] scaffold_strand = sc.Strand(domains=scaffold_domains, is_scaffold=True) ``` -------------------------------- ### Get Last Domain of a Strand Source: https://scadnano-python-package.readthedocs.io Retrieves the last domain on the strand. This is useful for accessing the 3' end of the strand. ```python strand.last_domain() ``` -------------------------------- ### Plate Map with identity function well_marker Source: https://scadnano-python-package.readthedocs.io Example output using a lambda function as a well_marker to display well addresses. ```markdown | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|------|------| | A | A1 | A2 | | A4 | | | | | | | | | | B | B1 | B2 | B3 | B4 | B5 | | | | | | | | | C | C1 | C2 | C3 | C4 | C5 | | | | | | | | | D | D1 | D2 | D3 | D4 | D5 | | | | | | | | | E | E1 | | E3 | E4 | E5 | | | | | | | | | F | | | | F4 | | | | | | | | | | G | | | | | | | | | | | | | | H | | | | | | | | | | | | | ``` -------------------------------- ### Get Strand Version Without Modifications Source: https://scadnano-python-package.readthedocs.io Returns a new Strand object that is identical to the current one but without any DNA modifications. ```python strand.no_modifications_version() ``` -------------------------------- ### StrandBuilder.with_domain_name() Source: https://scadnano-python-package.readthedocs.io Assigns a name to the most recently created Domain or Loopout. Should be called immediately after creating a Domain or Loopout. ```APIDOC ## POST /strandbuilder/with_domain_name ### Description Assigns a name to the most recently created Domain or Loopout. Should be called immediately after creating a Domain or Loopout. ### Method POST ### Endpoint /strandbuilder/with_domain_name ### Parameters #### Query Parameters - **name** (str) - Required - The name to assign to the Domain or Loopout. ### Request Example ```json { "name": "my_domain" } ``` ### Response #### Success Response (200) - **self** (StrandBuilder) - Returns the StrandBuilder instance. #### Response Example ```json { "self": "" } ``` ``` -------------------------------- ### Get Domain DNA Sequence Source: https://scadnano-python-package.readthedocs.io Retrieves the DNA sequence string for this Domain. Returns None if no sequence is assigned to the parent Strand. ```python dna_sequence _: str | None_ _ = None_¶ ``` -------------------------------- ### Set Domain Color Source: https://scadnano-python-package.readthedocs.io Use `with_domain_color()` to set the color of the most recently created `Domain`, `Loopout`, or `Extension`. This method is chainable. -------------------------------- ### StrandBuilder.with_domain_label() Source: https://scadnano-python-package.readthedocs.io Assigns a label to the most recently created Domain or Loopout. Should be called immediately after creating a Domain or Loopout. ```APIDOC ## POST /strandbuilder/with_domain_label ### Description Assigns a label to the most recently created Domain or Loopout. Should be called immediately after creating a Domain or Loopout. ### Method POST ### Endpoint /strandbuilder/with_domain_label ### Parameters #### Query Parameters - **label** (str) - Required - The label to assign to the Domain or Loopout. ### Request Example ```json { "label": "domain 1" } ``` ### Response #### Success Response (200) - **self** (StrandBuilder) - Returns the StrandBuilder instance. #### Response Example ```json { "self": "" } ``` ``` -------------------------------- ### Get Modifications of a Specific Type Source: https://scadnano-python-package.readthedocs.io Retrieves a set of modifications from a design, optionally filtered by type (5', 3', or internal). If no type is specified, all modifications are returned. ```python modifications(mod_type=None) ``` -------------------------------- ### StrandBuilder.with_domain_color() Source: https://scadnano-python-package.readthedocs.io Sets the color for the most recent Domain, Loopout, or Extension. ```APIDOC ## POST /strandbuilder/with_domain_color ### Description Sets the color for the most recent Domain, Loopout, or Extension. ### Method POST ### Endpoint /strandbuilder/with_domain_color ### Parameters #### Query Parameters - **color** (Color) - Required - The color to set for the Domain/Loopout/Extension. ### Request Example ```json { "color": "blue" } ``` ### Response #### Success Response (200) - **self** (StrandBuilder) - Returns the StrandBuilder instance. #### Response Example ```json { "self": "" } ``` ``` -------------------------------- ### Create Domain Object Source: https://scadnano-python-package.readthedocs.io Represents a contiguous portion of a Strand on a single Helix. Domains can store sequence, color, deletions, and insertions. Initialize with helix, direction, start, and end positions. ```python _class _scadnano.Domain(_helix_ , _forward_ , _start_ , _end_ , _deletions= _, _insertions= _, _name=None_ , _label=None_ , _dna_sequence=None_ , _color=None_)[source]¶ ``` -------------------------------- ### Get Last Bound Domain of a Strand Source: https://scadnano-python-package.readthedocs.io Retrieves the last non-Loopout domain on the strand. This is typically the same as the last domain but accounts for potential future support of initial or final Loopout domains. ```python strand.last_bound_domain() ``` -------------------------------- ### StrandBuilder.to() Source: https://scadnano-python-package.readthedocs.io Extends the StrandBuilder on the current helix to a specified offset, adding a new Domain. This is an absolute move. Chained calls require offsets to move in the same direction. ```APIDOC ## POST /strandbuilder/to ### Description Extends the StrandBuilder on the current helix to a specified offset, adding a new Domain. This is an absolute move. Chained calls require offsets to move in the same direction. ### Method POST ### Endpoint /strandbuilder/to ### Parameters #### Query Parameters - **offset** (int) - Required - New offset to extend to. If less than current offset, the new Domain is reverse, otherwise it is forward. ### Request Example ```json { "offset": 10 } ``` ### Response #### Success Response (200) - **self** (StrandBuilder) - Returns the StrandBuilder instance. #### Response Example ```json { "self": "" } ``` ``` -------------------------------- ### StrandBuilder.with_color() Source: https://scadnano-python-package.readthedocs.io Sets the color for the Strand being built. ```APIDOC ## POST /strandbuilder/with_color ### Description Sets the color for the Strand being built. ### Method POST ### Endpoint /strandbuilder/with_color ### Parameters #### Query Parameters - **color** (Color) - Required - The color to set for the Strand. ### Request Example ```json { "color": "red" } ``` ### Response #### Success Response (200) - **self** (StrandBuilder) - Returns the StrandBuilder instance. #### Response Example ```json { "self": "" } ``` ``` -------------------------------- ### Conditionally Add Modifications in a Loop Source: https://scadnano-python-package.readthedocs.io Use StrandBuilder within loops to create multiple strands with conditional modifications. This example adds a 5' biotin modification only to the first strand created in the loop. ```python for i in range(n): sb = design.draw_strand(0, 10).move(10).with_name(f'strand {i}') if i == 0: sb.with_modification_5p(mod.biotin_5p) ``` -------------------------------- ### Create Strand with Chained Extension Methods Source: https://scadnano-python-package.readthedocs.io This method allows for creating a `Strand` with `Extension`s using chained method calls on a `Design` object. It's a concise way to define strands with specific end modifications. ```python import scadnano as sc design = sc.Design(helices=[sc.Helix(max_offset=10)]) design.draw_strand(0,0).extension_5p(3).move(10).extension_3p(2) ``` -------------------------------- ### Export Design to JSON string Source: https://scadnano-python-package.readthedocs.io Returns a string representation of the Design, suitable for saving as a JSON file that scadnano can read. Control JSON indentation for readability. ```python to_json(_suppress_indent =True_) ``` -------------------------------- ### Get DNA Sequence within Range Source: https://scadnano-python-package.readthedocs.io Returns the DNA sequence of this Domain within a specified range of offsets (inclusive). Returns None if no sequence is assigned to the parent Strand. Note: This method is inclusive on both ends. ```python dna_sequence_in(_offset_left_ , _offset_right_)[source]¶ ``` -------------------------------- ### Rotate Strand Domains Backward Source: https://scadnano-python-package.readthedocs.io Rotates the domains of the strand backward, moving domains from the 5' end to the 3' end. For example, A, B, C, D, E, F rotated by 2 with forward=False becomes C, D, E, F, A, B. ```python strand.rotate_domains(_rotation_ , _forward =False) ``` -------------------------------- ### StrandBuilder.with_deletions() Source: https://scadnano-python-package.readthedocs.io Assigns deletions to the most recently created Domain. Should be called immediately after creating a Domain. ```APIDOC ## POST /strandbuilder/with_deletions ### Description Assigns deletions to the most recently created Domain. Should be called immediately after creating a Domain. ### Method POST ### Endpoint /strandbuilder/with_deletions ### Parameters #### Query Parameters - **deletions** (int | Iterable[int]) - Required - A single int or an Iterable of ints indicating the offset for the deletion(s). ### Request Example ```json { "deletions": [2, 3] } ``` ### Response #### Success Response (200) - **self** (StrandBuilder) - Returns the StrandBuilder instance. #### Response Example ```json { "self": "" } ``` ``` -------------------------------- ### Define and apply 5' modifications Source: https://scadnano-python-package.readthedocs.io Create a single Modification5Prime object and reuse it across multiple strands to ensure consistent vendor codes. ```python biotin_5p = Modification5Prime(display_text='B', vendor_code='/5Biosg/') design.draw_strand(0, 0).move(8).with_modification_5p(biotin_5p) design.draw_strand(1, 0).move(8).with_modification_5p(biotin_5p) ``` -------------------------------- ### Rotate Strand Domains Forward Source: https://scadnano-python-package.readthedocs.io Rotates the domains of the strand forward, moving domains from the 3' end to the 5' end. For example, A, B, C, D, E, F rotated by 2 becomes E, F, A, B, C, D. ```python strand.rotate_domains(_rotation_ , _forward =True_) ``` -------------------------------- ### Define and apply 3' modifications Source: https://scadnano-python-package.readthedocs.io Create a single Modification3Prime object and reuse it across multiple strands to ensure consistent vendor codes. ```python biotin_3p = Modification3Prime(display_text='B', vendor_code='/3Bio/') design.draw_strand(0, 0).move(8).with_modification_3p(biotin_3p) design.draw_strand(1, 0).move(8).with_modification_3p(biotin_3p) ``` -------------------------------- ### Loopout Class Source: https://scadnano-python-package.readthedocs.io Details about the Loopout class, its parameters, and methods. ```APIDOC ## Loopout Class ### Description A `Loopout` represents a single-stranded region bridging two `Domain`s that are connected to `Helix`s. It is illegal for two consecutive `Domain`s to both be `Loopout`s, or for a `Loopout` to occur on either end of the `Strand`. ### Parameters - **length** (int) - Required - Length (in DNA bases) of this `Loopout`. - **name** (str | None) - Optional - Optional name to give this `Loopout`. - **label** (str | None) - Optional - Label to associate with this `Loopout`. - **dna_sequence** (str | None) - Optional - DNA sequence of this `Loopout`. - **color** (Color | None) - Optional - Color to show this loopout in the main view. ### Methods - **dna_length()** - Returns the length of this `Loopout`. - **get_seq_start_idx()** - Returns the starting DNA subsequence index for the first base of this `Loopout`. - **set_label(label)** - Sets the label of this `Loopout`. - **set_name(name)** - Sets the name of this `Loopout`. - **strand()** - Returns the `Strand` that contains this `Loopout`. - **vendor_dna_sequence()** - Returns the vendor DNA sequence of this `Loopout`. ``` -------------------------------- ### Geometry Class Initialization Source: https://scadnano-python-package.readthedocs.io Initialize the `Geometry` class to control visualization parameters for a `Design`. Adjust parameters like `rise_per_base_pair` and `helix_radius` to customize the 2D representation of DNA structures. ```python sc.Geometry(_rise_per_base_pair =0.332_, _helix_radius =1.0_, _bases_per_turn =10.5_, _minor_groove_angle =150.0_, _inter_helix_gap =1.0_) ``` -------------------------------- ### Add Label to a Domain Source: https://scadnano-python-package.readthedocs.io Use `with_domain_label()` immediately after creating a domain or loopout with `to()`, `move()`, `update_to()`, or `loopout()` to assign a label. This method is chainable. ```python design.draw_strand(0, 5) .to(8).with_domain_label('domain 1') .cross(1) .to(5).with_domain_label('domain 2') .loopout(2, 4).with_domain_label('domain 3') .to(10).with_domain_label('domain 4') ``` -------------------------------- ### Export to cadnano v2 Source: https://scadnano-python-package.readthedocs.io Methods for exporting the design to cadnano v2 format as a string or a serializable dictionary. ```APIDOC ## POST /design/to_cadnano_v2 ### Description Converts the design to a string in the cadnano v2 format. ### Parameters #### Request Body - **name** (str) - Optional - Name of the design. - **whitespace** (bool) - Optional - Whether to include whitespace. Set to False for CanDo compatibility. ### Response #### Success Response (200) - **body** (str) - The cadnano v2 formatted string. ## POST /design/to_cadnano_v2_serializable ### Description Converts the design to a JSON-serializable Python dictionary representing the cadnano v2 format. ### Parameters #### Request Body - **name** (str) - Optional - Name of the design. ### Response #### Success Response (200) - **body** (dict) - A dictionary representing the cadnano v2 format. ``` -------------------------------- ### Strand Metadata and Export Methods Source: https://scadnano-python-package.readthedocs.io Methods for managing strand labels, names, scaffold status, and vendor export formatting. ```APIDOC ## set_label(label) ### Description Sets the label of the strand. ### Parameters - **label** (Any) - Required - The label to set. ## set_name(name) ### Description Sets the name of the strand. ### Parameters - **name** (str) - Required - The name to set. ## set_scaffold(is_scaf=True) ### Description Sets the strand as a scaffold and updates its color. ### Parameters - **is_scaf** (bool) - Optional - Whether the strand is a scaffold. ## vendor_dna_sequence(domain_delimiter='') ### Description Returns the DNA sequence formatted for ordering from a synthesis vendor. ### Parameters - **domain_delimiter** (str) - Optional - String to insert between DNA sequences. ### Response - **str** - The formatted DNA sequence. ``` -------------------------------- ### Insert Domain into Strand Source: https://scadnano-python-package.readthedocs.io Inserts a domain into a strand at a specified order. Uses Python list-like indexing for insertion position. Requires strand, order, and domain as arguments. ```python design.insert_domain(strand, domain, 0) ```