The proto-Nucleic-Acid Builder (pNAB)
|
The proto-Nucleic Acid Builder main python class. More...
Public Member Functions | |
def | __init__ (self, file_path) |
The constructor for the pNAB run. More... | |
def | run (self, number_of_cpus=None, verbose=True, interrupt=False) |
Prepare helical configurations and run them in parallel. More... | |
Public Attributes | |
options | |
Validated options dictionary for the pNAB run. More... | |
header | |
A string comma-separated header for the results used in the generated CSV files. More... | |
prefix | |
A dictionary of the sequence of the run and the corresponding helical configuration For runs that have ranges of values for the helical parameters, this dictionary provides a mapping between the sequence of the run and the helical parameters. More... | |
results | |
A numpy array containing the results of all the candidates. More... | |
Private Member Functions | |
def | _run (self, config) |
Function to run one helical configuration. More... | |
Private Attributes | |
_options | |
_verbose | |
Whether to print progress report to the screen. More... | |
_is_helical | |
The proto-Nucleic Acid Builder main python class.
A class that contains methods to create a pNAB run. It validates input, runs it, and save results.
Examples: Use the code to get RNA and DNA candidates. This uses the provided example files in the "pnab/data" directory. The results are in three files:
1) results.csv: Contains all the results for all the helical configurations requested in the run.
2) prefix.yaml: Containts a dictionary of the sequence of the run and the corresponding helical configuration (useful when a range of values is given for the helical parameters).
def driver.pNAB.__init__ | ( | self, | |
file_path | |||
) |
The constructor for the pNAB run.
The constructor takes an input file as an argument and initialize a new instance. The input file uses a YAML format for specifying the run options. This input file can be generated using the graphical user interface created in jupyter_widgets. Additionally, there are a few example files in the "pnab/data" directory. The constructor creates the pNAB.pNAB.options attribute which contains a dictionary of all the defined options.
file_path | (str) Path to a file containing the user-defined input. This function tries to find the file in the current working directory. If it does not exist, it looks for the file in the "pnab/data" directory |
|
private |
Function to run one helical configuration.
Setup the options to call the C++ code using the pybind11 bind class in binder.cpp. After the run finishes, it writes the results. Two files are written: "prefix.yaml" contains a dictionary of the sequence of the run and the corresponding helical configuration "results.csv" contains the information on the accepted candidates for all of configurations
config | (list) a list containing two entries: the list of helical parameter values for this configuration, and a string index for the sequnce of the run |
def driver.pNAB.run | ( | self, | |
number_of_cpus = None , |
|||
verbose = True , |
|||
interrupt = False |
|||
) |
Prepare helical configurations and run them in parallel.
This function first copies the user-defined options to an internal options dictionary (self._options). Next, self._options is validated through a call to options.validate_all_options to validate all the options for the backbone parameters, helical parameters, and runtime parameters. Then, it adds the library of all the defined nucleobases. The nucleobases are defined in the "pnab/data" directory. Whether to pair adenine with thymine (default) or uracil is determined here by the pNAB.pNAB.options['RuntimeParameters']['pair_A_U'].
If a single value is given for a helical parameter (e.g. helical twist), then that value is used. If a range of values is given, then equally spaced values in the range will be used. The number of configurations is determined by the third value in pNAB.pNAB.options. The various helical configurations are run in parallel using the multiprocessing library.
This function writes three output files: "results.csv" and "prefix.yaml". It renames any existing files with these names by prepending enough "_".
number_of_cpus | Number of CPUs to use for parallel computations of different helical configurations, defaults to all cores |
verbose | Whether to print progress report to the screen, default to True |
interrupt | How to handle keyboard interrupt in multiprocessing |
|
private |
|
private |
|
private |
Whether to print progress report to the screen.
driver.pNAB.header |
A string comma-separated header for the results used in the generated CSV files.
driver.pNAB.options |
Validated options dictionary for the pNAB run.
driver.pNAB.prefix |
A dictionary of the sequence of the run and the corresponding helical configuration For runs that have ranges of values for the helical parameters, this dictionary provides a mapping between the sequence of the run and the helical parameters.
driver.pNAB.results |
A numpy array containing the results of all the candidates.
The columns in the array correspond to the entries in pNAB.pNAB.header and the helical configurations correspond to those in pNAB.pNAB.prefix