cozygene / bisque

An R toolkit for estimation of cell composition from bulk expression data
68 stars 20 forks source link

MarkerBasedDecomposition overlapping genes error #38

Open nikita-telkar opened 1 year ago

nikita-telkar commented 1 year ago

Hello,

I'm trying to run the MarkerBasedDecomposition function, but I keep getting the error: Error in MarkerBasedDecomposition(eNorm_bulk, cell_markers, weighted = F) : No overlapping genes between markers and bulk.eset

I've throughly checked the al genes within cell_markers are present in the bulk expression matrix, and are in the same order.

My cell_markers dataframe image

My bulk expression matrix (from an ExpressionSet assay, stored under eNorm_bulk@assayData[["exprs"]] ) image

I'm not sure how to proceed.

Thank you!

brandonjew commented 1 year ago

Hi @nikita-telkar,

Thank you for your interest in our method! That is odd, from what I can see in the dataframe screenshots, that error should not occur. Gene ordering does not matter either. The check for that error is running the following code and throws this error if the intersect length is zero:

# Remove any marker genes that show up more than once
markers <- GetUniqueMarkers(markers, gene_col=gene_col)

intersect(unique(markers[,gene_col]), rownames(bulk.eset))

This error could be occurring due to the first line if all the genes show up more than once in the markers dataframe. If this is not the case, you can try checking what the output of the second line is. Things like trailing whitespaces can make the intersection empty.

Thanks, Brandon

nikita-telkar commented 1 year ago

Hi @brandonjew ,

Thank you for replying!

Yes, that's what I tried next:

# getting the function from the source page

GetUniqueMarkers <- function(x, gene_col="gene"){
keep <- ! (duplicated(x[,gene_col], fromLast = FALSE) |
duplicated(x[,gene_col], fromLast = TRUE) )
return(x[keep,])
}

Output: None of the genes were removed, but the list is empty

image I then tried to match the rownames to the marker names, but I guess that that internally the function transposes the matrix

image

To ensure that the gene names do actually match, I transposed the bulk matrix (converting genes to column and rows to samples), and the gene names do match

image

brandonjew commented 1 year ago

Looks like rownames(eNorm_bulk) is not returning the expected list of gene names. Can you check what that function returns?