Difference between revisions of "Deernet.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(→‎Arguments)
(→‎Outputs)
Line 42: Line 42:
  
 
==Outputs==
 
==Outputs==
−
The function displays a figure if no outputs are requested, or returns a data structure with the following fields.
+
Either a figure (if there are no output parameters), or a data struccture with the following fields:
  
−
     dataset.input.
+
     input_traces  - DEER/RIDME trace(s), as supplied by the user
 
   
 
   
−
        time_axis  - time axis, as supplied by the user
+
    input_axis    - time axis, as supplied by the user
 
   
 
   
−
        deer_trace - DEER trace, as supplied by the user
+
    ntraces        - number of DEER/RIDME traces in the input
 
   
 
   
−
     dataset.deernet.
+
     nsmpls        - number of non-NaN elements in the input DEER
 +
                    or RIDME trace
 
   
 
   
−
        library    - the parameters of the library with which
+
    net_type      - 'net' for uniformly sampled input data, 'vet'
−
                     current DEERNet had been trained
+
                     for sparsely sampled input data
 
   
 
   
−
        resamp_axis - time axis after the data was resampled
+
    resamp_axis   - time axis resampled to match DEERNet input dimen-
−
                      to match DEERNet inputdimension
+
                    sion, same as the input time axis for sparsely
 +
                    sampled inputs; this axis is used by background
 +
                    and retrocalculation outputs
 
   
 
   
−
        resamp_trace - DEER trace after the data was resampl-
+
    resamp_traces - DEER/RIDME trace(s) resampled to match DEERNet  
−
                        ed to match DEERNet input dimension
+
                    input dimensions, same as the input trace for
 +
                    sparsely sampled inputs
 
   
 
   
−
        deernet_rmin  - left edge of the distance grid as com-
+
    nnets          - number of networks in the netset that did the
−
                        puted from the user-supplied time trace
+
                    processing and the statistics
−
                        duration and DEERNEt input point count
 
 
   
 
   
−
        deernet_rmax  - right edge of the distance grid as com-
+
    expt          - background model selected at input
−
                        puted from the user-supplied time trace
 
−
                        duration and DEERNEt input point count
 
 
   
 
   
−
        input_rmin  - left edge of the distance grid as compu-
+
    bg_rates      - (DEER only) background decay rate returned by
−
                      ted from the user-supplied time trace du-
+
                    the retrofit of the data from each network
−
                      duration and point count
 
 
   
 
   
−
        input_rmax  - right edge of the distance grid as compu-
+
    bg_dims        - (DEER only) background dimension returned by
−
                      ted from the user-supplied time trace du-
+
                    the retrofit of the data from each network
−
                      duration and point count
 
 
   
 
   
−
     dataset.output.
+
     backgs_av      - arithmetic mean of the background signal over the
 +
                    outputs of the networks in the current netset
 
   
 
   
−
        background_mean - arithmetic mean of the background sig-
+
    backgs_lb      - 95% confidence interval lower bound for the back-
−
                          nal over the netset
+
                    ground signal obtained from netset statistics
 
   
 
   
−
        background_lb - 95% confidence interval lower bound for
+
    backgs_ub      - 95% confidence interval upper bound for the back-
−
                        the background signal obtained from net-
+
                    ground signal obtained from netset statistics
−
                        set statistics
 
 
   
 
   
−
        background_ub - 95% confidence interval upper bound for
+
    retros_av      - arithmetic mean of the trace retrofit(s) over the
−
                        the background signal obtained from net-
+
                    outputs of the networks in the current netset
−
                        set statistics
+
   
 +
    retros_lb      - 95% confidence interval lower bound for the retrofit
 +
                    signal obtained from netset statistics
 
   
 
   
−
        dist_distr_mean - arithmetic mean of the distance dist-
+
    retros_ub      - 95% confidence interval upper bound for the retrofit
−
                          ributions over the netset
+
                    signal obtained from netset statistics
 
   
 
   
−
        dist_distr_lb - 95% confidence interval lower bound for
+
    mdpths_av      - arithmetic mean of the modulation depth(s) over the
−
                        the distance distribution obtained from
+
                    outputs of the networks in the current netset
−
                        netset statistics
 
 
   
 
   
−
        dist_distr_ub - 95% confidence interval upper bound for
+
    mdpths_st      - standard deviation of modulation depth predictions
−
                        the distance distribution obtained from
+
                    obtained from netset statistics
−
                        netset statistics
 
 
   
 
   
−
        dist_axis - the distance axis matching the distance dis-
+
    dist_ax        - the distance axis matching the distances distribution
−
                    ribution and satisfying the constraints im-
+
                    and satisfying the constraints imposed by the timing
−
                    posed by both the timing of the input signal
+
                    of the input signal and the limits of DEERNet
−
                    or the limits of DEERNet, whichever is more
 
−
                    stringent
 
 
   
 
   
−
        mdepth - modulation depth estimate
+
    dist_av        - arithmetic mean of the distance distributions(s) over
 +
                    the netset
 +
 +
    dist_lb        - 95% confidence interval lower bound for the distance
 +
                    distribution(s) obtained from netset statistics
 +
 +
    dist_ub        - 95% confidence interval upper bound for the distance
 +
                    distribution(s) obtained from netset statistics
  
 
==Examples==
 
==Examples==

Revision as of 15:25, 28 July 2023

Uses pre-trained neural networks to extract background signals, modulation depths, and distance distributions from DEER data. See our papers:

               https://doi.org/10.1126/sciadv.aat5218
               https://doi.org/10.1073/pnas.2016917118
               https://doi.org/10.1016/j.jmr.2022.107186

for further information.

Syntax

   dataset=deernet(input_traces,input_axis,options)

Arguments

Required parameters:

   input_traces - experimental DEER trace(s), phased into pure absor-
                  ption and cropped on the left to make the first po-
                  int correspond to the echo modulation maximum; for
                  sparsely sampled data, the missing points should be
                  set to NaN. If multiple traces are supplied as col-
                  umns of a matrix, they will be processed assuming
                  common background dimension and decay rate.

   input_axis   - experimental time axis in seconds, a column vector
                  that must start at zero, have a uniform time step,
                  and no NaN elements in it - even when the data is
                  sparsely sampled

Optional parameters (using new Matlab option syntax, literally as below):

   expt='ridme'       - requests RIDME type background, the default
                        is DEER type background function

   bg_dim_range=[a b] - constrains background signal dimension to 
                        the interval [a b], default is [3.0,3.5],
                        the training range was [2.0,3.5]; this op-
                        tion only applies to expt='deer'.
                      
   do_jacobian=true   - requests Jacobian calculation; the run time
                        will become much longer

Outputs

Either a figure (if there are no output parameters), or a data struccture with the following fields:

   input_traces   - DEER/RIDME trace(s), as supplied by the user

   input_axis     - time axis, as supplied by the user

   ntraces        - number of DEER/RIDME traces in the input

   nsmpls         - number of non-NaN elements in the input DEER
                   or RIDME trace

   net_type       - 'net' for uniformly sampled input data, 'vet' 
                    for sparsely sampled input data

   resamp_axis    - time axis resampled to match DEERNet input dimen-
                    sion, same as the input time axis for sparsely
                    sampled inputs; this axis is used by background
                    and retrocalculation outputs

   resamp_traces  - DEER/RIDME trace(s) resampled to match DEERNet 
                    input dimensions, same as the input trace for 
                    sparsely sampled inputs

   nnets          - number of networks in the netset that did the
                    processing and the statistics

   expt           - background model selected at input

   bg_rates       - (DEER only) background decay rate returned by
                    the retrofit of the data from each network

   bg_dims        - (DEER only) background dimension returned by 
                    the retrofit of the data from each network

   backgs_av      - arithmetic mean of the background signal over the
                    outputs of the networks in the current netset

   backgs_lb      - 95% confidence interval lower bound for the back-
                    ground signal obtained from netset statistics

   backgs_ub      - 95% confidence interval upper bound for the back-
                    ground signal obtained from netset statistics

   retros_av      - arithmetic mean of the trace retrofit(s) over the
                    outputs of the networks in the current netset
    
   retros_lb      - 95% confidence interval lower bound for the retrofit
                    signal obtained from netset statistics

   retros_ub      - 95% confidence interval upper bound for the retrofit
                    signal obtained from netset statistics

   mdpths_av      - arithmetic mean of the modulation depth(s) over the
                    outputs of the networks in the current netset

   mdpths_st      - standard deviation of modulation depth predictions
                    obtained from netset statistics

   dist_ax        - the distance axis matching the distances distribution
                    and satisfying the constraints imposed by the timing
                    of the input signal and the limits of DEERNet

   dist_av        - arithmetic mean of the distance distributions(s) over
                    the netset

   dist_lb        - 95% confidence interval lower bound for the distance
                    distribution(s) obtained from netset statistics

   dist_ub        - 95% confidence interval upper bound for the distance
                    distribution(s) obtained from netset statistics

Examples

First, the experimental data is loaded:

    % Load experimental data
    [deer_trace,time_axis]=elexsys2deernet('data_deeran/CT_DEER_mix_28_36/CT_DEER_mix_28_36');

The data is then sent to DEERNet:

    % Run deernet analysis
   deernet(deer_trace,time_axis);

With no output arguments requested in the call to DEERNet, the following plot is produced.

Deernet example.png

Further examples are available under examples/deernet/

  • example_set_paper.m - The six examples used in the paper on DEERNet.
  • example_set_deeran.m - Selection of the examples included with the DeerAnalysis package.

Notes

  1. Do not supply excessively long baseline tails in the input data - unlike Tikhonov tools, DEERNet does not need those, it works better if you cut off baseline tails.
  2. The input DEER trace must be cropped on the left to make the first point of the trace correspond to the maximum.

Deernet preprocess.png

This is done automatically in elexsys2deernet.m, and this is the only preprocessing required by DEERNet - it can handle background and noise.

See also

Neural network module

DEER/PELDOR experiments


Version 2.5, authors: Ilya Kuprov, Steve Worswick, Gunnar Jeschke