Comments (5)
Seems like a bad idea but also something people would certainly use. I like the weighted average idea, something like
projectReducedDim <- function(old.points, new.points, old.embedding, k = 2) {
res <- queryKNN(X = old.points, query = new.points, k = k)
weight <- 1 / res$distance
weight <- weight / rowSums(weight)
new.embedding <- sapply(1:ncol(old.embedding), function(i) {
rowMeans(
sapply(1:ncol(res$index), function(j) {
old.embedding[res$index[, j], i] * weight[, j]
})
)
})
new.embedding
}
I realise there's surely a more elegant way to do the nested loops.
I could also wrap the snifter stuff into scater without a terrible amount of effort.
from scater.
Check out https://github.com/LTLA/batchelor/blob/master/R/utils_tricube.R for a tricube-weighted average based on the nearest neighbors. Watch out for problems with distances of zero if you're going to use inverse weights.
from scater.
Ooh, perfect. Might just :::
that unless that's deeply frowned on
from scater.
Probably best to just copy it over, avoid an explicit dependency on batchelor. It's not too large and it should be easy to drag across the few unit tests just in case.
from scater.
Resolved by commit(s) above but feel free to submit feedback/gripes here
from scater.
Related Issues (20)
- Issue with runTSNE and deprecated parameter, i.e. use_dimred? HOT 1
- Centering labels in plotReducedDim with force = 0 HOT 3
- Pass to num_jobs for snifter
- `plotDots` should document that `features=` can accept a factor to control the order HOT 6
- Handling genes with zero expression when using `scale = TRUE` in `plotDots()` HOT 3
- Use import or importFrom for `pheatmap` HOT 3
- can plotUMAP offer a order parameter HOT 6
- Create rasters for plots involving many, many points HOT 4
- Option not to plot the points in violin plots HOT 5
- fill_by for violin plots HOT 5
- plotGroupedHeatmap not colouring appropriately. HOT 1
- ggbeeswarm dependency HOT 1
- aes_string deprecation leads to incredibly hacky code HOT 4
- plotPCA not coloring points HOT 2
- Include colData in plotReducedDim ggplot object p$data? HOT 5
- Adding alias to exprs_values argument HOT 3
- Argument naming: "assay_name" (scater) vs. "assay.type" (scuttle) HOT 2
- Use scattermore to speed up plotColData and plotReducedDim for large datasets HOT 4
- Gene names in nmf basis HOT 2
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 scater.