-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Current version does not support sample annotations with other values than boolean.
The code
H <- matrix(runif(K * N, min = 0, max = 1), nrow = K )
W <- t(matrix(runif(K * M, min = 0, max = 10), nrow = K ) )
rownames(W) <- paste("gene", c(1:dim(W)[[1]]))
colnames(H) <- paste( "sample", c(1:dim(H)[[2]]))
# specify pure samples
H[,1] <- c(1, 0, 0, 0)
H[,2] <- c(0, 1, 0, 0)
H[,3] <- c(0, 0, 1, 0)
H[,4] <- c(0, 0, 1, 0)
H[,5] <- c(0.2, 0.3, 0.2, 0.3)
V <- W %*% H
sample_annotation <- list(
sample_name = colnames(V),
proportions = unlist(lapply(colnames(H), function(sample_name) {
return(paste((round(100*H[, sample_name]/sum(H[, sample_name]), digits=0)), collapse="|" ))
})),
original_corner = unlist(lapply(colnames(H), function(sample_name) {
sum((H[, sample_name]/sum(H[, sample_name])) == 1) == 1}))
)
dso <- DualSimplexSolver$new()
dso$set_data(V, sinkhorn_iterations = 20, sample_anno_lists = sample_annotation)
will cast all annotations provided to TRUE/FALSE
The workaround is to set it afterwards manually.
sample_annotation <- as.data.frame(sample_annotation)
current_anno <- pData(dso$get_data())
current_anno[,colnames(sample_annotation)] <- sample_annotation
dso$st$data <- set_anno(anno=current_anno, eset=dso$get_data(), genes = F)
However it would be great to have the ability to provide it in advance
Metadata
Metadata
Assignees
Labels
No labels