Skip to content

Helper Functions

Slat Design

Basic tools for designing DNA slats.

crisscross.core_functions.slat_design

generate_standard_square_slats

generate_standard_square_slats(slat_count=32)

Generates a base array for a square megastructure design

PARAMETER DESCRIPTION
slat_count

Number of handle positions in each slat

DEFAULT: 32

RETURNS DESCRIPTION

3D numpy array with x/y slat positions and a list of the unique slat IDs for each layer

read_design_from_excel

read_design_from_excel(folder, sheets)

Reads a megastructure design pre-populated in excel. 0s indicate no slats, all other numbers are slat IDs

PARAMETER DESCRIPTION
folder

Folder containing excel sheets

sheets

List of sheets containing the positions of slats (in order, starting from the bottom layer)

RETURNS DESCRIPTION

3D numpy array with x/y slat positions

attach_cargo_handles_to_core_sequences

attach_cargo_handles_to_core_sequences(
    pattern, sequence_map, target_plate, slat_type="X", handle_side=2
)

TODO: extend for any shape (currently only 2D squares) Concatenates cargo handles to provided sequences according to cargo pattern.

PARAMETER DESCRIPTION
pattern

2D array showing where each cargo handle will be attached to a slat

sequence_map

Sequence to use for each particular cargo handle in pattern

target_plate

Plate class containing all the pre-mapped sequences/wells for the selected slats

slat_type

Type of slat to attach to (X or Y)

DEFAULT: 'X'

handle_side

H2 or H5 handle position

DEFAULT: 2

RETURNS DESCRIPTION

Dataframe containing all new sequences to be ordered for cargo attachment

generate_patterned_square_cco

generate_patterned_square_cco(pattern='2_slat_jump')

Pre-generates a square megastructure with specific repeating patterns.

PARAMETER DESCRIPTION
pattern

Choose from the set of available pre-made patterns.

DEFAULT: '2_slat_jump'

RETURNS DESCRIPTION

2D array containing pattern TODO: make size of square adjustable

General Helper Functions

General utility functions.

crisscross.helper_functions

revcom

revcom(sequence)

Reverse complements a DNA sequence.

PARAMETER DESCRIPTION
sequence

DNA string, do not add any other characters (TODO: make more robust)

RETURNS DESCRIPTION

processed sequence (string)

create_dir_if_empty

create_dir_if_empty(*directories)

Creates a directory if it doesn't exist.

PARAMETER DESCRIPTION
directories

Single filepath or list of filepaths.

DEFAULT: ()

RETURNS DESCRIPTION

N/A

clear_folder_contents

clear_folder_contents(root_folder)

Deletes all files in selected folder.

PARAMETER DESCRIPTION
root_folder

Folder within which all files should be deleted.

RETURNS DESCRIPTION

N/A

zip_folder_to_disk

zip_folder_to_disk(folder_path, output_zip_path)

Zips a folder into a zip file.

PARAMETER DESCRIPTION
folder_path

Location of the folder to be zipped.

output_zip_path

New zip file location.

RETURNS DESCRIPTION

N/A

index_converter

index_converter(ind, images_per_row, double_indexing=True)

Converts a singe digit index into a double digit system, if required.

PARAMETER DESCRIPTION
ind

The input single index

images_per_row

The number of images per row in the output figure

double_indexing

Whether or not double indexing is required

DEFAULT: True

RETURNS DESCRIPTION

Two split indices or a single index if double indexing not necessary

save_list_dict_to_file

save_list_dict_to_file(
    output_folder,
    filename,
    lists_dict,
    selected_data=None,
    append=True,
    index_column=None,
)

Saves a dictionary of lists to an excel file.

PARAMETER DESCRIPTION
output_folder

Folder to save final file

filename

Name of the file to save

lists_dict

Dictionary of lists. Each key will become a column header, while the data will be saved in rows. Each list must have the same length.

selected_data

Optional list of specific indices to save. If None, all data will be saved.

DEFAULT: None

append

Set to true to append to an existing file if this is available.

DEFAULT: True

index_column

Optional column name to move to the left-most position in the output file.

DEFAULT: None

RETURNS DESCRIPTION

N/A

convert_np_to_py

convert_np_to_py(data)

Converts numpy data types to python data types. Only works on integers, floats and ndarrays.

PARAMETER DESCRIPTION
data

Numpy data, dictionary of numpy data or list of numpy data

RETURNS DESCRIPTION

Updated data

Slat basic physical properties

crisscross.helper_functions.slat_salient_quantities