GithubHelp home page GithubHelp logo

Comments (5)

dgrun avatar dgrun commented on July 18, 2024 1

Hi,

there is no function for direct import. All you need is a raw count matrix x and a target cluster partition.

You can retrieve the cluster partition, i.e., y from a Seurat object (sc):

y <- as.numeric([email protected]$seurat_clusters)
names(y) <- rownames([email protected])

You can then subset the raw count matrix:
x <- x[,names(y)]

v is just a filtered expression matrix. You can filter out lowly expressed genes and/or only keep highly variable genes, e.g. v <- x[sc@assays$[email protected],]

You can reclassify with the filtered v or the full x. I would only use the getFeat function if you work with the full matrix x.

Regarding your error message: For some reason your cluster partition seems to contain only a single class. Perhaps this has happened during the reclassification? Maybe you should skip this reclassification.

I hope it will work now.

from fateid.

s849 avatar s849 commented on July 18, 2024 1

Hi Dominic,

Thanks for your follow up message. I was able to run FateID using the following commands and without running the reclassifier:

x <- as.matrix(object@assays$RNA@counts)

y <- as.numeric([email protected]$seurat_clusters)
names(y) <- rownames([email protected])

x <- x[,names(y)]

tar <- c(6,5)
fb <- fateBias(x, y, tar, z=NULL, minnr=5, minnrh=10, adapt=TRUE, confidence=0.75, nbfactor=5, use.dist=FALSE, seed=12345, nbtree=NULL)

dr <- compdr(x, z=NULL, m=c("tsne","cmd","dm","lle","umap"), k=c(2,3), lle.n=30, dm.sigma="local", dm.distance="euclidean", tsne.perplexity=30, seed=12345)

plotFateMap(y,dr,k=2,m="tsne")
plotFateMap(y,dr,k=3,m="tsne")

Does this seem correct?
I was also wondering whether I can project the cell fate bias in the embedding I already have from Seurat instead of creating a new one as it is done with the code I provided above?

Please let me know your thoughts.

Thanks!

from fateid.

s849 avatar s849 commented on July 18, 2024

Hi,

Thanks for your response. I am still having problems and ran into two errors. Please see below for my example code;

x <- as.matrix(object@assays$RNA@counts)
head(x[,1:5])

y <- as.numeric([email protected]$seurat_clusters)
names(y) <- rownames([email protected])

x <- x[,names(y)]

tar <- c(6)

FMarker <- list(c("Mki67","Top2a"), "Cenpa", "Pttg1")
xf <- getPart(x,FMarker,fthr=NULL,n=5)
head(xf$part)

tar <- xf$tar
y <- xf$part

rc <- reclassify(x, y, tar, clthr=.75, nbfactor=5, use.dist=FALSE, seed=12345, nbtree=NULL, q=0.9)
y <- rc$part

v <- x[object@assays$[email protected],]
v

x <- rc$xf
x
x <- getFeat(v,y,tar,fpv=0.01) ##Get error #1
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases

tar <- c(6)
fb <- fateBias(x, y, tar, z=NULL, minnr=5, minnrh=10, adapt=TRUE, confidence=0.75, nbfactor=5, use.dist=FALSE, seed=12345, nbtree=NULL) ##Get error #2
minnr: 5
minnrh: 10
test set size iteration 1 : 5
randomforest iteration 1 of 5 cells
Error in apply(probs[trt, ], 1, function(x, y) y[which(x == max(x))][1], :
dim(X) must have a positive length

Any advice will be much appreciated. Thanks!

from fateid.

dgrun avatar dgrun commented on July 18, 2024

Hi,

error #1 I cannot explain. Are there NA's in your count table?
Error #2 occurs because your are providing only a single target cluster (6). You need at least two target clusters. Otherwise, the fate bias should anyway be equal to 1 for every cell. If you want me to look into the first error feel free to send me a link to your Seurat object (you can randomise the gene names to not reveal any essential info) by email ([email protected]).

Best,
Dominic

from fateid.

dgrun avatar dgrun commented on July 18, 2024

Hi,

the code seems correct to me.

You can simply overwrite entries of dr with Seurat embeddings, e.g., if "object" is your Seurat object

dr$umap$D2 <- as.data.frame(object@reductions$[email protected][rownames(dr$umap$D2),])

from fateid.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.