Git Product home page Git Product logo

Comments (5)

kstreet13 avatar kstreet13 commented on July 21, 2024

Hey @kasumaz ,

It looks like something you're running is trying to convert the data into counts (hence round). Guessing from the name nsc_sce, that's the SingleCellExperiment object? The round function doesn't know how to handle that type of object, which I think is what's causing this error.

At this point in your analysis, is it important to keep a version of the data as counts? It might be easier to pull out the matrix of PCA/tSNE results and vector of cluster labels and run slingshot (or getLineages) directly on those. Otherwise, you could try rounding each element of the list in the assays slot, via something like:

assays(nsc_sce) <- lapply(assays(nsc_sce), round)

Hope that helps! Let me know if it doesn't work.

from slingshot.

kasumaz avatar kasumaz commented on July 21, 2024

Hi,
Thanks for replying back to me.
I could get back to slingshot. Would it be easier if I send you a subset matrix csv file of genes in rows and cells in columns as unnormalised data? Maybe in this way when you open slingshot in future in R, you can load it in and send me the start script and I can take it from there. It is always the input format i find tricky and thereafter I am usually okay. Just to maybe save us time going back and forth. I will do as you suggested and look around in the pdf/vignette files and I will let you know if I did achieve to run it so you dont loose time.
Thanks, Kaz

from slingshot.

kstreet13 avatar kstreet13 commented on July 21, 2024

Hey @kasumaz ,
If you are having trouble reading the data into R or making a SingleCellExperiment object, you may find this issue helpful: #33 . Otherwise, if you have a counts matrix in csv format already, you can read it in to R as a matrix and set up a SingleCellExperiment object via:

counts <- read.csv("counts.csv")
sce <- SingleCellExperiment(assays=list(counts=counts))

from slingshot.

kasumaz avatar kasumaz commented on July 21, 2024

Hi,
I wanted to try to do this myself and solve it. Some I could get going. But I think I have to resort back to help and make you loose time. Sorry.
It would be great if I could have the beginning of the script you used to test it out and I should be okay firing away with it.

That start of the script is:

sce <- SingleCellExperiment(assays=list(counts=counts))

sce <- SingleCellExperiment(assay=list(counts=as.matrix(counts))) #i think this way worked better

estimate simulation parameters

params <- splatEstimate(sce)

set path-related parameters

params <- setParams(params, update = list(batchCells = 200,
path.nonlinearProb = .5,
de.prob = .6, de.facLoc = 1,
de.facScale = 2))
library(splatter, quietly = TRUE)
data("splatterParameters")

library(slingshot, quietly = FALSE)
data("slingshotExample")

dim(rd) # data representing cells in a reduced dimensional space
length(cl) # vector of cluster labels

----genefilt--------------------------------------------------------------

filter genes down to potential cell-type markers

at least M (15) reads in at least N (15) cells

geneFilter <- apply(assays(sce)$counts,1,function(x){
sum(x >= 15) >= 15
})
sim <- sce[geneFilter, ]

FQnorm <- function(counts){
rk <- apply(counts,2,rank,ties.method='min')
counts.sort <- apply(counts,2,sort)
refdist <- apply(counts.sort,1,median)
norm <- apply(rk,2,function(r){ refdist[r] })
rownames(norm) <- rownames(counts)
return(norm)
}
assays(sim)$norm <- FQnorm(assays(sim)$counts)

----pca, cache=TRUE-------------------------------------------------------

pca <- prcomp(t(log1p(assays(sim)$norm)), scale. = FALSE)
rd1 <- pca$x[,1:2]

plot(rd1, col = topo.colors(100)[sim$Step], pch=16, asp = 1)

----dm, cache=TRUE--------------------------------------------------------

library(destiny, quietly = TRUE)
dm <- DiffusionMap(t(log1p(assays(sim)$norm)))
rd2 <- cbind(DC1 = dm$DC1, DC2 = dm$DC2)

plot(rd2, col = topo.colors(100)[sim$Step], pch=16, asp = 1)

This last bit for diffusion map doesnt work. Some of the other parts in the original tutorial script seem to work but probably would work better if the data is set up correctly.

I have 7 different cell types
OLqNSCI
OLqNSCII
OLpNSC
OLaNSC
OLTAP
OPC
MOL (final cell type)
I have them as for example MOL_1, MOL_2, MOL_3, MOL_4, etc for all of them. I think this has to be specified somewhere. Maybe the set up of the sce object.
I attach the csv here.
I will figure it out and having it up and running.
Thank you so very much!

Counts.csv.zip

from slingshot.

kstreet13 avatar kstreet13 commented on July 21, 2024

Hey @kasumaz ,
I'm sorry, but I don't understand what you're trying to do here. Originally you said you were having issues getting your data into a SingleCellExperiment object, but now you seem to be trying to create a simulated dataset?
If you want to include cell type labels (or any other sample-level data), you can format it as a data.frame and include it as colData:

sce <- SingleCellExperiment(assays=list(counts=counts), colData=cell_type)

I'm closing this issue, since this does not seem to be related to any slingshot functionality.

from slingshot.

Related Issues (20)

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.