{"id":44650666,"url":"https://github.com/shahrozeabbas/fsctype","last_synced_at":"2026-02-14T20:45:22.186Z","repository":{"id":199298495,"uuid":"702582792","full_name":"shahrozeabbas/fsctype","owner":"shahrozeabbas","description":"Modification of the Original ScType Method for Barcode Annotation using KNN Algorithm","archived":false,"fork":false,"pushed_at":"2025-04-14T11:35:17.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-05T04:05:56.108Z","etag":null,"topics":["annotation-tool","celltype-annotation","seurat","single-cell","spatialtranscriptomics"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shahrozeabbas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-09T15:32:24.000Z","updated_at":"2025-04-14T11:35:20.000Z","dependencies_parsed_at":"2023-11-06T22:58:51.893Z","dependency_job_id":"2e11a3f1-2d9d-4689-b4e7-36b8eaaef8a4","html_url":"https://github.com/shahrozeabbas/fsctype","commit_stats":null,"previous_names":["shahrozeabbas/fsctype"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shahrozeabbas/fsctype","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahrozeabbas%2Ffsctype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahrozeabbas%2Ffsctype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahrozeabbas%2Ffsctype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahrozeabbas%2Ffsctype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahrozeabbas","download_url":"https://codeload.github.com/shahrozeabbas/fsctype/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahrozeabbas%2Ffsctype/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29455362,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["annotation-tool","celltype-annotation","seurat","single-cell","spatialtranscriptomics"],"created_at":"2026-02-14T20:45:19.574Z","updated_at":"2026-02-14T20:45:22.181Z","avatar_url":"https://github.com/shahrozeabbas.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fsctype - Modification of the Original [ScType](https://github.com/IanevskiAleksandr/sc-type) Method for Barcode Annotation using the KNN Algorithm\n\n## Description\nThe fsctype method is based on the original `ScType` method used for cluster annotation of single-cell datasets using known markers. \n\nThis variation uses the `data.table` package to substantially speed up calculations and also makes use of the `future` package for parallel execution. \n\nA typical dataset of 10,000 barcodes or less will run in under 10 seconds in a memory efficient way. You should only rely on parallel execution if your dataset is larger than 50,000 barcodes as the speed up is minimal otherwise and not noticeable. \n\nThis method is different than the original in that instead of relying on precomputed clusters for annotation, it traverses each barcode in a neighborhood graph and uses the k nearest-neighbors to assign a _per-cell_ annotation using the original `ScType` calculation. \n\n## Installation\nYou can install all required packages directly from `CRAN`\n\n```\ninstall.packages(c('Seurat', 'dplyr', 'ggplot2', 'data.table', 'igraph'))\n```\nor via `mamba` and the environment file that is provided. \n```\nmamba env create -f fsctype.yml\n```\n\n## Tutorial\nThis method is highly sensitive to the marker genes used. The more specific your markers are the better the annotation will be. You can use the marker genes from the original ScType database or provide your own, as long as the input marker list is created to look like the output of `gene_sets_prepare.R` from the original method. In other words, you need a nested named list with at least positive markers for your cell types or regions of interest. \n\nYour dataset must be processed up to the shared neighborhood graph calculation or some `igraph` object with similarity weights for edges. \n\n```\npkgs \u003c- c('Seurat', 'dplyr', 'ggplot2', 'data.table', 'igraph')\ninvisible(lapply(pkgs, require, character.only=TRUE))\n\nobject \u003c- CreateSeuratObject(counts=Read10X_h5('filtered_feature_bc_matrix.h5'))\n\nobject \u003c- object %\u003e%\n\n                NormalizeData() %\u003e%\n                FindVariableFeatures() %\u003e%\n                ScaleData(verbose=FALSE) %\u003e%\n                RunPCA(verbose=FALSE) %\u003e%\n                FindNeighbors(dims=seq(10)) %\u003e%\n                RunUMAP(dims=seq(10))\n```\n\nOnce you have run `FindNeighbors`, you can use this graph downstream for `fsctype` as it relies on the k nearest neighbors of each cell for annotation. The `annotation_markers_list.rds` is a created marker list as defined by `gene_sets_prepare.R`. You can use this from the original `ScType` method or create your own. \n\n```\nsource('https://raw.githubusercontent.com/shahrozeabbas/fsctype/main/R/fsctype.R')\n\nmarkers \u003c- readRDS('annotation_markers_list.rds')\n\n\ncounts \u003c- as.data.frame(\n        object %\u003e% \n            Seurat::ScaleData(verbose=FALSE, features=unique(unlist(markers))) %\u003e% \n            Seurat::GetAssayData(slot='scale.data')\n)\n\n\ncells \u003c- colnames(object)\ngraph \u003c- object %\u003e% get_graph()\nk \u003c- round(sqrt(ncol(object) * 0.5))\n\npredictions \u003c- fsctype(barcodes=cells, graph=graph, counts=counts, markers=markers, n_neighbors=k)\n\n\ncell_type \u003c- predictions[, prediction]\nnames(cell_type) \u003c- predictions[, barcodes]\nobject \u003c- object %\u003e% AddMetaData(metadata=factor(cell_type), col.name='cell_type') \n\nggplot2::ggsave(\n  width=12, height=8, filename='fsctype_predictions_umap.png',\n  plot=DimPlot(object, group.by='cell_type', label=TRUE, repel=TRUE, pt.size=1)\n)\n\n```\n\n### If you use `fsctype` please cite using the link under the 'About' section. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahrozeabbas%2Ffsctype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahrozeabbas%2Ffsctype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahrozeabbas%2Ffsctype/lists"}