Closed Chengwei94 closed 2 years ago
Hi @Chengwei94,
I noticed that you are working with mouse data, and currently, LIANA does not provide mouse interactions as resource, however it's something that others have requested and I'm working on it. If you give me a couple of days, I could come back to you with a temporary solution that you could use to run LIANA on mouse data.
Also, the issue that you are seeing occurs only /w the CellChat method - I am also working to address this.
Hi @dbdimitrov,
noted, thanks for the quick reply
Hi,
As a quick temporary solution for mouse data, I suggest using the following code:
require(liana)
require(tidyverse)
require(magrittr)
require("biomaRt")
#' Basic function to convert human to mouse genesymbols (temporary solution)
#' @param op_resource omnipath_resource as obtained via `liana::select_resource`
#'
#' @details adapted from https://www.r-bloggers.com/2016/10/converting-mouse-to-human-gene-names-with-biomart-package/
convert_to_murine <- function(op_resource){
# query biomaRt databases
human <- useMart("ensembl", dataset = "hsapiens_gene_ensembl")
mouse <- useMart("ensembl", dataset = "mmusculus_gene_ensembl")
# obtain tibble with human and murine genesymbol
symbols_tibble <- getLDS(attributes = c("hgnc_symbol"),
filters = "hgnc_symbol",
values = union(op_resource$source_genesymbol,
op_resource$target_genesymbol),
mart = human,
martL = mouse,
attributesL = c("mgi_symbol")) %>%
dplyr::rename(human_symbol = HGNC.symbol,
murine_symbol = MGI.symbol) %>%
as_tibble()
# intentionally we introduce duplicates, if needed
# these should be resolved when LIANA is called
# as inappropriately matched genes will not be assigned any values
op_resource %>%
left_join(symbols_tibble, by=c("target_genesymbol"="human_symbol")) %>%
mutate(target_genesymbol = murine_symbol, .keep = "unused") %>%
left_join(symbols_tibble, by=c("source_genesymbol"="human_symbol")) %>%
mutate(source_genesymbol = murine_symbol, .keep = "unused") %>%
filter(!is.na(target_genesymbol) | !is.na(source_genesymbol)) %>%
filter(!is.na(target_genesymbol)) %>%
filter(!is.na(source_genesymbol))
}
seurat_object <- readRDS("~/Downloads/ss_liana.rds") %>%
Seurat::NormalizeData()
op_resource <- select_resource("OmniPath")[[1]] %>%
convert_to_murine()
liana_res <- liana_wrap(seurat_object,
cellchat.params=list(organism="mouse"),
resource = "custom",
external_resource = op_resource)
# squidpy sets gene names to upper (in the processing), revert this to title (i.e. murine)
liana_res$squidpy %<>%
mutate_at(.vars = c("ligand", "receptor"), str_to_title)
liana_res %<>% liana_aggregate
However, it's worth mentioning that here we're simply converting from the human OmniPath, which might not always be an exact match to murine symbols or existing interactions. We are working to address this and extend LIANA in this direction, but this might take some time.
I hope this helps.
Best wishes, Daniel
Hello @Chengwei94
I had a similar task and I solved it by converting my murine Seurat dataset's genes to human orthologs using a .csv I generated, similar to what @dbdimitrov did. However, instead of converting OmniPath, I converted both the 'counts' and 'data' slots of my Seurat's 'RNA' assay to make it work. You might need to wrangle the data a bit - specifically get rid of duplicates and other potentially confounding names.
ss_liana.zip
I cant make liana work my Seurat Dataset. I have attached one downsampled example as attached. The error when working with cellphoneDB come out Error:
cols
must select at least one column.When working with cellchat, the error comes out as Error: Please check
object@data.signaling
and ensure that you have runsubsetData
and that the data matrixobject@data.signaling
looks OK.I have no issue when working with the testdata provided