A Python API for writing analysis scripts to be used with WebDNA
Using the API is simple, just import webdnapi.files to expose the file loading functionality
Project settings are stored on a single JSON file
Load this file by calling the corresponding load function:
import webdnapi.files
settings = webdnapi.files.load_project_settings()The returned object will have the following attributes:
file_string- complete contents of the loaded file for advanced use casesexecution_time- the elapsed time the simulation has run forname- the name of the project specified by the userscript_chain- the list of analysis script uuids to be executed by the server upon simulation completiongeneration- An object with the following attributes:arguments- commandline arguments needed to execute the generation scriptfiles- files needed for generationmethod- the chosen method for creating an initial configuration
Simulation settings are stored in this file
Load with the following syntax:
import webdnapi.files
input_settings = webdnapi.files.load_input()The returned object will have the following attributes:
file_string- complete contents of the input file for advanced use casessettings- a key, value dictionary of all specified settings and their corresponding values
The output of oxDNA which contains meta-info
Load with the following syntax:
import webdnapi.files
log = webdnapi.files.load_log()The returned object will have the following attributes:
file_string- complete contents of the log file
The stdout of the oxDNA simulation which lists information each n-th step
Load with the following syntax:
import webdnapi.files
stdout = webdnapi.files.load_stdout()The returned object will have the following attributes:
file_string- complete contents of stdout filesteps- list of steps, each step holds its relevant output from the file
The sequence file contains the bases of each strand being simulated
Load with the following syntax:
import webdnapi.files
sequence = webdnapi.files.load_sequence()The returned object will have the following attributes:
file_string- complete contents of sequence file for advanced use casesstrands- list of all strands
The topology file contains information on each nucleotide in the simulation
Load with the following syntax:
import webdnapi.files
topology = webdnapi.files.load_topology()The returned object will have the following attributes:
file_string- complete contents of topology file for advanced use casesnucleotide_count- number of nucleotides in the simulationstrand_count- number of strands in the simulationnucleotides- list of all nucleotides and their corresponding information
The energy file contains meta-information about energy states in the simulation
Load with the following syntax:
import webdnapi.files
energy = webdnapi.files.load_energy()The returned object will have the following attributes:
file_string- complete contents of energy file for advanced use casestime_steps- list of time steps and their corresponding energy information
The external forces file contains data on all user defined forces in the simulation
Load with the following syntax:
import webdnapi.files
topology = webdnapi.files.load_external_forces()The returned object will have the following attributes:
file_string- the complete contents of the force file for advanced use casesforces- a list of force objects, each force contains its own key, value dictionary of its attributes
The trajectory files contain configuration information about the current simulation. These files can be very large, so expect some performance impact depending on the size of your simulation.
You can load either the initial configuration or last configuration with the following functions:
import webdnapi.files
first_configuration = webdnapi.files.load_trajectory_initial()
last_configuration = webdnapi.files.load_trajectory_last()The returned object of either function will have the following attributes:
time_step- the time_step of the loaded configurationbox_length_x,box_length_y,box_length_z- the length of the sides of the simulation boxenergy_total,energy_potential,energy_kinetic- the energies of the simulation at the current time_stepnucleotides- a list of nucleotide objects each with the following attributes:pos_x,pos_y,pos_z- position coordinates of nucleotidebase_v_x,base_v_y,base_v_z- baseversor of nucleotidenormal_v_x,normal_v_y,normal_v_z- normalversor of nucleotidevelocity_x,velocity_y,velocity_z- velocities of nucleotideang_velocity_x,ang_velocity_y,ang_velocity_z- angular velocities of nucleotide