Skip to content

Set data method does support only TRUE/FALSE annotations with list of names provided #33

@denklewer

Description

@denklewer

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

image

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

Expected picture is
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions