Dcoef {sojourner} | R Documentation

## Dcoef

### Description

Caclulate diffusion coefficient (Dcoef) for trajecotries.

### Usage

    Dcoef( MSD=NULL,trackll=NULL,dt=6,filter=c(min=7,max=Inf),rsquare=0.8,
           resolution=0.107,binwidth=NULL,method=c("static","percentage",
           "rolling.window"),plot=FALSE,output=FALSE,t.interval=0.01,
           profile=NULL)

### Arguments

`MSD` | Mean Square Displacement calculated using msd() function. Either MSD or trackll can be passed into Dcoef for calculation of diffusion coefficient.
`trackll` | Track list output from readDiatrack().
`dt` | Time intervals. Default 6.
`filter` | a vector specifies the minimum and max length of trajecotries to be analyzed. Take only trajectories that has number of frames greater than (>=) min and less than (<) max.
`rsquare` | rsquare filter on Dcoef results. Default to be 0.8. Set value to 0 if rsquare filter is not desired.
`resolution` | ratio of pixel to uM.
`binwidth` | binwidth used for histogram. Default NULL, automatically assign binwidth.
`method` | "static", uses time lags 2~5 to calculate diffusion coefficient; "percentage", uses (tierd) percentage (default 0.25) of time lags (see Details). "rolling.window", time lags uses for Dcoef follows a rolling window with specified window size (default 4).
`plot` | A parameter for plotting. Default FALSE, no plot; If TRUE, automatically plots 'histogram' with count information, binwidth can be set through parameter binwidth; as well as 'density' with density/frequency.
`output` | An Logical indicate if output should be generated. See Values for detail.
`t.interval` | time interval between frames, default 0.010 s (10ms).
`profile` | Location of preference file. By default (NULL), it is stored at : system.file("extdata","PREF","profile.csv",package="sojourner"). User can provide preference file by specifying the location of the file, e.g. profile="/Users/shengliu/Desktop/profile.csv".

### Details

Generic parameters (parameter applied to all methods, such as resolution etc) are set in the function. Method dependent parameters (such as lag.start, lag.end for method = "static"), are stored in profile.csv in PREF folder under extdata. To change preference parameter, can either programably or manually go to folder system.file("extdata","PREF","profile.csv",package="sojourner"), and c hange the profile.csv.

lag.start: time lag used as start of dt for compute Dcoef. Default 2.

lag.end: Time lag used as end of dt for compute Dcoef. Default 2.

method for calculating Dcoef:

- static stabilize the number of time lags used for fitting using time lag 2~ 5 despite the total time lags measured.

- percentage "percentage", uses (tierd) percentage (default 0.25) of time lags.

  [,1] | TrackLength | Percentage | TimeLagsForFitting
  [,2] | 31~ | 0.25 | 2~5-2~7
  [,3] | 22~30 | 0.25 | 2~5-2~7
  [,4] | 15~21 | 0.4 | 2~5-2~7
  [,5] | 10~15 | 0.6 | 2~5-2~7
  [,6] | 7~9 | 1 | 2~5-2~7

- rolling.window time lags uses for Dcoef follows a rolling window with specified window size (default 4).

### Value

- Dcoef A list of Dcoef for each file in trackll.

- PDF Log.Dcoef histogram fitted with density curve, when plot = TRUE.

- csv Dcoef output in csv format, when output = TRUE.

### Examples

    # compare files
    folder=system.file("extdata",'SWR1',package="sojourner")
    trackll = createTrackll(folder=folder, input=3)
    MSD=msd(trackll=trackll)
    Dcoef(MSD=MSD,method="static",plot=TRUE)

    # compare folders
    folder1=system.file("extdata",'SWR1',package="sojourner")
    folder2=system.file("extdata",'HTZ1',package="sojourner")
    trackll2=compareFolder(folders=c(folder1,folder2), input=3)
    Dcoef(trackll=trackll2,method="percentage",plot=TRUE)
    Dcoef(trackll=trackll2,method="rolling.window",plot=TRUE)

[Package sojourner version 1.8.0 Index]