{"id":22731032,"url":"https://github.com/genentech/spatialqpfs","last_synced_at":"2025-07-14T12:38:12.559Z","repository":{"id":240303575,"uuid":"798445665","full_name":"Genentech/SpatialQPFs","owner":"Genentech","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-06T00:22:42.000Z","size":3813,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-26T12:11:55.326Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Genentech.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-09T19:44:17.000Z","updated_at":"2025-01-06T00:22:46.000Z","dependencies_parsed_at":"2024-05-17T22:29:35.411Z","dependency_job_id":"ea6cff47-9afc-48b4-8170-2e140d9e629b","html_url":"https://github.com/Genentech/SpatialQPFs","commit_stats":null,"previous_names":["genentech/spatialqpfs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2FSpatialQPFs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2FSpatialQPFs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2FSpatialQPFs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2FSpatialQPFs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Genentech","download_url":"https://codeload.github.com/Genentech/SpatialQPFs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610407,"owners_count":21132920,"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-12-10T19:19:10.745Z","updated_at":"2025-04-12T17:52:21.778Z","avatar_url":"https://github.com/Genentech.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpatialQPFs\n\u003cimg width=\"387\" alt=\"SpatialQPFs_logo\" src=\"https://github.com/Genentech/SpatialQPFs/assets/20170034/d79d1795-5cec-4b31-8a86-b2ab6e595caa\"\u003e\n\nThis repo provides the source code related to the *SpatialQPFs* R library that is reported in the manuscript \"Deciphering cell to cell spatial relationship for pathology images using SpatialQPFs\" by Xiao Li. \n\n## Citation\nIf you find this work useful in your research or if you use parts of this code please consider citing this paper:\n\nLi, X. Deciphering cell to cell spatial relationship for pathology images using SpatialQPFs. Sci Rep 14, 29585 (2024). https://doi.org/10.1038/s41598-024-81383-1\n\n```\n@article{li2024deciphering,\n  title={Deciphering cell to cell spatial relationship for pathology images using SpatialQPFs},\n  author={Li, Xiao},\n  journal={Scientific Reports},\n  volume={14},\n  number={1},\n  pages={1--13},\n  year={2024},\n  publisher={Nature Publishing Group}\n}\n```\n\n## Primary SpatailQPFs functions\n\n| Function                   | Description |\n|----------------------------|-------------|\n| `Data_Vis()`               | Visualizes the input cell level data, including raw spatial map of individual cells and smoothed spatial density map |\n| `Point_pattern_data_uni()` | Main function to generate spatial features using point process data (single cell type). |\n| `Point_pattern_data_bi()`  | Main function to generate spatial features using point process data (pairwise cell types). |\n| `Point_pattern_data_ITLR()`| This is a function that discriminates a target cell population into 2 subgroups, in spatial relationships with the reference cell population. In case of lymphocytes and tumor cells, the lymphocytes are discriminated into intra-tumoral lymphocytes and adjacent-tumoral lymphocytes. |\n| `Areal_data()`             | Main function to generate spatial features using areal data. |\n| `Geostatistics_data()`     | Main function to generate spatial features using geostatistical data. |\n\n\n\n## Example workflow\n\n### 1. installation\n\nFor first-time use, installation can be completed in the user's local computing environment.\n\n```R\n## the folder contain the source code names \"SpatialQPFs\" in the user's local directory\ndevtools::install(\"your_path/SpatialQPFs\", dependencies = TRUE, repos=\"https://cloud.r-project.org/\")\n```\nThen, the package can be loaded:\n```R\nlibrary(\"SpatialQPFs\")\n```\n\n### 2. Input data visualization\n\nThe utilization of the *SpatialQPFs* functionality begins by importing cell-level input data (currently only support $.csv$ file, more input format will be supported in the future release). Preliminary steps, including identifying tumor regions of interest (ROIs), segmenting and classifying cells, are performed before invoking *SpatialQPFs*. \n\n\u003cimg src=\"https://github.com/user-attachments/assets/e4ce6bf7-a497-4c83-a896-402c898aeb3c\" alt=\"geostat_data\" width=\"800\" height=\"450\"/\u003e\n\n\nTo visualize the spatial distribution of the input tabular data within the original tissue space and its derived spatial density map, users can call ```Data_Vis()``` function.\nFor example, by specifying ```cell_type = \"Lymphocyte\"``` users can plot the lymphocyte population. \nThe argument ``path`` and ```file``` accept strings that indicate the directory address where the file is saved and the name of the CSV file. Additionally, ```cell_class_var```, ```x_var``` and ```y_var``` specify the column names from the input CSV file that contain the X, Y-coordinates of cell centroids and the corresponding cell type. See function manual for further details. \n\n```R\nData_Vis(path = folder_path, file = file_name, cell_class_var = \"cell_class\", \n         x_var = \"coordinate_X\", y_var = \"coordinate_Y\", cell_type = \"Lymphocyte\")  \n```\n\n\u003cimg src=\"https://github.com/user-attachments/assets/d1395016-2ab3-48a2-9ca8-12e0ca12fc3a\" alt=\"data_vis\" width=\"800\" height=\"450\"/\u003e\n\n\n\n### 3. Point pattern analysis\n\nPoint process data analysis methods can be conducted by implementing three functions:\n- ```Point_pattern_data_uni()```: This function generates spatial features for a single cell type population.\n- ```Point_pattern_data_bi()```: It computes the spatial interaction for a pair of cell types.\n- ```Point_pattern_data_ITLR()```: This function discriminates a target cell population into subgroups based on their spatial relationships with the reference cell population\n  \nAdditional plots for other point process data analysis methods are presented at ```Tutorial-of-SpatialQPFs.html```.\n\n```R\nPoint_pattern_data_uni(path = folder_path, file = file_name, \n                       cell_class_var = \"cell_class\", x_var = \"coordinate_X\", \n                       y_var = \"coordinate_Y\", cell_type = \"Lymphocyte\", \n                       scale = 200, myplot = T)\n\nPoint_pattern_data_bi(path = folder_path, file = file_name,  \n                      cell_class_var = \"cell_class\", x_var = \"coordinate_X\", \n                      y_var = \"coordinate_Y\", from_type = \"Lymphocyte\", \n                      to_type = \"Tumor\", scale = 200, myplot = T)\n\nPoint_pattern_data_ITLR(path = folder_path, file = file_name, \n                        cell_class_var = \"cell_class\", x_var = \"coordinate_X\", \n                        y_var = \"coordinate_Y\", from_type = \"Lymphocyte\", \n                        to_type = \"Tumor\", micron_per_pixel = 0.5, myplot = T)\n```                       \n\n\u003cimg src=\"https://github.com/user-attachments/assets/b68bb32d-918a-490a-b9b2-d14864b5160f\" alt=\"point_data\" width=\"700\" height=\"900\"/\u003e\n\n\n\n### 4. Areal data analysis\nThe analysis of areal data can be performed using the ```Areal_data()``` function. \nNote that, this function conducts the transformation from point process data to areal data behind the scenes, by partitioning the underlying space into square lattices. Users can specify the desired side length of the square lattices as ```2*scale```. \n\nOther areal data analysis plots can be found in ```Tutorial-of-SpatialQPFs.html```.\n\n```R\nAreal_data(path = folder_path, file = file_name,\n           cell_class_var = \"cell_class\", x_var = \"coordinate_X\", \n           y_var = \"coordinate_Y\", from_type = \"Lymphocyte\", \n           to_type = \"Tumor\", scale = 200, myplot = T)     \n```\n\n\u003cimg src=\"https://github.com/user-attachments/assets/5dee5e4f-d2b4-43ae-ac1f-9bad86dc6d8c\" alt=\"areal_data\" width=\"700\" height=\"800\"/\u003e\n\n\n\n### 5. Geostatistical data analysis\nThe analysis of geostatistical data can be conducted using the ```Geostatistics_data()``` function. In the current version, both semi-variogram and cross-variogram are implemented to illustrate the spatial correlation of either a single cell type or a pair of different cell types, respectively.\n\nFurther plots for alternative geostatistical data analysis methods are demonstrated at ```Tutorial-of-SpatialQPFs.html```.\n\n```R\nGeostatistics_data(path = folder_path, file = file_name, \n                   cell_class_var = \"cell_class\", x_var = \"coordinate_X\", \n                   y_var = \"coordinate_Y\",  from_type = \"Lymphocyte\", \n                   to_type = \"Tumor\", scale = 200, myplot = T)  \n```\n\n\u003cimg src=\"https://github.com/user-attachments/assets/26276fb8-a938-4e4c-b5b4-948dd55a003d\" alt=\"geostat_data\" width=\"650\" height=\"550\"/\u003e\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenentech%2Fspatialqpfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenentech%2Fspatialqpfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenentech%2Fspatialqpfs/lists"}