{"id":13592279,"url":"https://github.com/debsin/dropClust","last_synced_at":"2025-04-08T23:31:48.144Z","repository":{"id":132381319,"uuid":"77390377","full_name":"debsin/dropClust","owner":"debsin","description":"Version 2.1.0 released","archived":false,"fork":false,"pushed_at":"2019-09-16T13:51:09.000Z","size":196687,"stargazers_count":23,"open_issues_count":1,"forks_count":8,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-02T16:44:29.411Z","etag":null,"topics":["cluster-analysis","clustering","genomics","lsh-forest","pca","rna-seq","singlecell"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/debsin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-26T14:56:28.000Z","updated_at":"2024-01-14T14:22:26.000Z","dependencies_parsed_at":"2023-07-02T14:17:39.437Z","dependency_job_id":null,"html_url":"https://github.com/debsin/dropClust","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debsin%2FdropClust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debsin%2FdropClust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debsin%2FdropClust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debsin%2FdropClust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/debsin","download_url":"https://codeload.github.com/debsin/dropClust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223346607,"owners_count":17130470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cluster-analysis","clustering","genomics","lsh-forest","pca","rna-seq","singlecell"],"created_at":"2024-08-01T16:01:07.618Z","updated_at":"2025-04-08T23:31:48.137Z","avatar_url":"https://github.com/debsin.png","language":"R","funding_links":[],"categories":["Software packages"],"sub_categories":["RNA-seq","Cell clustering"],"readme":"\nThe latest version of dropClust is now available in desktop and online versions.\n\nNew Additions\n====\n\n\nImproved Interoperability  |  Integrative Analysis     |     Online web-server     |\n:-------------------------:|:-------------------------:|:-------------------------:|\nSingleCellExperiment Container          |  \u003cimg width=\"250\" src=\"doc/batch.png\"\u003e|     \u003cimg width=\"250px\" src=\"doc/Capture.png\"\u003e    |\n\n\n\ndropClust Online\n====\n\n  Visit [https://debsinha.shinyapps.io/dropClust/](https://debsinha.shinyapps.io/dropClust/) for the online version.\n\n   -   [Installation](#desktop-installation)\n   -   [Tutorial](#vignette-tutorial)\n       -  [Setting-up](#setting-up-directories)\n       -  [Loading data](#loading-data)\n       -  [Pre-processing](#pre-processing)\n       -  [Sampling](#structure-preserving-sampling)\n       -  [Clustering](#clustering)\n       -  [Visualizing](#visualizing-clusters)\n       -  [Differential gene analysis](#find-cluster-specific-differentially-expressed-genes)\n       -  [Plot marker genes](#plot-hand-picked-marker-genes)\n       -  [Draw heatmap](#draw-heatmap)\n       -  [Integrative Analysis](#integrative-analysis)\n\n\n\nDesktop Installation\n===============\n\nThe developer version of the R package can be installed with the following R commands:\n\n``` r\nlibrary(devtools)\ninstall_github(\"debsin/dropClust\", dependencies = T)\n```\n\nVignette tutorial\n------------------\nThis vignette uses a small data set from the 10X website (3K PBMC dataset [here](http://cf.10xgenomics.com/samples/cell-exp/1.1.0/pbmc3k/pbmc3k_filtered_gene_bc_matrices.tar.gz) ) to demonstrate a standard pipeline. This vignette can be used as a tutorial as well.\n\nSetting up directories\n----------------------\n\n``` r\n\nlibrary(dropClust)\nset.seed(0)\n```\n\nLoading data\n------------\n\ndropClust loads UMI count expression data from three input files. The files follow the same structure as the datasets available from the 10X website, i.e.:\n\n-   count matrix file in sparse format\n-   transcriptome identifiers as a TSV file and\n-   gene identifiers as a TSV file\n\n``` r\n# Load Data, path contains decompressed files \nsce \u003c-readfiles(path = \"C:/Projects/dropClust/data/pbmc3k/hg19/\")\n```\n\nPre-processing\n--------------\ndropClust performs pre-processing to remove poor quality cells and genes. dropClust is also equipped to mitigate batch-effects that may be present. The user does not need to provide any information regarding the source of the batch for individual transcriptomes. However, the batch-effect removal step is optional.\n\nCells are filtered based on the total UMI count in a cell specified by parameter `min_count`.  Poor quality genes are removed based on the minimum number of cells `min_count` with expressions above a given threshold `min_count`. \n\n``` r\n# Filter poor quality cells.  A threshold th corresponds to the total count of a cell.\nsce\u003c-FilterCells(sce)\nsce\u003c-FilterGenes(sce)\n```\n\n### Data normalization and removing poor quality genes\n\nCount normalization is then performed with the good quality genes only. Normalized expression values is computed on the raw count data in a SingleCellExperiment object, using the median normalized total count.\n\n```{r}\nsce\u003c-CountNormalize(sce)\n\n```\n### Selecting highly variable genes \nFurther gene selection is carried out by ranking the genes based on its dispersion index. \n\n```r\n# Select Top Dispersed Genes by setting ngenes_keep.\nsce\u003c-RankGenes(sce, ngenes_keep = 1000)\n```\n\n\nStructure Preserving Sampling\n-----------------------------\n\nPrimary clustering is performed in a fast manner to estimate a gross structure of the data. Each of these clusters is then sampled to fine tune the clustering process.\n\n``` r\n\nsce\u003c-Sampling(sce)\n\n```\n\nGene selection based on PCA\n---------------------------\nAnother gene selection is performed to reduce the number of dimensions. PCA is used to identify genes affecting major components. \n\n``` r\n\n# Find PCA top 200 genes. This may take some time.\nsce\u003c-RankPCAGenes(sce)\n\n```\n\n\nClustering\n------------------\n\n### Fine tuning the clustering process\n\nBy default best-fit, Louvain based clusters are returned. However, the user can tune the parameters to produce the desired number of clusters. The un-sampled transcriptomes are assigned cluster identifiers from among those identifiers produced from fine-tuning clustering. The post-hoc assignment can be controlled by setting the confidence value `conf`. High `conf` values will assign cluster identifiers to only those transcriptomes sharing a majority of common nearest neighbours. \n\n\n``` r\n# When `method = hclust`\n# Adjust Minimum cluster size with argument minClusterSize (default = 20)\n# Adjust tree cut with argument level deepSplit (default = 3), higher value produces more clusters.\nsce\u003c-Cluster(sce, method = \"default\", conf = 0.8)\n```\n\nVisualizing clusters\n--------------------\n\nCompute 2D embeddings for samples followed by post-hoc clustering.\n\n``` r\n\nsce\u003c-PlotEmbedding(sce, embedding = \"umap\", spread = 10, min_dist = 0.1)\n\nplot_data = data.frame(\"Y1\" = reducedDim(sce,\"umap\")[,1], Y2 = reducedDim(sce, \"umap\")[,2], color = sce$ClusterIDs)\n\nScatterPlot(plot_data,title = \"Clusters\")\n```\n\n![](doc/vignette_files/figure-gfm/unnamed-chunk-9-1.png)\u003c!-- --\u003e\n\nFind cluster specific Differentially Expressed genes\n----------------------------------------------------\n\n``` r\n\nDE_genes_all = FindMarkers(sce, selected_clusters=NA, lfc_th = 1, q_th =0.001, nDE=30)\n\nwrite.csv(DE_genes_all$genes, \n          file = file.path(tempdir(),\"ct_genes.csv\"),\n          quote = FALSE)\n\n```\n\n\nPlot hand picked marker genes\n-----------------------------\n\n``` r\n\nmarker_genes = c(\"S100A8\", \"GNLY\", \"PF4\")\n\np\u003c-PlotMarkers(sce, marker_genes)\n```\n![](doc/vignette_files/figure-gfm/unnamed-chunk-11-1.png)\u003c!-- --\u003e\n\n\n\nHeat map of top DE genes from each cluster\n------------------------------------------\n\n``` r\n# Draw heatmap\np\u003c-PlotHeatmap(sce, DE_res = DE_genes_all$DE_res,nDE = 10)\n\nprint(p)\n```\n![](doc/vignette_files/figure-gfm/unnamed-chunk-12-1.png)\u003c!-- --\u003e\n\n\nIntegrative analysis\n================\n\n## Loading datasets\n\nEach dataset represents one batch and must be a `SingleCellExperiment` object. The objects are are merged by passing a list in the next step.\n\n``` r\n\nlibrary(dropClust)\nload(url(\"https://raw.githubusercontent.com/LuyiTian/CellBench_data/master/data/sincell_with_class.RData\"))\n\nobjects = list()\n\nobjects[[1]] = sce_sc_10x_qc\n\nobjects[[2]] = sce_sc_CELseq2_qc\n\nobjects[[3]] = sce_sc_Dropseq_qc\n```\n\n## Merge datasets using dropClust\n\nDatasets can be merged in two ways: using a set of DE genes from each\nbatch or, using the union of the sets of highly variable genes from each\nbatch.\n\n\n## Perform correction and dimension reduction\n\n``` r\nset.seed(1)\ndc.corr \u003c-  Correction(merged_data,  method=\"default\", close_th = 0.1, cells_th = 0.1,\n                       components = 10, n_neighbors = 30,  min_dist = 1)\n```\n\n## Perform Clustering on integrated dimensions\n\n``` r\ndc.corr = Cluster(dc.corr,method = \"kmeans\",centers = 3)\n\n```\n\n## Visualizing clusters\n\nCompute 2D embeddings for samples followed by post-hoc clustering.\n\n``` r\nScatterPlot(dc.corr, title = \"Clusters\")\n```\n\n![Batch corrected dropClust based\nClustering.](doc/batchCorrection_files/figure-gfm/unnamed-chunk-5-1.png)\n\n## Optional Batch correction\n\nUsers can use `fastmnn` method for batchcorrection. Specific arguments of fastmnn can also be passed through the `Correction` module.\n\n``` r\nmerged_data.fastmnn\u003c-Merge(all.objects,use.de.genes = FALSE)\nset.seed(1)\nmnn.corr \u003c-  Correction(merged_data.fastmnn,  method=\"fastmnn\", d = 10)\nmnn.corr = Cluster(mnn.corr,method = \"kmeans\",centers = 3)\nScatterPlot(mnn.corr, title = \"Clusters\")\n```\n\n![](doc/batchCorrection_files/figure-gfm/unnamed-chunk-6-1.png)\u003c!-- --\u003e\n\n## Marker discovery from the merged dataset\n\n``` r\nde\u003c-FindMarkers(dc.corr,q_th = 0.001, lfc_th = 1.2,nDE = 10)\nde$genes.df\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebsin%2FdropClust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdebsin%2FdropClust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebsin%2FdropClust/lists"}