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  : :class:`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


    dnaProbe : :class:`DNA`
        probe DNA. Number of base-pairs in Reference and probe DNA **should be** same.

    bpProbe : 1D list or array
        base-pairs or base-steps to consider from Reference DNA. Foe more, see above example of ``bpSubj``.

    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 :meth:`DNA.get_parameters`.

    error_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``)

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

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

    merge_method : str
        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

    masked : bool
        ``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 :meth:`DNA.generate_smooth_axis` to
        skip those frames where 3D fitting curve was not successful within
        the given criteria

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

def localDeformationVsBPS(dnaRef, bpRef, dnaProbe, bpProbe, parameter, err_type='std', bp_range=True, merge_bp=1,
                          merge_method='mean', masked=False, tool='gmx analyze'):
    """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  : :class:`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


    dnaProbe : :class:`DNA`
        probe DNA. Number of base-pairs in Reference and probe DNA **should be** same.

    bpProbe : 1D list or array
        base-pairs or base-steps to consider from Reference DNA. Foe more, see above example of ``bpSubj``.

    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 :meth:`DNA.get_parameters`.

    error_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``)

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

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

    merge_method : str
        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

    masked : bool
        ``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 :meth:`DNA.generate_smooth_axis` to
        skip those frames where 3D fitting curve was not successful within
        the given criteria

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

    """

    bpRef, RefAvgValue, RefError = dnaRef.get_mean_error(bpRef, parameter, err_type=err_type, bp_range=bp_range,
                                                         merge_bp=merge_bp, merge_method=merge_method, tool=tool,
                                                         masked=masked)

    bpProbe, ProbeAvgValue, ProbeError = dnaProbe.get_mean_error(bpProbe, parameter, err_type=err_type, bp_range=bp_range,
                                                             merge_bp=merge_bp, merge_method=merge_method, tool=tool,
                                                             masked=masked)

    if len(bpRef) != len(bpProbe):
        raise ValueError(
            "Number (%d) of bp/bps/segments in reference DNA does not match with the number (%d) of probe DNA." % (len(bpRef), len(bpProbe)))

    deviation = RefAvgValue - ProbeAvgValue
    error = np.sqrt((RefError**2) + (ProbeError**2))

    return bpRef, bpProbe, deviation, error