Helper Functions
Slat Design¶
Basic tools for designing DNA slats.
crisscross.core_functions.slat_design ¶
generate_standard_square_slats ¶
Generates a base array for a square megastructure design
| PARAMETER | DESCRIPTION |
|---|---|
slat_count
|
Number of handle positions in each slat
DEFAULT:
|
| 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 ¶
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:
|
handle_side
|
H2 or H5 handle position
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
|
Dataframe containing all new sequences to be ordered for cargo attachment |
generate_patterned_square_cco ¶
Pre-generates a square megastructure with specific repeating patterns.
| PARAMETER | DESCRIPTION |
|---|---|
pattern
|
Choose from the set of available pre-made patterns.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
|
2D array containing pattern TODO: make size of square adjustable |
General Helper Functions¶
General utility functions.
crisscross.helper_functions ¶
revcom ¶
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 ¶
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 ¶
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 ¶
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 ¶
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:
|
| 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:
|
append
|
Set to true to append to an existing file if this is available.
DEFAULT:
|
index_column
|
Optional column name to move to the left-most position in the output file.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
|
N/A |
convert_np_to_py ¶
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 |