library('data.table')
library('ggplot2')
library('simphony')
= data.table(amp = c(0, 3, 6), phase = c(0, 0, 6),
featureGroups rhyFunc = c(cos, cos, sin), fracFeatures = c(0.1, 0.8, 0.1))
= simphony(featureGroups)
simData
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata, times = seq(0, 48, 0.25))
expectedTrend = c('feature_01', 'feature_05', 'feature_10')
plotFeatures
ggplot() +
facet_wrap(~ feature) +
geom_line(data = expectedTrend[feature %in% plotFeatures], aes(x = time, y = mu)) +
geom_point(data = mergedData[feature %in% plotFeatures], aes(x = time, y = abund)) +
scale_x_continuous(breaks = seq(0, 48, 8)) +
labs(x = 'Time (h)', y = 'Abundance')
ggplot() +
geom_point(data = simData$featureMetadata, aes(x = factor(amp0), y = factor(feature))) +
labs(x = 'Amplitude', y = 'Feature')
= data.table(amp = 6, phase = -3, rhyFunc = function(x) sign(sin(x)))
featureGroups
= simphony(featureGroups)
simData
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata, times = seq(0, 48, 0.1))
expectedTrend
ggplot() +
geom_line(data = expectedTrend[feature %in% plotFeatures], aes(x = time, y = mu)) +
geom_point(data = mergedData[feature %in% plotFeatures], aes(x = time, y = abund)) +
scale_x_continuous(breaks = seq(0, 48, 8)) +
labs(x = 'Time (h)', y = 'Abundance')
= data.table(amp = c(0, 3))
featureGroups
= simphony(featureGroups, timepointsType = 'specified', nFeatures = nrow(featureGroups),
simData timepoints = c(seq(0, 22, 2), seq(24, 42, 6)))
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata, times = seq(0, 48, 0.25))
expectedTrend
ggplot() +
facet_wrap(~ feature) +
geom_line(data = expectedTrend, aes(x = time, y = mu)) +
geom_point(data = mergedData, aes(x = time, y = abund)) +
scale_x_continuous(breaks = seq(0, 48, 8)) +
labs(x = 'Time (h)', y = 'Abundance')
= data.table(amp = c(0, 3))
featureGroups
= simphony(featureGroups, timepointsType = 'random', nFeatures = nrow(featureGroups),
simData timeRange = c(0, 24), nSamplesPerCond = 20)
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata, times = seq(0, 24, 0.25))
expectedTrend
ggplot() +
facet_wrap(~ feature) +
geom_line(data = expectedTrend, aes(x = time, y = mu)) +
geom_point(data = mergedData, aes(x = time, y = abund)) +
scale_x_continuous(breaks = seq(0, 24, 4)) +
labs(x = 'Time (h)', y = 'Abundance')
= data.table(amp = c(function(tt) 3, function(tt) 3 * 2 ^ (-tt / 24)),
featureGroups base = c(function(tt) tt / 12, function(tt) 0))
= simphony(featureGroups, nFeatures = nrow(featureGroups))
simData
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata, times = seq(0, 48, 0.25))
expectedTrend
ggplot() +
facet_wrap(~ feature) +
geom_line(data = expectedTrend, aes(x = time, y = mu)) +
geom_point(data = mergedData, aes(x = time, y = abund)) +
scale_x_continuous(breaks = seq(0, 48, 8)) +
labs(x = 'Time (h)', y = 'Abundance')
= list(
featureGroupsList data.table(amp = c(1, 2, 2), phase = c(0, -3, 0), period = c(24, 24, 22)),
data.table(amp = c(3, 2, 2), phase = c(0, 3, 0), period = c(24, 24, 26)))
= simphony(featureGroupsList, nFeatures = nrow(featureGroupsList[[1]]))
simData
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata, times = seq(0, 48, 0.25))
expectedTrend
ggplot() +
facet_grid(cond ~ feature) +
geom_line(data = expectedTrend, aes(x = time, y = mu)) +
geom_point(data = mergedData, aes(x = time, y = abund), size = 0.5) +
scale_x_continuous(breaks = seq(0, 48, 8)) +
labs(x = 'Time (h)', y = 'Abundance')
= data.table(amp = 3, base = c(4, 6, 8))
featureGroups = function(x) 3 * defaultDispFunc(x)
dispFunc
= simphony(featureGroups, interval = 4, nFeatures = nrow(featureGroups),
simData family = 'negbinom', dispFunc = dispFunc)
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata, times = seq(0, 48, 0.25))
expectedTrend
ggplot(expectedTrend) +
facet_wrap(. ~ factor(base0)) +
geom_line(data = expectedTrend, aes(x = time, y = mu)) +
geom_point(data = mergedData, aes(x = time, y = log2(abund + 1))) +
scale_x_continuous(breaks = seq(0, 48, 8)) +
labs(x = 'Time (h)', y = expression(log[2] * '(abundance + 1)'))
= data.table(amp = 1, base = 0,
featureGroups rhyFunc = function(x) ifelse(x %% (2 * pi) < pi, 0.5, 4))
= simphony(featureGroups, timeRange = c(0, 24 * 4), interval = 0.1,
simData nReps = 1, nFeatures = 1, family = 'poisson')
= mergeSimData(simData)
mergedData = getExpectedAbund(simData$featureMetadata,
expectedTrend sampleMetadata = simData$sampleMetadata)
ggplot() +
geom_line(data = expectedTrend, aes(x = time, y = mu)) +
geom_point(data = mergedData, aes(x = time, y = abund), shape = 21, size = 1) +
scale_x_continuous(breaks = seq(0, 24 * 4, 12)) +
labs(x = 'Time (h)', y = 'Abundance')