cole-trapnell-lab / monocle-release

280 stars 116 forks source link

plot_genes_branched_pseudotime and beam not working #472

Open joelma1 opened 2 years ago

joelma1 commented 2 years ago

when I run: plot_genes_branched_pseudotime(cds[my_pseudotime_gene,], branch_point = 1, color_by = "celltype")

I get: Warning in class(cellData) != "matrix" && isSparseMatrix(cellData) == FALSE : 'length(x) = 2 > 1' in coercion to 'logical(1)' Error in if (isSparseMatrix(exprs(X))) { : the condition has length > 1

Similarly when I run: BEAM_res <- BEAM(cds[expressed_genes,], branch_point = 1, cores = 1)

I get: Error in if (progenitor_method == "duplicate") { : the condition has length > 1

So far, all the other functions work. I can see that I have one branch in my trajectory. Thanks.

ayueme commented 2 years ago

I have the same BEAM error. Have you solved this problem?

LYNLLL commented 2 years ago

So am I.I have got this problem after update some packages.

zy-fang commented 2 years ago

I have met the same issues. I modified the source code of the package on the basis of the other issue's solution.

We need to edit to update the package by following another issue.

There are three pieces of code that need to be updated.

First, change the code of monocle/R/order_cell.R in function project2MST() from if(class(projection) != 'matrix') projection <- as.matrix(projection) to projection <- as.matrix(projection)

Second, modified the code of / monocle/R /BEAM.R from:

if (progenitor_method == "duplicate") { }
else if (progenitor_method == "sequential_split") { }

to:

if ('duplicate' %in% progenitor_method){}
else if('sequential_split' %in% progenitor_method){}

Third, modified the code of / monocle/R /utils.R from: class(x) %in% c("dgCMatrix", "dgTMatrix") to: any(class(x) %in% c("dgCMatrix", "dgTMatrix"))

SuqinYang commented 2 years ago

Hi,@zy-fang Sorry to trouble you. I have the same problem: p1=plot_genes_branched_heatmap(HSMM[row.names(subset(BEAM_res_1, qval < 1e-4)),], branch_point = 2, num_clusters = 4, cores = 2, use_gene_short_name = T, show_rownames = F)

I get: Warning messages: 1: In class(cellData) != "matrix" && isSparseMatrix(cellData) == FALSE : 'length(x) = 2 > 1' in coercion to 'logical(1)' 2: closing unused connection 4 (<-DESKTOP-EDG51VM:11955) 3: closing unused connection 3 (<-DESKTOP-EDG51VM:11955)

The heatmap can be drawn, but the "p1" returns NULL. I tried the method you provided, but there is still warning.I want to extract the genes in the heatmap for enrichment analysis, but "p1" keeps returning NULL, what should I do?

zy-fang commented 2 years ago

We need to set the parameter ”return_heatmap = TRUE“

ruchikabhat commented 1 year ago

Hi,

I solved using the method given by @zy-fang. Thanks for the help. However just after the ordercell I had to run plot_cell_trajectory(cds_subset)

which gave me the following error:

rror in .standalone_types_check_dot_call(ffi_standalone_check_number_1.0.7, : object 'ffi_standalone_check_number_1.0.7' not found

Any help is highly appreciated.

Many thanks!

howtofindme commented 1 year ago

Hi,@zy-fang Sorry to trouble you. I have the same problem: p1=plot_genes_branched_heatmap(HSMM[row.names(subset(BEAM_res_1, qval < 1e-4)),], branch_point = 2, num_clusters = 4, cores = 2, use_gene_short_name = T, show_rownames = F)

I get: Warning messages: 1: In class(cellData) != "matrix" && isSparseMatrix(cellData) == FALSE : 'length(x) = 2 > 1' in coercion to 'logical(1)' 2: closing unused connection 4 (<-DESKTOP-EDG51VM:11955) 3: closing unused connection 3 (<-DESKTOP-EDG51VM:11955)

The heatmap can be drawn, but the "p1" returns NULL. I tried the method you provided, but there is still warning.I want to extract the genes in the heatmap for enrichment analysis, but "p1" keeps returning NULL, what should I do?

Hi, I just met the same problem:"p1" returns NULL..Have you solved this problem? thanks

willow0077 commented 1 week ago

Hi,@zy-fang Sorry to trouble you. I have the same problem: p1=plot_genes_branched_heatmap(HSMM[row.names(subset(BEAM_res_1, qval < 1e-4)),], branch_point = 2, num_clusters = 4, cores = 2, use_gene_short_name = T, show_rownames = F) I get: Warning messages: 1: In class(cellData) != "matrix" && isSparseMatrix(cellData) == FALSE : 'length(x) = 2 > 1' in coercion to 'logical(1)' 2: closing unused connection 4 (<-DESKTOP-EDG51VM:11955) 3: closing unused connection 3 (<-DESKTOP-EDG51VM:11955) The heatmap can be drawn, but the "p1" returns NULL. I tried the method you provided, but there is still warning.I want to extract the genes in the heatmap for enrichment analysis, but "p1" keeps returning NULL, what should I do?

Hi, I just met the same problem:"p1" returns NULL..Have you solved this problem? thanks

You need to add parameter "return_heatmap = T", and then p returns a plot. p <- plot_pseudotime_heatmap(cds[rownames(diff_test_res),], num_clusters = 4, cores = 8, show_rownames = T, hmcols = colorRampPalette(viridis(4))(1000), return_heatmap = T)