Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dputhier committed Jan 8, 2024
1 parent 371df1a commit 31f2585
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Date: 2020-07-22
Author: J. Bavais, Sebastien Nin, Lionel Spinelli and Denis Puthier
Maintainer: J. Bavais <julie.bavais@yahoo.fr>
Depends: R (>= 4.0.0), methods
Imports: scales, reshape2, ggplot2, dplyr, igraph, plotly, qlcMatrix, clusterProfiler, org.Hs.eg.db, org.Mm.eg.db, amap, grDevices, stats, utils, magrittr, testthat, iheatmapr, AnnotationDbi, data.table, enrichplot, SeuratObject, pheatmap, Seurat, Matrix, SparseM, ggforce, ggstar, patchwork, biomaRt, ggh4x, xlsx, pracma, jinjar, cluster, clValid, DT
Imports: scales, reshape2, ggplot2, dplyr, igraph, plotly, qlcMatrix, clusterProfiler, org.Hs.eg.db, org.Mm.eg.db, amap, grDevices, stats, utils, magrittr, testthat, iheatmapr, AnnotationDbi, data.table, enrichplot, SeuratObject, pheatmap, Seurat, Matrix, SparseM, ggforce, ggstar, patchwork, biomaRt, ggh4x, WriteXLS, pracma, jinjar, cluster, clValid, DT
Collate: ClusterSet_class.R import_package.R enrichment_analysis.R top_genes.R visualization.R get_data_for_scigenex.R get_genes.R reorder_genes.R utils.R dataset_doc.R plot_profiles.R filter_gene_clusters.R gene_clustering.R select_genes.R Visium_hull.R compare_gene_sets.R cluster_stats.R convert.R plot_spatial.R top_by_go.R dist2border.R clusterset_report.R module_quality_scores.R zzz.R
Description: The scigenex package (Single-Cell Informative GENe Explorer) proposes a set of functions to (i) extract informative genes from a scRNA-seq and Visium experiment, (ii) search clusters of co-expressed genes, (iii) store/manipulate these clusters, (v) and anotate these clusters. These clusters can be mapped onto UMAP or t-SNE diagrams to functionally annotate cell populations.
biocViews: Clustering, Classification, Transcriptomics, SingleCell, ReportWriting, GeneRegulation
Expand Down
40 changes: 22 additions & 18 deletions R/ClusterSet_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -649,40 +649,44 @@ setGeneric("cluster_set_to_xls",
#' dir.create(tp_dir, showWarnings = FALSE)
#' cluster_set_to_xls(pbmc3k_medium_clusters, file.path(tp_dir, "test.xls"))
#' @export cluster_set_to_xls
setMethod("cluster_set_to_xls",
signature("ClusterSet"),
setMethod("cluster_set_to_xls",
signature("ClusterSet"),
function(object,
file_path = NULL) {

check_format_cluster_set(object)
object <- reorder_genes(object)
dir_n <- dirname(file_path)

if(!dir.exists(dir_n))
if (!dir.exists(dir_n))
print_msg("Directory does not exist. Exiting.", msg_type = "STOP")


if(file.exists(file_path))
if (file.exists(file_path))
print_msg("File already exist. Exiting.", msg_type = "STOP")


gnc <- gene_cluster(object)
xlsx::write.xlsx(data.frame(cluster=unname(gnc), "official_gene_symbol"=names(gnc)),
file=file_path,
sheetName="All_modules")


for(i in 1:nclust(object)){
xlsx::write.xlsx(data.frame("official_gene_symbol"=object@gene_clusters[[i]]),
file=file_path,
sheetName=paste0("Module ", i),
append =TRUE)

gnc <- gene_cluster(object)
df_list <- list(x=data.frame(All_modules = unname(gnc),
"official_gene_symbol" = names(gnc)))

tmp <- lapply(object@gene_clusters, as.data.frame)
for(i in 1:length(tmp)){
colnames(tmp[[i]]) <- paste0("Module ", i)

}

df_list <- append(df_list, tmp)

WriteXLS::WriteXLS(
x=df_list,
ExcelFileName = file_path,
SheetNames = c("All_modules", paste0("Module ", 1:length(object@gene_clusters)))
)


})



################################################################################
## Method for reordering clusters from a clusterSet
################################################################################
Expand Down

0 comments on commit 31f2585

Please sign in to comment.