Windowed MSD - Calculate time in each Diffusion Mode

Perform a windowed mean square displacement of trajectories, estimate diffusion coefficients, calculate the amount of time in that regime.
42 Downloads
Updated 27 Oct 2021

View License

%% Paper pre-print for project from which this work originates. https://www.biorxiv.org/content/10.1101/2021.10.22.465443v2 %%
Perform a windowed mean square displacement of trajectories, estimate diffusion coefficients using a levy flight model, calculate the amount of time the object is in a diffusive regime. This program reads in excel files outputted from the Fiji plug-in TrackMate. It then performs a windowed mean square displacement on each trajectory, given a window by the user. This program was written to analyze trajectories in far from equilibrium systems, like motor proteins in the cell cytoskeleton. Thus it considers negative diffusion coefficients approximated from the slope of the MSD vs. time lag graph to be (biologically) relevant.
For the MSD it is presumed that the displacements follow a levy distribution, the trajectories are then modeled as following a levy flight, where where β is approximately the diffusion coefficient, and α is a superdiffusive coefficient related to step length. The program here stores the α values over each window. So that you get super diffusive coefficient spectra.
The amount of time the object is exhibiting constrained motion, Brownian motion, Super diffusive or applied force model motion, or negative diffusion (aggregation), is calculated within each trajectory using a user defined sampling rate.
TrackMate Excel files should be in their own folder named "track_data" in the same pathway as the programs. Main calls read_in_data, organize_tracks, windowed_MSD_Analysis, and Diffusion_coeff_calculator, to read in track data, organize them into trajectories, perform the wMSD, and approximate diffusion coefficients. The scripts time_spent_brownian, time_spent_constrained, time_spent_negative, time_spent_appliedforce calculate the amount of time the object exhibits the respective diffusive behavior within a trajectory.
@Main handles the reading in of data from Fiji TrackMate excel files (save in a subfolder named "track_data"), then organizes trajectories, runs the wMSD, and calculates an approximate diffusion coefficient. A diffusion coefficient is calculated for each windowed section of the trajectory using a sliding window.
@ read_in_data : goes into the folder "track_data" and pulls data from the excel files stored there. Is called by Main.
@ organize_tracks: Takes information read in by read_in_data and creates cell arrays for each movie containing its respective trajectories. Is called by Main.
@ windowed_MSD_Analysis: Performs a sliding window mean square displacement. The method extends each signal by window size -1 points to the front and back of the trajectory using the first point in the front, and last point in the back. Is called by Main
@Diffusion_coeff_calculator: Calculates the diffusion coefficients for each windowed section of the trajectory, generating a diffusion coefficient "spectra" for each trajectory. Is called by Main
The diffusion coefficient spectra for each trajectory, and wMSD is saved by Main as 'DATAMain.mat'.
Functions to Call after Running Main
@time_spent_appliedforce: Calculates the amount of time that an object is moving under an applied force model. Goes into the diffusion coefficient spectra for a trajectory and finds all coefficients greater than or equal to 1.05. Checks to see how far the coefficients are from one another in the spectrum, and calculates the amount of time in that motility regime.
@time_spent_brownian: Calculates the amount of time that an object is moving under a brownian model. Goes into the diffusion coefficient spectra for a trajectory and finds all coefficients greater than 0.95 and less than 1.05. Checks to see how far the coefficients are from one another in the spectrum, and calculates the amount of time in that motility regime.
@time_spent_constrained: Calculates the amount of time that an object is moving under a constrained model. Goes into the diffusion coefficient spectra for a trajectory and finds all coefficients greater than 0 and less than 1.05. Checks to see how far the coefficients are from one another in the spectrum, and calculates the amount of time in that motility regime.
@time_spent_negative: Calculates the amount of time that an object is moving under a negative model. Goes into the diffusion coefficient spectra for a trajectory and finds all coefficients less than 0. Checks to see how far the coefficients are from one another in the spectrum, and calculates the amount of time in that motility regime.

Cite As

John Linehan (2024). Windowed MSD - Calculate time in each Diffusion Mode (https://www.mathworks.com/matlabcentral/fileexchange/90757-windowed-msd-calculate-time-in-each-diffusion-mode), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.4

added reference to pre-print.

1.1.3

We use a levy flight model to analyze the MSD

1.1.2

Updated time step to user input.

1.1.1

Had hard coded sampling rate, now user input.

1.1.0

Had hard coded a sampling rate, now make it a user input.

1.0.2

Updated Tags

1.0.1

Additional Documentation

1.0.0