Comments (2)
fixed the issue after debugging through the source code (application_visualization.R). Also detected additional bugs!
Line 826, apply(GetAssayData(seuratObj_subset[, seuratObj_subset[[celltype_col]] == celltype], slot = slot), 1, func.agg)
for Seurat5, use:
apply(GetAssayData(seuratObj_subset[, seuratObj_subset[[celltype_col]] == celltype], layer = "counts"), 1, func.agg)
Line 831, set_rownames(ligands). This line needs to be deleted.
the data frame resulting from Line 830 already has ligand as rownames, whose order is actually DIFFERENT from the vector ligands
Line 844, data.frame(ligand_type = sender, ligand = unique_ligands_sender)
When unique_ligands_sender returns an empty character, this will create the error:
Error in data.frame(ligand_type = sender, ligand = unique_ligands_sender) :
arguments imply differing number of rows: 1, 0
A conditional flow in the following will mitigate such error
if (length(unique_ligands_sender) > 0) { return(data.frame(ligand_type = sender, ligand = unique_ligands_sender)) }
from nichenetr.
Hi @shawnshu1,
Thank you for noticing the bugs and providing a solution. Apologies for taking some time to get around to this.
In the pull request, I have incorporated your condition statement and removed the set_rownames
line. Additionally, I added the ...
argument to allow users to provide either the 'slot' or 'layer' argument depending on their Seurat version.
I looked into the names mismatch, and it seems to be due to the different behavior of subset
with v5 objects. Prior to v5, the row names of the subsetted Seurat object will follow the order of the provided vector. In v5, the Seurat object retains its original order. Example:
# Load test object
seurat_obj_test <- readRDS(url("https://zenodo.org/record/3531889/files/seuratObj_test.rds"))
# Update object, but underlying structure is still that of v3
seurat_obj_test <- UpdateSeuratObject(seurat_obj_test)
# Randomly get 20 genes from the object
random_ligands <- sample(rownames(seurat_obj_test), 20)
# This returns TRUE
all(rownames(subset(seurat_obj_test, features = random_ligands)) == random_ligands)
# Create new v5 object
seurat_obj_test_v5 <- CreateSeuratObject(counts = seurat_obj_test@assays$RNA@counts)
# This returns FALSE
all(rownames(subset(seurat_obj_test_v5, features = random_ligands)) == random_ligands)
I was not aware of this until now, and I will proceed to check other subset
calls we make in our package. We really appreciate your help!
This issue will automatically be closed once I merge the PR, but feel free to reopen this should you still encounter bugs.
from nichenetr.
Related Issues (20)
- Identifying bonafide ligand-receptor pairs in the updated ligand-receptor database (V2)
- SeuratV5 HOT 4
- Error finding log fold change information of ligands from sender cells (Seurat V5 object) HOT 6
- How exactly the ligand activity were calculate? HOT 1
- I cannot run the "get_weighted_ligand_receptor_links" and "prepare_ligand_receptor_visualization" while I have nichnetr installed HOT 2
- Preferable metric to infer cell-to-cell communication HOT 1
- what is ligand_tf_matrix for?? HOT 1
- `get_exprs_avg` changes underscore to hyphen in cell type names
- How to choose the best ligand to continue analysis with the potential ligand?
- How should I assign a pathway/pathways to the target genes when running nichenetr? HOT 3
- missing function for circos plot visualization HOT 2
- I can't install nichenet HOT 1
- Condition_colname is not used for subsetting in nichenet_seuratobj_aggregate HOT 2
- `make_line_plot` bugs
- `assign_ligands_to_celltype` bug when there are no general ligands
- Error in `generate_info_tables`
- Warning message in `predict_ligand_activities`
- `generate_prioritization_tables` warnings and documentation
- Error when passing the recorrect_umi argument in get_lfc_celltype
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nichenetr.