File Exchange

image thumbnail

Windowed MSD - Calculate time in each Diffusion Mode

version 1.1.2 (8.24 KB) by John Linehan
Perform a windowed mean square displacement of trajectories, estimate diffusion coefficients, calculate the amount of time in that regime.

0 Downloads

Updated 23 Apr 2021

View Version History

View License

Perform a windowed mean square displacement of trajectories, estimate diffusion coefficients, 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.

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 (2021). 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 .

Comments and Ratings (0)

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!