Other functions in dnaMD modules

Summary

dnaMD.setParametersFromFile(dna, filename[, ...])

Read a specific parameter from the do_x3dna output file.

dnaMD.read_param_file(FileName, parameters, ...)

Read parameters from do_x3dna file.

dnaMD.get_error(time, x, sets[, err_type, tool])

To estimate error using block averaging method

dnaMD.dev_parameters_vs_axis(dnaRef, ...[, ...])

To calculate deviation in the given parameters of a Subject DNA to Reference DNA along the given axis.

dnaMD.localDeformationVsBPS(dnaRef, bpRef, ...)

To calculate deformation of local parameters in probe DNA with respect to a reference DNA as a function of the bp/s.

dnaMD.vector_angle(x, y[, multiple, norm])

Calculate angle between two vector/s

Documentation

dev_parameters_vs_axis(dnaRef, dnaSubj, parameter, bp, axis='Z', bp_range=True, windows=10, err_type='block', tool='gmx analyze')[source]

To calculate deviation in the given parameters of a Subject DNA to Reference DNA along the given axis.

Note

Deviation = Reference_DNA(parameter) - Subject_DNA(parameter)

Warning

To calculate errors by using error = 'acf' or error = 'block', GROMACS tool g_analyze or gmx analyze should be present in $PATH.

Parameters:
  • dnaRef (DNA) – Reference DNA

  • dnaSubj (DNA) – Subject DNA. Number of base-pairs in Reference and Subject DNA should be same.

  • parameter (str) – Name of a base-pair or base-step or helical base-step parameter For details about accepted keywords, see parameter in the method DNA.get_parameters().

  • bp (1D list or array) –

    base-pairs to analyze Example:

    bp = [6]                                # bp_range = False
    bp = [4,15]                             # bp_range = True
    bp = range(4,15)                        # bp_range = False
    bp = np.arange(4,15)                    # bp_range = False
    bp = [2,5,6,7,9,12,18]                  # bp_range = False
    

  • bp_range (bool) – Default=True: As shown above, if True, bp is taken as a range otherwise list or numpy array.

  • axis (str) – Axis along which DNA axis is parallel. Keywords: X, Y and Z.

  • windows (int) – Number of bins along the axis

  • err_type (str) –

    Method of error estimation. Currently accepted method as follows:

    • error = 'std' : Standard Deviation

    • error = 'acf' : Standard error using autocorrelation time (requires: g_analyze or gmx analyze)

    • error = 'block' : Standard error using block averaging method (requires: g_analyze or gmx analyze)

  • tool (str) – Gromacs tool g_analyze or gmx analyze or gmx_mpi analyze etc. It will be used to calculate autocorrelation time or block averaging error. It should be present in $PATH

Returns:

  • deviation (1D array) – length of no. of windows; Deviation in the parameter for two given DNA

  • deviation_error (1D array) – length of no. of windows; Standard error in deviation fo each window/bin

  • axis (1D array) – length of no. of windows; average position of window/bin along given axis

  • axis_error (1D array) – length of no. of windows; Standard error in average position of window/bin along given axis

get_error(time, x, sets, err_type='block', tool='gmx analyze')[source]

To estimate error using block averaging method

Warning

To calculate errors by using error = 'acf' or error = 'block', GROMACS tool g_analyze or gmx analyze should be present in $PATH.

Parameters:
  • time (1D list or array) – DNA.time

  • x (2D list or array) – Shape of (nset, nframe); where nset is number of set and nframe is total number of frames. nframe should be equal to length of time list/array

  • sets (int) – Number of sets (nset)

  • err_type (str) – Error estimation by autocorrelation method err_type='acf' or block averaging method err_type='block'

  • tool (str) – GROMACS tool to calculate error. In older versions it is g_analyze while in newer versions (above 2016) it is gmx analyze.

Returns:

error – Of length = number of sets (nset)

Return type:

1D array

localDeformationVsBPS(dnaRef, bpRef, dnaProbe, bpProbe, parameter, err_type='std', bp_range=True, merge_bp=1, merge_method='mean', masked=False, tool='gmx analyze')[source]

To calculate deformation of local parameters in probe DNA with respect to a reference DNA as a function of the bp/s.

Note

Deformation = Reference_DNA(parameter) - Probe_DNA(parameter)

Warning

Number of segments/bp/bps should match between probe and reference DNA.

Warning

To calculate errors by using error = 'acf' or error = 'block', GROMACS tool g_analyze or gmx analyze should be present in $PATH.

Parameters:
  • dnaRef (DNA) – Reference DNA

  • bpRef (1D list array) –

    base-pairs or base-steps to consider from Reference DNA Example:

    bp = [6]                                # bp_range = False
    bp = [4,15]                             # bp_range = True
    bp = range(4,15)                        # bp_range = False
    bp = np.arange(4,15)                    # bp_range = False
    

dnaProbeDNA

probe DNA. Number of base-pairs in Reference and probe DNA should be same.

bpProbe1D list or array

base-pairs or base-steps to consider from Reference DNA. Foe more, see above example of bpSubj.

parameterstr

Name of a base-pair or base-step or helical base-step parameter For details about accepted keywords, see parameter in the method DNA.get_parameters().

error_typestr

Method of error estimation. Currently accepted method as follows:

  • error = 'std' : Standard Deviation

  • error = 'acf' : Standard error using autocorrelation time (requires: g_analyze or gmx analyze)

  • error = 'block' : Standard error using block averaging method (requires: g_analyze or gmx analyze)

bp_rangebool

Default=True: As shown above, if True, bp is taken as a range otherwise list or numpy array.

merge_bpint

Number of base-pairs or steps to merge for creating the small DNA segments

merge_methodstr

Method to calculate the parameter of a DNA segment from local parameters of all base-pairs/steps that are between the range given through bp. Currently accepted keywords are as follows:

  • merge_method = mean: Average of local parameters

  • merge_method = sum: Sum of local parameters

maskedbool

Default=False. To skip specific frames/snapshots. DNA.mask array should be set to use this functionality. This array contains boolean (either True or False) value for each frame to mask the frames. Presently, mask array is automatically generated during DNA.generate_smooth_axis() to skip those frames where 3D fitting curve was not successful within the given criteria

toolstr

Gromacs tool g_analyze or gmx analyze or gmx_mpi analyze etc. It will be used to calculate autocorrelation time or block averaging error. It should be present in $PATH

Returns:

  • bpRef (1D array)) – base-pair/step numbers of reference DNA. If merge_bp>1, middle number will is returned.`

  • bpProbe (1D array) – base-pair/step numbers of probe DNA. If merge_bp>1, middle number will is returned.`

  • deviation (1D array) – Deviation in the parameter of probe DNA with respect to reference DNA.

  • error (1D array) – Standard error of respective deviation

read_param_file(FileName, parameters, bp, bp_range, word=False, startBP=1)[source]

Read parameters from do_x3dna file.

It is the main function, which is used to read and extract the parameters values from the do_x3dna output files.

Parameters:
  • FileName (str) – Parameter file produced from do_x3dna.

  • parameters (list) – List of column indices that has to be extracted. indices here start with one.

  • bp (1D list or array) –

    base-pairs to analyze Example:

    bp = [6]                                # bp_range = False
    bp = [4,15]                             # bp_range = True
    bp = range(4,15)                        # bp_range = False
    bp = np.arange(4,15)                    # bp_range = False
    bp = [2,5,6,7,9,12,18]                  # bp_range = False
    

  • bp_range (bool) – Default=True: As shown above, if True, bp is taken as a range otherwise list or numpy array.

  • word (bool) – In some parameters, in place of value, '---' is present in the file. If parameter values contain this, use True.

  • startBP (int) – Number ID of first base-pair.

Returns:

  • data (3D array) – Extracted parameters as a 3D array of shape (bp, parameters, time).

  • time (1D array) – Time of each frame

setParametersFromFile(dna, filename, parameters=None, bp=None)[source]

Read a specific parameter from the do_x3dna output file. It automatically load the input parameter from a file to dna object or HDF5 file. It automatically decides from input parameter, what will be format of input file.

Parameters:
  • dna (DNA) – Input DNA instance.

  • filename (str) – Input filename. This file should be output from do_x3dna.

  • parameter (str, list, None) – Name of parameter. For details about accepted keywords, see parameter in the method DNA.get_parameters(). Note that parameter that are calculated from do_x3dna cannot be used here. In case of Ǹone, parameters name will be automatically determine from the input file.

  • bp (list) –

    List containing lower and higher limit of base-pair/step range.
    • This list should not contain more than two number.

    • First number should be less than second number.

    Example for base-pairs/steps 4 to 15:

    bp = [4,15]         # step_range = True

    If None, all base-pairs/steps will be considered.

vector_angle(x, y, multiple=True, norm=None)[source]

Calculate angle between two vector/s

Parameters:
  • x (1D or 2D array) – First vector or array of first vectors

  • y (1D or 2D array) – Second vector or array of second vectors

  • multiple (bool) – If x and y are array of vector then use True otherwise use False

  • norm (vector) – Normal vector. useful to determine signed angle.

Returns:

value – Calculated angle value. If x and y are array of vector, then array of angle is returned otherwise a single angle value is returned.

Return type:

float or 1D array