nanostring-biostats / insitucor Goto Github PK
View Code? Open in Web Editor NEWInSituCor An R package for discovering modules of spatially correlated genes in spatial transcriptomics data.
License: Other
InSituCor An R package for discovering modules of spatially correlated genes in spatial transcriptomics data.
License: Other
use withr::with_seed()
Specifically, environment scores seem to have contributions from multiple tissues.
remove it, and don't print out the message it currently gives in the attribution analysis
in build_conditionon_matrix
This vignette demonstrates the functionality of InSituCor using a precompiled example dataset. InSituCor can be run using the outputs of the FlatFiles export module [link?], specifically the counts file (_exprMat_file.csv) and the metadata file (_metadata_file.csv). To replicate the vignette with the flat files, the following steps should be followed:
#Load flat files
metadata <- read.csv("S0_metadata_file.csv")
counts <- read.csv("S0_exprMat_file.csv")
#prepare counts file
rownames(counts) <- counts$cell
counts <- counts[,-c(1,2,3)] #remove metadata columns
counts <- as.matrix(counts)
#prepare metadata
metadata$celltype <- metadata$RNA_nbclust_*_clusters #cell type column name will be long
conditionon <- metadata[, c("cell","celltype")]
rownames(conditionon) <- metadata$cell
conditionon$cell <- NULL
#prepare xy data
xy <- annot[,c("cell", "x", "y")] #the x and y coordinates
#cell type data
Celltype <- annot$celltype
Attribution analysis errors when there's only one module. Probably a matrix has been reduced to a vector due to a lack of a drop = FALSE
argument.
Fix: put in a sensible error message that advises a higher "res" parameter
I was able to run through sparc
where the cell_IDs in counts and the cell_IDs in conditionon were mismatched.
I think there should be a requirement to check this if the rownames are provided.
Its an easy mistake to make, especially if your 'conditionon' dataframe is reordered after a merge.
use_cells <- met[grep("neuron|L", cell_type),cell_ID]
resmismatch_cell_ID <-
SPARC::sparc(counts = Matrix::t(normed)[sample(use_cells),] ## counts have out of order cell ids
,conditionon = data.frame(met[match(use_cells,cell_ID)
,.(cell_type = as.character(cell_type)
,nCount_falsecode
,nCount_negprobes
,nCount_RNA)]
,row.names = use_cells
)
,celltype = as.character(met[match(use_cells,cell_ID)][["cell_type"]])
,neighbors = NULL
,radius = 0.1
,xy=as.matrix(met[match(use_cells,cell_ID)][,.(sdimx,sdimy)]
,rownames = use_cells)
)
Add to readme
Many of the current vignette args aren't the recommended setting, so they can suggest the wrong approach to people.
A module had the probe for "HBA/HBB" in its name. Then attempts to print spatial plot .pngs with this name in the title errored, thinking the "/" was a new path.
Solution: module names should go through make.names()
1: an error that was fixed by forcing the conditionon argument to be a data frame, not a data table:
Error in [.data.table
(df, , i) :
j (the 2nd argument inside [...]) is a single symbol but column name 'i' is not found. Perhaps you intended DT[, ..i]. This difference to data.frame is deliberate and explained in FAQ 1.1.
2: "Error in solve.default(cov_bb): system is computationally singluar."
... the matrix coming out of the build_conditionon function had an eigenvalue ~= 0. This shouldn't be happening. The existing countermeasures must not have caught an edge case. Unclear what the edge case is.
(Using bigger neighborhoods, from radius = 0.1 to K = 50, solved this.)
Warning about misaligned row names: part comes as a warning, the rest as a message. Make into one warning.
The vignette used a radius-based default - change it to K-nearest?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.