...
|
...
|
@@ -132,9 +132,6 @@ changeMaxPostCutoff.multivariate <- function(model, maxPost.cutoff, invert=FALSE
|
132
|
132
|
|
133
|
133
|
} else if (is(model, class.combined.multivariate.hmm)) {
|
134
|
134
|
ptm <- startTimedMessage("Calculating states from maximum-posterior in each peak ...")
|
135
|
|
- mapping.df <- stateBrewer(model$info[,setdiff(names(model$info), 'ID')], mode='full')
|
136
|
|
- mapping <- mapping.df$combination
|
137
|
|
- names(mapping) <- mapping.df$state
|
138
|
135
|
if (is.null(model$bins$maxPostInPeak)) {
|
139
|
136
|
p <- getMaxPostInPeaks(model$bins$state, model$bins$posteriors)
|
140
|
137
|
} else {
|
...
|
...
|
@@ -148,7 +145,12 @@ changeMaxPostCutoff.multivariate <- function(model, maxPost.cutoff, invert=FALSE
|
148
|
145
|
p.thresholded[,icol] <- p[,icol] < threshold[icol] & p[,icol] > 0
|
149
|
146
|
}
|
150
|
147
|
}
|
151
|
|
- states <- factor(bin2dec(p.thresholded), levels=mapping.df$state)
|
|
148
|
+ decstates <- bin2dec(p.thresholded)
|
|
149
|
+ binary.matrix <- p.thresholded[!duplicated(decstates),]
|
|
150
|
+ mapping.df <- stateBrewer(model$info[,setdiff(names(model$info), 'ID')], mode='full')
|
|
151
|
+ mapping <- mapping.df$combination
|
|
152
|
+ names(mapping) <- mapping.df$state
|
|
153
|
+ states <- factor(decstates, levels=mapping.df$state)
|
152
|
154
|
stopTimedMessage(ptm)
|
153
|
155
|
## Make fake multiHMM to do the segmentation with "combineMultivariates"
|
154
|
156
|
multiHMM <- list()
|
...
|
...
|
@@ -379,15 +381,17 @@ changePostCutoff.multivariate <- function(model, post.cutoff) {
|
379
|
381
|
stopTimedMessage(ptm)
|
380
|
382
|
} else if (is(model, class.combined.multivariate.hmm)) {
|
381
|
383
|
ptm <- startTimedMessage("Calculating states from posteriors ...")
|
382
|
|
- mapping.df <- stateBrewer(model$info[,setdiff(names(model$info), 'ID')], mode='full')
|
383
|
|
- mapping <- mapping.df$combination
|
384
|
|
- names(mapping) <- mapping.df$state
|
385
|
384
|
post <- model$bins$posteriors
|
386
|
385
|
post.thresholded <- matrix(FALSE, ncol=ncol(post), nrow=nrow(post))
|
387
|
386
|
for (icol in 1:ncol(post)) {
|
388
|
387
|
post.thresholded[,icol] <- post[,icol] >= threshold[icol]
|
389
|
388
|
}
|
390
|
|
- states <- factor(bin2dec(post.thresholded), levels=mapping.df$state)
|
|
389
|
+ decstates <- bin2dec(post.thresholded)
|
|
390
|
+ binary.matrix <- post.thresholded[!duplicated(decstates),]
|
|
391
|
+ mapping.df <- stateBrewer(model$info[,setdiff(names(model$info), 'ID')], mode='full', binary.matrix = binary.matrix)
|
|
392
|
+ mapping <- mapping.df$combination
|
|
393
|
+ names(mapping) <- mapping.df$state
|
|
394
|
+ states <- factor(decstates, levels=mapping.df$state)
|
391
|
395
|
stopTimedMessage(ptm)
|
392
|
396
|
## Make fake multiHMM
|
393
|
397
|
multiHMM <- list()
|