问题
I would like to use code similar to the code just below that works for the lung dataset in the package Monocle:
options(stringsAsFactors = FALSE)
library("monocle")
lung <- load_lung()
diff_test_res <- differentialGeneTest(
lung,
fullModelFormulaStr = "~genotype"
)
ordering_genes <- diff_test_res[diff_test_res$qval < 0.01, "gene_id"]
lung <- setOrderingFilter(lung, ordering_genes)
plot_ordering_genes(lung)
lung <- reduceDimension(
lung,
max_components = 2,
method = 'DDRTree'
)
lung <- orderCells(lung)
p = plot_genes_in_pseudotime(lung)
df = p$data
df
I want to run the following for my own dataset, but the last line is taking too long. The diff_test_res line also takes approximately 5 minutes, but this is instant for the lung datset whose size is comparable to mine:
#Create CellDataSet object
cds <- newCellDataSet(expr_matrix.s4, phenoData = pd, featureData = fd, expressionFamily=negbinomial.size())
cds <- estimateSizeFactors(cds)
cds <- estimateDispersions(cds)
cds <- detectGenes(cds, min_expr = 0.1)
expressed_genes <- row.names(subset(fData(cds), num_cells_expressed >= 10))
#Cluster
disp_table <- dispersionTable(cds)
unsup_clustering_genes <- subset(disp_table, mean_expression >= 0.1)
cds <- setOrderingFilter(cds, unsup_clustering_genes$gene_id)
cds <- reduceDimension(cds, max_components = 2, num_dim = 6,
reduction_method = 'tSNE', verbose = T)
cds <- clusterCells(cds, num_clusters = 4)
#Plot differentially expressed genes in pseudotime
cds_myo <- estimateDispersions(cds)
diff_test_res <- differentialGeneTest(cds_myo[expressed_genes,],fullModelFormulaStr = '~Cluster', cores = 10)
ordering_genes <- row.names (subset(diff_test_res, qval < 0.01))
cds_myo <- setOrderingFilter(cds_myo, ordering_genes)
plot_ordering_genes(cds_myo)
cds_myo <- reduceDimension(
cds_myo,
max_components = 2,
method = 'DDRTree'
)
cds_myo <- orderCells(cds_myo)
p = plot_genes_in_pseudotime(cds_myo)
Does anyone familiar with Monocle know how I can speed it up?
Many thanks.
来源:https://stackoverflow.com/questions/60528103/plotting-all-genes-in-pseudotime-in-monocle