Translation Scheme Utilities vox.compilers.Utils

This interface describes the utility functions returned by the vox.compilers.utils factory function. To access these utility functions within a translation scheme, it's recommended that you call vox.compiler#utils with the ndarray of voxels, the lattice, and any options. You'll then get an instance of this class which you can use:

utils = vox.compiler.utils voxels, lattice, { dlen: 8 }
{ has, tiles } = utils

iterator = (i,j,k, strands) ->
    if has i, j, k then tiles.oneway i, j, k, 'X', +1
    # etc.

Properties

Access properties with .nameand .name = value.

Methods

Call methods with.name(),.name(arguments)or just .name arguments .

  • boundaryStrands (strands, [grid]) -> undefined#

    Merges boundary strands together

    Parameters
    strands
    vox.dna.Strand[]
    grid
    ndarray (Optional; defaults to null)
  • buildU (v1, v2, v3, v4, dir) -> Array#

    This function examines the pattern of four adjacent voxels and
    generates a U-shaped strand with some combination of domains and poly-T protectors, according to the logic of Fig. S32.

    This function can be used for one-way or symmetric (alternating) crossover tiles; the dir parameter controls where the crossover goes: (^ = 3' end)

            ^          __
     v2 /  / v4   v1 /  / v3
    v1 /__/ v3   v2 /  / v4
        +1          -1 v
    

    The domains will always be ordered, 5' -> 3': v2, v1, v3, v4

    Parameters
    v1
    Array

    Position of voxel v1

    v2
    Array

    Position of voxel v2

    v3
    Array

    Position of voxel v3

    v4
    Array

    Position of voxel v4

    dir
    1/-1

    Whether the crossover should be on the +z or -z side

    Return
    return
    Array

    Strand object

  • buildUHalf (v1, v2, dir) -> Array#

    This function examines the pattern of two adjacent voxels and
    generates a U-shaped strand with some combination of domains and poly-T protectors, according to the logic of Fig. S32.

    This function can be used for one-way or symmetric (alternating) crossover tiles; the dir parameter controls where the crossover goes: (^ = 3' end)

           ^         __
    v1 /__/ v2   v1 /  / v2
        +1          -1 v
    

    The domains will always be ordered, 5' -> 3': v1, v2

    Parameters
    v1
    Array

    Position of voxel v1

    v2
    Array

    Position of voxel v2

    dir
    1/-1

    Whether the crossover should be on the +z or -z side

    Return
    return
    Array

    Strand object

  • buildZ (v1, v2, v3, v4, dir) -> Array#

    This function examines the pattern of four adjacent voxels and
    generates a Z-shaped strand with some combination of domains and poly-T protectors, following similar logic to Fig. S32.

    The dir parameter controls overall orientation of the strand with respect to the Z-axis:

    -------------------------> +z
    
         v3 v4    v4 v3
         /====>   <====\
    ====/               \====
    v2 v1                v1 v2
    

    You must still pass v1, v2, v3, and v4 in the correct order. The domains will always be ordered, 5' -> 3': v2, v1, v3, v4

    Parameters
    v1
    Array

    Position of voxel v1

    v2
    Array

    Position of voxel v2

    v3
    Array

    Position of voxel v3

    v4
    Array

    Position of voxel v4

    dir
    1/-1

    Whether the crossover should be on the +z or -z side

    Return
    return
    Array

    Strand object

  • dom (pos, dir, dlen) -> Object[]#

    Returns a list of domain bases within the same voxel

    Parameters
    pos
    Number[]

    Position [a, b, c]

    dir
    Number

    Direction: +1 is 5' -> 3', -1 is 3' to 5'

    dlen
    Number

    Number of bases to create

    Return
    return
    Object[]

    bases

  • grid (strands) -> ndarray#

    Generates a 4D ndarray that caches the strand(s) at each position within the lattice. Used for speeding up various post- processing functions.

    Parameters
    strands
    vox.dna.Strand[]
    Return
    return
    ndarray
  • has (pos) -> Boolean#

    Returns true if pos is on the lattice and a voxel exists there

    Parameters
    pos
    Number[]

    Postion [a, b, c]

    Return
    return
    Boolean
  • ligate (strand1, strand2, strands, [grid]) -> vox.dna.Strand#

    Ligates strand1 to strand2, updating the strands array and grid cache

    Parameters
    strand1
    vox.dna.Strand
    strand2
    vox.dna.Strand
    strands
    Array
    grid
    ndarray (Optional; defaults to null)
    Return
    return
    vox.dna.Strand

    Merged strand

  • makeStrand (domains, options) -> vox.dna.Strand#

    makes a strand from a list of domains

    Parameters
    domains
    Array[]

    List of lists of bases

    options
    Object

    Hash of options to apply to the strand

    Return
    return
    vox.dna.Strand

    strand

  • neighbor3p (strand, [grid]) -> vox.dna.Strand/null#

    Determines if there is a strand whose 5' end is adjacent to strand's 3' end, and if so, returns it.

    Parameters
    strand
    vox.dna.Strand

    Strand to search for neighbor

    grid
    ndarray

    Grid of strands generated by post#grid

    (Optional; defaults to null)
    Return
    return
    vox.dna.Strand/null

    5' neighbor strand

  • neighbor5p (strand, [grid]) -> vox.dna.Strand/null#

    Determines if there is a strand whose 3' end is adjacent to strand's 5' end, and if so, returns it.

    Parameters
    strand
    vox.dna.Strand

    Strand to search for neighbor

    grid
    ndarray

    Grid of strands generated by post#grid

    (Optional; defaults to null)
    Return
    return
    vox.dna.Strand/null

    5' neighbor strand

  • polyT (pos, dir, dlen) -> Object[]#

    Returns a list of poly-T bases within the same voxel

    Parameters
    pos
    Number[]

    Position [a, b, c]

    dir
    Number

    Direction: +1 is 5' -> 3', -1 is 3' to 5'

    dlen
    Number

    Number of bases to create

    Return
    return
    Object[]

    bases

  • res (i, j, k) -> Array[]#

    Resolves a position according to the crystal map

    Parameters
    i
    Number
    j
    Number
    k
    Number
    Return
    return
    Array[]

    [i', j', k']

  • update_grid (grid, strand, base_index) -> undefined#

    Updates a grid with a given strand and base index

    Parameters
    grid
    ndarray
    strand
    vox.dna.Strand
    base_index
    Number

    Index of the base within the strand routing

  • ushape (i, j, k, plane, align, zAlign) -> vox.dna.Strand#

    Generates a U-shaped tile at the position i,j,k in the lattice. Note that i,j,k refers to the the v1 position, as in:

      v1  v2
    /========  5'
    \========> 3'
      v3  v4
    

    Here are examples that demonstrate the meaning of the plane, align, and zAlign arguments:

                                  ^            
                    ^            /             
        y        / /            / /            
        |_x   * /_/             |/ *           
      z/    'X', +1, +1      'Y', +1, +1       
    
    
                  ^              / ^           
        y        / /          * / /            
        |_x     /_/ *           |/             
      z/    'X', -1, +1      'Y', -1, +1       
    
                  __            * /|           
        y      * / /             / /           
        |_x     / /               /            
      z/          v              v             
            'X', +1, -1      'Y', +1, -1       
    
                  __              /|           
        y        / / *           / / *         
        |_x     / /             v /            
      z/        v                                
            'X', - 1, -1     'Y', -1, -1       
    
    * = [i, j, k]   ^ / v = 3' end
    
    Parameters
    i
    Number
    j
    Number
    k
    Number
    plane
    "X"/"Y"

    Plane of the strand ("X" for XZ or "Y" for YZ)

    align
    1/-1

    Direction of the crossover with respect to the plane axis

    zAlign
    1/-1

    Position of the crossover with respect to the Z axis

    Return
  • zshape (i, j, k, plane, align, zAlign) -> vox.dna.Strand#

    Generates a Z-shaped tile tile at the position i,j,k in the lattice. Note that i,j,k refers to the the v1 position, as in:

               v3  v4
             /=======>
    ========/
     v2  v1
    
    Parameters
    i
    Number
    j
    Number
    k
    Number
    plane
    "X"/"Y"

    Plane of the strand ("X" for XZ or "Y" for YZ)

    align
    1/-1

    Direction of the crossover with respect to the plane axis

    zAlign
    1/-1

    Position of the crossover with respect to the Z axis

    Return