{"id":13683911,"url":"https://github.com/tanlabcode/CytoTalk","last_synced_at":"2025-04-30T20:31:50.808Z","repository":{"id":38973793,"uuid":"366733352","full_name":"tanlabcode/CytoTalk","owner":"tanlabcode","description":"A novel computational method for inferring cell-type-specific signaling networks using single-cell transcriptomics data for better characterization of cell-cell communication.","archived":false,"fork":true,"pushed_at":"2024-09-11T16:04:36.000Z","size":95027,"stargazers_count":34,"open_issues_count":9,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-11T23:29:25.288Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"huBioinfo/CytoTalk","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanlabcode.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-12T13:54:42.000Z","updated_at":"2024-07-13T02:22:17.000Z","dependencies_parsed_at":"2023-02-09T00:31:08.788Z","dependency_job_id":null,"html_url":"https://github.com/tanlabcode/CytoTalk","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanlabcode%2FCytoTalk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanlabcode%2FCytoTalk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanlabcode%2FCytoTalk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanlabcode%2FCytoTalk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanlabcode","download_url":"https://codeload.github.com/tanlabcode/CytoTalk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224224668,"owners_count":17276428,"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":[],"created_at":"2024-08-02T14:00:20.350Z","updated_at":"2024-11-12T05:30:29.833Z","avatar_url":"https://github.com/tanlabcode.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n# CytoTalk\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.align='center',\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nsetwd(getwd())\n```\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"docs/cytotalk_diagram.png\" width=\"640px\" /\u003e\n\u003c/div\u003e\n\n## Table of Contents\n\n- [CytoTalk](#cytotalk)\n  - [Table of Contents](#table-of-contents)\n  - [Overview](#overview)\n    - [Background](#background)\n  - [Getting Started](#getting-started)\n    - [Prerequisites](#prerequisites)\n    - [Installation](#installation)\n    - [Preparation](#preparation)\n    - [Running CytoTalk](#running-cytotalk)\n  - [Update Log](#update-log)\n  - [Citing CytoTalk](#citing-cytotalk)\n  - [References](#references)\n  - [Contact](#contact)\n\n## Overview\n\nWe have developed the CytoTalk algorithm for *de novo* construction of a\nsignaling network between two cell types using single-cell transcriptomics\ndata. This signaling network is the union of multiple signaling pathways\noriginating at ligand-receptor pairs. Our algorithm constructs an integrated\nnetwork of intracellular and intercellular functional gene interactions. A\nprize-collecting Steiner tree (PCST) algorithm is used to extract the\nsignaling network, based on node prize (cell-specific gene activity) and edge\ncost (functional interaction between two genes). The objective of the PCSF\nproblem is to find an optimal subnetwork in the integrated network that\nincludes genes with high levels of cell-type-specific expression and close\nconnection to highly active ligand-receptor pairs.\n\n### Background\n\nSignal transduction is the primary mechanism for cell-cell communication and\nscRNA-seq technology holds great promise for studying this communication at\nhigh levels of resolution. Signaling pathways are highly dynamic and cross-talk\namong them is prevalent. Due to these two features, simply examining expression\nlevels of ligand and receptor genes cannot reliably capture the overall\nactivities of signaling pathways and the interactions among them.\n\n## Getting Started\n\n### Prerequisites\n\nCytoTalk requires a Python module to operate correctly. To install the\n[`pcst_fast` module](https://github.com/fraenkel-lab/pcst_fast), please run\nthis command *before* using CytoTalk:\n\n``` console\npip install git+https://github.com/fraenkel-lab/pcst_fast.git\n```\n\nCytoTalk outputs a SIF file for use in Cytoscape. Please [install\nCytoscape](https://cytoscape.org/download.html) to view the whole output\nnetwork. Additionally, you'll have to install Graphviz and add the `dot`\nexecutable to your PATH. See the [Cytoscape downloads\npage](https://graphviz.org/download/) for more information.\n\n### Installation\n\nIf you have `devtools` installed, you can use the `install_github` function\ndirectly on this repository:\n\n``` {r install, eval=FALSE}\ndevtools::install_github(\"tanlabcode/CytoTalk\")\n```\n\n### Preparation\n\nLet's assume we have a folder called \"scRNAseq-data\", filled with single-cell\nRNA sequencing datasets. Here's an example directory structure:\n\n``` txt\n── scRNAseq-data\n   ├─ scRNAseq_BasalCells.csv\n   ├─ scRNAseq_BCells.csv\n   ├─ scRNAseq_EndothelialCells.csv\n   ├─ scRNAseq_Fibroblasts.csv\n   ├─ scRNAseq_LuminalEpithelialCells.csv\n   ├─ scRNAseq_Macrophages.csv\n   └─ scRNAseq_TCells.csv\n ```\n\n\u003cbr /\u003e\n\n⚠ **IMPORTANT** ⚠\n\nNotice all of these files have the prefix \"scRNAseq\\_\" and the extension \".csv\";\nCytoTalk looks for files matching this pattern, so be sure to replicate it\nwith your filenames. Let's try reading in the folder:\n\n``` r\ndir_in \u003c- \"~/Tan-Lab/scRNAseq-data\"\nlst_scrna \u003c- CytoTalk::read_matrix_folder(dir_in)\ntable(lst_scrna$cell_types)\n```\n\n``` console\n BasalCells                 BCells       EndothelialCells \n        392                    743                    251 \nFibroblasts LuminalEpithelialCells            Macrophages \n        700                    459                    186 \n     TCells \n       1750\n```\n\nThe outputted names are all the cell types we can choose to run CytoTalk\nagainst. Alternatively, we can use CellPhoneDB-style input, where one file is\nour data matrix, and another file maps cell types to columns (i.e. metadata):\n\n``` txt\n── scRNAseq-data-cpdb\n   ├─ sample_counts.txt\n   └─ sample_meta.txt\n ```\n\nThere is no specific pattern required for this type of input, as both filepaths\nare required for the function:\n\n``` r\nfpath_mat \u003c- \"~/Tan-Lab/scRNAseq-data-cpdb/sample_counts.txt\"\nfpath_meta \u003c- \"~/Tan-Lab/scRNAseq-data-cpdb/sample_meta.txt\"\nlst_scrna \u003c- CytoTalk::read_matrix_with_meta(fpath_mat, fpath_meta)\ntable(lst_scrna$cell_types)\n```\n\n``` console\nMyeloid NKcells_0 NKcells_1    Tcells \n      1         5         3         1\n```\n\nIf you have a `SingleCellExperiment` object with `logcounts` and `colnames`\nloaded onto it, you can create an input list like so:\n\n``` r\nlst_scrna \u003c- CytoTalk::from_single_cell_experiment(sce)\n```\n\nFinally, you can compose your own input list quite easily, simply have a matrix\nof either count or transformed data and a vector detailing the cell types of\neach column:\n\n``` r\nmat \u003c- matrix(rpois(90, 5), ncol = 3)\ncell_types \u003c- c(\"TypeA\", \"TypeB\", \"TypeA\")\nlst_scrna \u003c- CytoTalk:::new_named_list(mat, cell_types)\ntable(lst_scrna$cell_types)\n```\n\n``` console\nTypeA TypeB \n    2     1\n```\n\n### Running CytoTalk\n\nWithout further ado, let's run CytoTalk!\n\n``` r\n# read in data folder\ndir_in \u003c- \"~/Tan-Lab/scRNAseq-data\"\nlst_scrna \u003c- CytoTalk::read_matrix_folder(dir_in)\n\n# set required parameters\ntype_a \u003c- \"Fibroblasts\"\ntype_b \u003c- \"LuminalEpithelialCells\"\n\n# run CytoTalk process\nresults \u003c- CytoTalk::run_cytotalk(lst_scrna, type_a, type_b)\n```\n\n``` console\n[1 / 8] (11:15:28) Preprocessing...\n[2 / 8] (11:16:13) Mutual information matrix...\n[3 / 8] (11:20:19) Indirect edge-filtered network...\n[4 / 8] (11:20:37) Integrate network...\n[5 / 8] (11:21:44) PCSF...\n[6 / 8] (11:21:56) Determine best signaling network...\n[7 / 8] (11:21:58) Generate network output...\n[8 / 8] (11:21:59) Analyze pathways...\n```\n\nAll we need for a default run is the named list and selected cell types\n(\"Macrophages\" and \"LuminalEpithelialCells\"). The most important optional\nparameters to look at are `cutoff_a`, `cutoff_b`, and `beta_max`; details on\nthese can be found in the help page for the `run_cytotalk` function (see\n`?run_cytotalk`). As the process runs, we see messages print to the console for\neach sub process.\n\nHere is what the structure of the output list looks like (abbreviated):\n\n``` r\nstr(results)\n```\n\n``` console\nList of 5\n $ params\n $ pem\n $ integrated_net\n  ..$ nodes\n  ..$ edges\n $ pcst\n  ..$ occurances\n  ..$ ks_test_pval\n  ..$ final_network\n $ pathways\n  ..$ raw\n  ..$ graphs\n  ..$ df_pval\n```\n\nIn the order of increasing effort, let's take a look at some of the results.\nLet's begin with the `results$pathways` item. This list item contains `DiagrammeR`\ngraphs, which are viewable in RStudio, or can be exported if the `dir_out`\nparameter is specified during execution. Here is an example pathway\nneighborhood:\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"docs/pathway.svg\" width=\"640px\" /\u003e\n\u003c/div\u003e\n\nNote that the exported SVG files (see `dir_out` parameter) are interactive,\nwith hyperlinks to GeneCards and WikiPI. Green edges are directed from ligand\nto receptor. Additionally, if we specify an output directory, we can see a\n\"cytoscape\" sub-folder, which includes a SIF file read to import and two tables\nthat can be attached to the network and used for styling. Here's an example of\na styled Cytoscape network:\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"docs/cytoscape_network.svg\" width=\"640px\" /\u003e\n\u003c/div\u003e\n\u003cbr /\u003e\n\nThere are a number of details we can glean from these graphs, such as node\nprize (side of each node), edge cost (inverse edge width), Preferential\nExpression Measure (intensity of each color), cell type (based on color, and\nshape in the Cytoscape output), and interaction type (dashed lines for\ncrosstalk, solid for intracellular).\n\nIf we want to be more formal with the pathway analysis, we can look at some\nscores for each neighborhood in the `results$pathways$raw` item. This list\nprovides extracted subnetworks, based on the final network from the PCST.\nAdditionally, the `results$pathways$df_pval` item contains a summary of the\nneighborhood size for each pathway, along with theoretical (Gamma distribution)\ntest values that are found by contrsting the found pathway to random pathways\nfrom the integrated network. $p$-values for node prize, edge cost, and\npotential are calculated separately.\n\n## Update Log\n\n2021-11-30: The latest release \"CytoTalk_v0.99.0\" resets the versioning numbers\nin anticipation for submission to Bioconductor. This newest version packages\nfunctions in a modular fashion, offering more flexible input, usage, and output\nof the CytoTalk subroutines.\n\n2021-10-07: The release \"CytoTalk_v4.0.0\" is a completely re-written R\nversion of the program. Approximately half of the run time as been shaved off,\nthe program is now cross-compatible with Windows and *NIX systems, the file\nspace usage is down to roughly a tenth of what it was, and graphical outputs\nhave been made easier to import or now produce portable SVG files with embedded\nhyperlinks.\n\n2021-06-08: The release \"CytoTalk_v3.1.0\" is a major updated R version on the\nbasis of v3.0.3. We have added a function to generate Cytoscape files for\nvisualization of each ligand-receptor-associated pathway extracted from the\npredicted signaling network between the two given cell types. For each\npredicted ligand-receptor pair, its associated pathway is defined as the\nuser-specified order of the neighborhood of the ligand and receptor in the two\ncell types.\n\n2021-05-31: The release \"CytoTalk_v3.0.3\" is a revised R version on the basis\nof v3.0.2. A bug has been fixed in this version to avoid errors occurred in\nsome special cases. We also provided a new example\n\"RunCytoTalk_Example_StepByStep.R\" to run the CytoTalk algorithm in a\nstep-by-step fashion. Please download \"CytoTalk_package_v3.0.3.zip\" from the\nReleases page (\u003chttps://github.com/huBioinfo/CytoTalk/releases/tag/v3.0.3\u003e) and\nrefer to the user manual inside the package.\n\n2021-05-19: The release \"CytoTalk_v3.0.2\" is a revised R version on the basis\nof v3.0.1. A bug has been fixed in this version to avoid running errors in some\nextreme cases. Final prediction results will be the same as v3.0.1. Please\ndownload the package from the Releases page\n(\u003chttps://github.com/huBioinfo/CytoTalk/releases/tag/v3.0.2\u003e) and refer to the\nuser manual inside the package.\n\n2021-05-12: The release \"CytoTalk_v3.0.1\" is an R version, which is more easily\nand friendly to use!! Please download the package from the Releases page\n(\u003chttps://github.com/huBioinfo/CytoTalk/releases/tag/v3.0.1\u003e) and refer to the\nuser manual inside the package.\n\n## Citing CytoTalk\n\n- Hu Y, Peng T, Gao L, Tan K. CytoTalk: *De novo* construction of signal\n  transduction networks using single-cell transcriptomic data. ***Science\n  Advances***, 2021, 7(16): eabf1356.\n\n  \u003chttps://advances.sciencemag.org/content/7/16/eabf1356\u003e\n\n- Hu Y, Peng T, Gao L, Tan K. CytoTalk: *De novo* construction of signal\n  transduction networks using single-cell RNA-Seq data. *bioRxiv*, 2020.\n\n  \u003chttps://www.biorxiv.org/content/10.1101/2020.03.29.014464v1\u003e\n\n## References\n\n- Shannon P, et al. Cytoscape: a software environment for integrated models of\n  biomolecular interaction networks. *Genome Research*, 2003, 13: 2498-2504.\n\n## Contact  \n\nKai Tan, tank1@chop.edu\n\n\u003cbr /\u003e\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanlabcode%2FCytoTalk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanlabcode%2FCytoTalk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanlabcode%2FCytoTalk/lists"}