selComponentTracks-methods: selComponentTracks

Description Usage Arguments Value Examples

Description

Select trajectory based on component fitting on diffusion coefficient.

Usage

1
selComponentTracks(fit,likelihood=0.9,dcoef,log.transformed=F,output=F)

Arguments

fit

Component fitting result form fitNormDistr() function.

likelihood

The likelihood of a trajecotry to be in fitted group. This parameter specifies the strigency of selecting trajectories to be in the fitted group and therefore influence the number of trajectories been selected.

dcoef

Diffusion coefficent calcualted by Dcoef, which provide the link between trajecotry index and diffusion coefficent.

log.transformed

A flag indicating if the fitting is been log transformed, select TRUE if fitting was done in fitNormDistr(log.transform = T,..). This parameter will be removed in later version by directly read the info from the output of fitNormalDistr() function.

output

A logical indicating if output of selected trajectory index, which can be used for plot individual trajectory using plotTrack.

Value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## selComponentTracks() usage
# 1. select componentTracks per folder (cross movie) by using compareFolders
# 2. select componentTracks per movie base, use plotComponentTracks to plot component tracks back to initial Nuclei image.

## 1. select componentTracks per folder (cross movie) by using compareFolders
folder1=system.file("extdata","SWR1",package="smt")
folder2=system.file("extdata","HTZ1",package="smt")
trackll=compareFolder(c(folder1,folder2))
MSD=msd(trackll=trackll)
dcoef=Dcoef(MSD,dt=6,plot=T,output=F)
# fit dcoef
# for replication purpose set seed to fix number
fit=fitNormDistr(dcoef,components=2,log.transform=T,combine.plot=F,output=F,seed=484)

# select component tracks from fitting
trackll.sel=selComponentTracks(fit=fit,likelihood = 0.9,dcoef = dcoef,log.transformed = T,output = F)
# subset component tracks to further analyze msd, dcoef
trackll.swr1=trackll.sel[["SWR1"]]
msd(trackll.swr1,plot=T)
msd(trackll.swr1,summarize=T,plot=T)
Dcoef(trackll=trackll.swr1,plot=T)
plotTrackOverlay(trackll.swr1)

# plotNucTrackOverlay(folder=folder1, trackll=trackll.swr1)
dwellTime(trackll.swr1)

# Output trajectory index to plot individually
# trackll.sel=selComponentTracks(fit=fit,likelihood = 0.9,dcoef = dcoef,log.transformed = T,output = T)
# specify index file path.
index.file=system.file("extdata","INDEX","componentTrackID-SWR1.comp.1.csv",package="smt")
index.file2=system.file("extdata","INDEX","componentTrackID-SWR1.comp.2.csv",package="smt")
movie.folder=system.file("extdata","SWR1_2",package="smt")
plotTrackFromIndex(index.file=index.file,movie.folder = movie.folder)
plotTrackFromIndex(index.file=index.file2,movie.folder = movie.folder)


## 2. select componentTracks per movie base, use plotComponentTracks to plot component tracks back to initial Nuclei image.
## plotComponentTrackOverlay
folder3=system.file("extdata","SWR1_2",package="smt")
trackll=readDiatrack(folder3,merge=F)

## use merge=T for per folder comparison, the analsyis result can't be plot back to original image
## To see component tracks on original nuclei image, set merge=F (for per movie analysis)
## may not make much sense to msd on individual movie, however for plot component track back to original nuclei image.

## compute MSD
MSD=msd(trackll=trackll,plot=T)
msd(trackll=trackll,summarize=T,plot=T)

## calculate Dcoef
dcoef=Dcoef(MSD=MSD,method="static",plot=TRUE)

## fit normal distribution to define component
## set seed to reproduce results (see fitNormalDistr() for details on seed)
fit=fitNormDistr(dcoef,components=2,log.transform=T,combine.plot=F,output=F,seed=481)

## select component tracks based on fitting
trackll.sel=selComponentTracks(fit=fit,likelihood = 0.9,dcoef = dcoef,log.transformed = T,output = F)
## plot component tracks
plotComponentTrackOverlay(folder=folder3,trackll.sel=trackll.sel)

sheng-liu/smt documentation built on May 29, 2019, 9:22 p.m.