DavisLaboratory / singscore

An R/Bioconductor package that implements a single-sample molecular phenotyping approach
https://davislaboratory.github.io/singscore/
40 stars 5 forks source link

Error running generateNull function #34

Closed Dagsbio closed 1 year ago

Dagsbio commented 2 years ago

I get this error when running

permuteResult <- generateNull(rankData = ranked_cell_lines,upSet=patri_gene_sets)

image

Any ideas how to solve this?

bhuvad commented 2 years ago

Hi,

I apologise for the delayed response. The error is telling you that none of the genes in the gene-set match up with those from the expression data (rank matrix in your code). Please check the rownames of the ranked_cell_lines object and check whether the genes in patri_gene_sets) match up.

Cheers, Dharmesh

Isaacyz commented 2 years ago

HI I get the error, like this: Screen Shot 2022-06-11 at 6 26 55 pm ranks is file from rankGenes() with gene names in rows and sample as columns. "gl" is a geneset vector
Screen Shot 2022-06-11 at 6 31 09 pm and they r all in the row name of ranks file: Screen Shot 2022-06-11 at 6 32 14 pm How can I fix this error? Thx

Isaacyz commented 2 years ago

I just tried to convert ranks file from data.frame to "matrix" "array" which is the same table format in Ruqian Lyu's Singscore tutorial, but with such error: Screen Shot 2022-06-11 at 6 50 59 pm It's ok to run the generateNull() in Ruqian's tutorial not my own ranks file.

ruqianl commented 2 years ago

Hi @Isaacyz ,

Thanks for using our tool. Could you share the ranks data object (saved as .rd) file so I could run a bit of troubleshooting on my side?

Ruqian

Isaacyz commented 2 years ago

Hi Ruqian, Thanks that will be helpful! I here is the file ("rank_example.rda") which raise the same errors I list before if I run follow commands: """ library(singscore) library(GSEABase) gl <- c("GZMA","PRF1") gl <- GeneSet(gl) permuteResult <- generateNull( upSet = gl, rankData = temp_rank, subSamples = 1:2, B = 1000, ncores = 1, seed = 1) permuteResult <- generateNull( upSet = gl, rankData = as.matrix(temp_rank), subSamples = 1:2, B = 1000, ncores = 1, seed = 1) """

On Mon, 13 Jun 2022 at 12:43, ruqianl @.***> wrote:

Hi @Isaacyz https://github.com/Isaacyz ,

Thanks for using our tool. Could you share the ranks data object (saved as .rd) file so I could run a bit of troubleshooting on my side?

Ruqian

— Reply to this email directly, view it on GitHub https://github.com/DavisLaboratory/singscore/issues/34#issuecomment-1153402000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWXIWYXY6KJNLJ65JQTDOWDVO2N6JANCNFSM5M3VUEYA . You are receiving this because you were mentioned.Message ID: @.***>

ruqianl commented 2 years ago

Hi @Isaacyz ,

Thanks for sending over the data via email. I have had a brief look into the error you had. I see that your rank file was not by the function rankGenes() and it caused some input signature solving issues in the called functions.

To work around this here is what you could do:

temp_rank_m <- as.matrix(temp_rank)
attr(temp_rank_m,"stable") <- FALSE
permuteResult <-
  generateNull(
    upSet = gl,
    rankData = temp_rank_m,
    subSamples = 1:2,
    B = 1000,
    ncores = 1,
    seed = 1)
bhuvad commented 2 years ago

Hi @Isaacyz,

The solution that Ruqian has presented above will work but I would strongly advise against modifying the ranking matrix that is created by rankGenes() unless absolutely required. The boundary computation within singscore relies on ranks being computed as specified by rankGenes therefore post-hoc modification may result in scores that are outside the normal bounds of scores. If you had ideas on how you would alter ranks and what purpose such an alteration would serve, please let us know as it could help us improve the package.

Cheers, Dharmesh