The proto-Nucleic-Acid Builder (pNAB)
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
driver.pNAB Class Reference

The proto-Nucleic Acid Builder main python class. More...

Inheritance diagram for driver.pNAB:
Inheritance graph
[legend]
Collaboration diagram for driver.pNAB:
Collaboration graph
[legend]

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
 

Detailed Description

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).

import pnab
run = pnab.pNAB('RNA.yaml')
run.run()
import pnab
run = pnab.pNAB('DNA.yaml')
run.run()

Constructor & Destructor Documentation

◆ __init__()

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.

Parameters
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
See also
jupyter_widgets
options.validate_all_options

Member Function Documentation

◆ _run()

def driver.pNAB._run (   self,
  config 
)
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

Parameters
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
See also
run

◆ 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 "_".

Parameters
number_of_cpusNumber of CPUs to use for parallel computations of different helical configurations, defaults to all cores
verboseWhether to print progress report to the screen, default to True
interruptHow to handle keyboard interrupt in multiprocessing
Returns
None; output files are written

Member Data Documentation

◆ _is_helical

driver.pNAB._is_helical
private

◆ _options

driver.pNAB._options
private

◆ _verbose

driver.pNAB._verbose
private

Whether to print progress report to the screen.

◆ header

driver.pNAB.header

A string comma-separated header for the results used in the generated CSV files.

◆ options

driver.pNAB.options

Validated options dictionary for the pNAB run.

See also
options.validate_all_options

◆ prefix

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.

◆ results

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


The documentation for this class was generated from the following file: