Skip to content
Snippets Groups Projects
Commit 1799c70a authored by Jefferson Chen's avatar Jefferson Chen
Browse files

adding code for PDAC

parent 344252b6
Branches
No related merge requests found
...@@ -16,3 +16,6 @@ rownames(dense_matrix) <- rownames(sc) # Assign gene names to rows ...@@ -16,3 +16,6 @@ rownames(dense_matrix) <- rownames(sc) # Assign gene names to rows
colnames(dense_matrix) <- colnames(sc) # Assign spot names to columns colnames(dense_matrix) <- colnames(sc) # Assign spot names to columns
write.csv(dense_matrix, file = "./PDAC/sc_data.csv", row.names = TRUE) write.csv(dense_matrix, file = "./PDAC/sc_data.csv", row.names = TRUE)
...@@ -51,5 +51,5 @@ annotations <- read.csv(paste0(data_folder, "./annotations.csv")) ...@@ -51,5 +51,5 @@ annotations <- read.csv(paste0(data_folder, "./annotations.csv"))
idx <- cell.sampling(ncells = 73260, annotations, size = 1000, prot = T) idx <- cell.sampling(ncells = 73260, annotations, size = 1000, prot = T)
sc.ds <- sc[, idx[, 1]] sc.ds <- sc[, idx[, 1]]
res.ds <- deconvoluting(sc, st, genemode = "def", hpmode = "def", dopar = T, ncores = 32) res.ds <- deconvoluting(sc.ds, st, genemode = "def", hpmode = "def", dopar = T, ncores = 32)
write.csv(as.matrix(res.ds), "Redeconve.csv") write.csv(as.matrix(res.ds), "Redeconve_lymph_node.csv")
...@@ -68,5 +68,34 @@ sp_data_human_lymph_node.var.to_csv(data_folder + "gene_names_sp_human_lymph_nod ...@@ -68,5 +68,34 @@ sp_data_human_lymph_node.var.to_csv(data_folder + "gene_names_sp_human_lymph_nod
sp_data_human_lymph_node.obs.to_csv(data_folder + "cell_names_sp_human_lymph_nodes.csv", header=True, index=True) sp_data_human_lymph_node.obs.to_csv(data_folder + "cell_names_sp_human_lymph_nodes.csv", header=True, index=True)
#### Below is Formatting the Result for PDAC ####
data_folder = '../Generation_Result/'
output_folder = "./PDAC/"
tangram_result = sc.read_h5ad(data_folder + "scgpt_cell_reference_08_PDAC.h5ad")
tangram_result.var_names_make_unique()
# 读取scRNA结果文件
sc_data_PDAC = sc.read_h5ad(data_folder + "adata_result_08_PDAC.h5ad")
sc_data_PDAC.var_names_make_unique()
# Save the sparse matrix (X) in Matrix Market format (.mtx)
io.mmwrite(output_folder + "matrix_sc_PDAC_scGPT.mtx", sparse.csr_matrix(sc_data_PDAC.X))
# Save gene names and cell names
sc_data_PDAC.var.to_csv(output_folder + "gene_names_sc_PDAC.csv", header=True, index=True)
sc_data_PDAC.obs.to_csv(output_folder + "cell_names_sc_PDAC.csv", header=True, index=True)
# Save the sparse matrix (X) in Matrix Market format (.mtx)
io.mmwrite(output_folder + "matrix_PDAC_tangram_result.mtx", sparse.csr_matrix(tangram_result.X))
# Save gene names and cell names
tangram_result.var.to_csv(output_folder + "gene_names_PDAC_tangram_result.csv", header=True, index=True)
tangram_result.obs.to_csv(output_folder + "cell_names_PDAC_tangram_result.csv", header=True, index=True)
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment