-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTrackSOM-workflow.R
103 lines (83 loc) · 4.01 KB
/
TrackSOM-workflow.R
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
## ----message=FALSE, warning=FALSE---------------------------------------------
library(data.table)
library(TrackSOM)
## -----------------------------------------------------------------------------
data.files.fullpath <- c(
system.file("extdata", "synthetic_d0.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d1.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d2.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d3.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d4.csv", package = "TrackSOM")
)
## -----------------------------------------------------------------------------
print(data.files.fullpath)
## -----------------------------------------------------------------------------
data.files.fullpath.fcs <- c(
system.file("extdata", "synthetic_d0.fcs", package = "TrackSOM"),
system.file("extdata", "synthetic_d1.fcs", package = "TrackSOM"),
system.file("extdata", "synthetic_d2.fcs", package = "TrackSOM"),
system.file("extdata", "synthetic_d3.fcs", package = "TrackSOM"),
system.file("extdata", "synthetic_d4.fcs", package = "TrackSOM")
)
## -----------------------------------------------------------------------------
print(data.files.fullpath.fcs)
## -----------------------------------------------------------------------------
dat <- lapply(data.files.fullpath, function(f) fread(f))
dat
## -----------------------------------------------------------------------------
timepoints <- seq(0, 4)
dat <- lapply(seq(length(data.files.fullpath)), function(data_file_i) {
dt <- fread(data.files.fullpath[[data_file_i]])
dt[['timepoint']] <- timepoints[data_file_i]
return(dt)
})
dat <- rbindlist(dat)
head(dat)
tail(dat)
## -----------------------------------------------------------------------------
tracksom.result <- TrackSOM(inputFiles = data.files.fullpath,
colsToUse = c('x', 'y', 'z'),
tracking = TRUE,
noMerge = TRUE,
nClus = c(3,3,9,7,15),
dataFileType = ".csv"
)
## -----------------------------------------------------------------------------
data.files <- c(
system.file("extdata", "synthetic_d0.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d1.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d2.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d3.csv", package = "TrackSOM"),
system.file("extdata", "synthetic_d4.csv", package = "TrackSOM")
)
dat <- lapply(data.files, function(f) fread(f))
dat <- rbindlist(dat)
## -----------------------------------------------------------------------------
head(dat)
## -----------------------------------------------------------------------------
tail(dat)
## -----------------------------------------------------------------------------
dat.clust <- ConcatenateClusteringDetails(
tracksom.result = tracksom.result,
dat = dat,
timepoint.col = "timepoint",
timepoints = c('Mock', 'SYN-1', 'SYN-2', 'SYN-3', 'SYN-4')
)
## -----------------------------------------------------------------------------
head(dat.clust)
## -----------------------------------------------------------------------------
DrawNetworkPlot(dat = dat.clust,
timepoint.col = "timepoint",
timepoints = c('Mock', 'SYN-1', 'SYN-2', 'SYN-3', 'SYN-4'),
cluster.col = 'TrackSOM_metacluster_lineage_tracking',
marker.cols = c('x', 'y', 'z'))
## -----------------------------------------------------------------------------
list.files()
## -----------------------------------------------------------------------------
DrawTimeseriesHeatmap(dat = dat.clust,
timepoint.col = "timepoint",
timepoints = c('Mock', 'SYN-1', 'SYN-2', 'SYN-3', 'SYN-4'),
cluster.col = 'TrackSOM_metacluster_lineage_tracking',
marker.cols = c('x', 'y', 'z'))
## -----------------------------------------------------------------------------
list.files()