zji90 / TSCAN

TSCAN: Tools for Single-Cell ANalysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while running singlegeneplot

asgarhussain opened this issue · comments

I am getting following error when I try to run these commands
TPM4expr <- log2(son_data["TPM4",]+1)
singlegeneplot(TPM4expr, TSCANorder(lpsmclust,flip=TRUE,orderonly=FALSE))

Error in model.frame.default(formula = geneexpr ~ 1 + Pseudotime, data = exprdata, :
invalid type (list) for variable 'geneexpr'

Hi,
Please check whether TPM4expr is a numeric vector or not. It seems that it is a list or data.frame. You can use unlist(TPM4expr) to convert it into a vector.
Please follow the example on the manual page. Use str() to check whether the object is of desired type.

Hi,
I have exactly the same problem as here, I can just copy my script here:

library(TSCAN)

data <- read.csv("sce3.csv", row.names=1, header=T)

procdata <- preprocess(data)

------------------------------------------------------------------------

datamclust <- exprmclust(procdata)

------------------------------------------------------------------------

plotmclust(datamclust)

------------------------------------------------------------------------

dataorder <- TSCANorder(datamclust)
dataorder

------------------------------------------------------------------------

diffval <- difftest(procdata,dataorder)
#Selected differentially expressed genes under qvlue cutoff of 0.05
head(row.names(diffval)[diffval$qval < 0.05])

------------------------------------------------------------------------

Sox2expr <- log2(procdata["Sox2",]+1)

singlegeneplot(Sox2expr, TSCANorder(lpsmclust,flip=TRUE,orderonly=FALSE))

The error I have is:

Error in model.frame.default(formula = geneexpr ~ 1 + Pseudotime, data = exprdata, :

The same error.
Also, is there a way you can predefine or tell it which cell clusters are what?

Many thanks.

Hi,
Please check whether Sox2expr is a named numeric vector or not (names should correspond to the pseudotime ordering given by TSCANorder). It seems that it is a list or data.frame. You can use unlist(Sox2expr) to convert it into a vector.
Please follow the example on the manual page. Use str() to check whether the object is of desired type.

To replace the name of the clusters in singlegeneplot, you can do something like this:

order <- TSCANorder(lpsmclust,flip=TRUE,orderonly=FALSE)
order$State[order$State==1] <- 'cluster1'
order$State[order$State==2] <- 'cluster2'
order$State[order$State==3] <- 'cluster3'
.....
singlegeneplot(Sox2expr, order)

Hi,
Thanks a lot for the speedy response.
I can run the tutorial no prob. Its just when I try to do something with my own data. I cant get far. I am new to R and all. I can do somethings already. Just using my own data on packages is a bit slow.

Sox2 comes up on the diffval list and the full list of the procdata.

If i run

unlist(Sox2expr)

and then

Sox2expr <- log2(procdata["Sox2",]+1)
#i still have the same error....
singlegeneplot(Sox2expr, TSCANorder(lpsmclust,flip=TRUE,orderonly=FALSE))

if i do:

typeof(Sox2expr)
[1] "list"

It doesnt seem to unlist it. I cant find the function in the 2 manuals on the bioconductor website. If you can tell me, I can try it out here and then see if I can sort out my cell clusters.
Thanks alot

Hi,
You should do
Sox2expr <- log2(procdata["Sox2",]+1)
Sox2expr <- unlist(Sox2expr)
singlegeneplot(Sox2expr, TSCANorder(lpsmclust,flip=TRUE,orderonly=FALSE))

HI,
This works.
Thanks a lot.
I only have 2 states appearing with my data but should be 3-4.
I will try and adapt it and see how far I get.
Much appreciated for your help!