Giter Site home page Giter Site logo

combio-dku / hicat Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 2.0 81.23 MB

High precision, marker-based, hierarchical cell-type annotation tool for single-cell RNA-seq data

License: MIT License

R 0.04% Jupyter Notebook 99.96%
cell-type-identification marker-based single-cell-rna-seq

hicat's Introduction

HiCAT

PyPI Version PyPI Downloads

Brief introduction

  • HiCAT is a marker-based, hierarchical cell-type annotation tool for single-cell RNA-seq data.
  • It was developed using python3, but also run in R as well.
  • HiCAT works in marker-based mode utilizing only the existing lists of markers.
  • Please refer to "Hierarchical cell-type identifier accurately distinguishes immune-cell subtypes enabling precise profiling of tissue microenvironment with single-cell RNA-sequencing", Briefings in Bioinformatics, available at https://doi.org/10.1093/bib/bbad006, https://doi.org/10.1101/2022.07.27.501701

Installation using pip, importing HiCAT in Python

HiCAT can be installed using pip command. With python3 installed in your system, simply use the follwing command in a terminal.

pip install MarkerCount

Once it is installed using pip, you can import two functions using the following python command.

from MarkerCount.hicat import HiCAT, show_summary

where show_summary is used to check the annotation results.

Marker file format

Marker file must be a tap-separated-value file (.tsv) with 6 columns, "tissue", "cell_type_major", "cell_type_minor", "cell_type_subset", "exp" and "markers".

  • The "tissue" column is to select cell-types to be used for annotation within HiCAT. You can feed a list of tissues as a parameter when you call HiCAT.
  • The next three columns define the 3-level taxonomy tree to be used for hierarchical identification.
  • "exp" is type of marker, which can be "pos", "neg", or "sec".
  • "markers" is a list of gene symbols separated by comma.
  • The markers in "cell_markers_rndsystems_rev.tsv", were reproduced from R&D systems

If you want to use your own markers, please refer to the tips for prepareing markers db.

Example usage in Jupyter notebook

HiCAT_example_py_v02.ipynb is example code of HiCAT in Jupyter notebook, where you can see how to import and run HiCAT. For quick overveiw of the usage of HiCAT, simply click HiCAT_example_py_v02.ipynb above in the file list.

To run the example, download the Jupyter notebook file, maker DB in .tsv file and a sample single-cell RNA-Seq data with .h5ad extension (It is one of the data we used in our paper mentioned above). Just follow the instruction below.

  1. Download all the files in ZIP format.
  2. Decompress the files into a desired folder.
  3. Decompress 'Melanoma_5K_rev.h5ad.zip'
  4. Run jupyter notebook and open the jupyter notebook file HiCAT_example_py_v02.ipynb
  5. You can run the codes step-by-step and can see the intermediate and final results.

To run HiCAT, you need the pre-installed python packages Numpy, Pandas, sklearn, scipy, and scikit-network. seaborn and matplotlib are required only to show the results, not for the HiCAT itself. All of them can be installed simply using pip command.

Using HiCAT in R

(Installed using pip) You also can import and use HiCAT in R, for which you need the R package reticulate. First, import HiCAT using the following command

library(reticulate)
mkrcnt <- import("MarkerCount.hicat")

Then, you can call the HiCAT functions as follows.

df_res <- mkrcnt$HiCAT( .. arguments .. )

The arguments to pass and the return value are the same as those in python. R example of HiCAT is in R script HiCAT_example.R Tested in linux Mint with R version 4.0.5. (numpy v1.21.1, scipy v1.7.1 without scikit-network)

Contact

Send email to [email protected] for any inquiry on the usages.

hicat's People

Contributors

combio-dku avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

hicat's Issues

Could you please give more datasets? thanks.

Hello, I'm an undergraduate student and I'm very interested in your work. However, it seems quite difficult to find hierarchical datasets related to single-cell. Could you please provide more information about the datasets used in your paper to help me further my experiments in this field?

about example data

I would like to ask if I don't seem to find the subset tag in the sample data, only 'celltype_major' and 'celltype_minor'.

In addition, results from other methods are provided in the data, and I found that the different methods predicted a large disparity in the number of classes. However, these methods are based on marker data for classification, and removing the effect of unknown types, they should predict the same number of classes, right? I hope to get your help.

Quick Question

Quick question on the cell_markers_rndsystems.tsv file concerning abbreviations. What does exp stand for? Also, what does sec stand for?
Thank you,
Chase

Cannot get this to work with my data

I notice when you load the example "Melanoma_5k_rev.h5ad" it already has obs, var, and uns present in the file. Can you provide some guidance on how you processed your data to get it to this point? I have filtered_feature_bc_matrix.h5 files that I typically start my analysis from when analyzing with Scanpy. When I run HiCAT after processing my data I get the follow error:

## Marker file to use
mkr_file = '/mnt/c/Users/taylor81/Desktop/Scanpy/Multiome_9045-CT-1/cell_markers_rndsystems.tsv'

# df_pred, summary = \
#     HiCAT( X, marker_file = mkr_file, log_transformed = False,
#                    Clustering_algo = 'lv', Clustering_resolution = 1, 
#                    Target_FPR = 0.05, pval_th = 0.05,
#                    target_cell_types = [], ## all in the db
#                    minor_types_to_exclude = [], N_neighbors_minor = 21,
#                    N_neighbors_subset = 1, cycling_cell = False, 
#                    verbose = False )

target_tissues = [] # ['Immune', 'General']
target_cell_types = ['T cell', 'B cell', 'Myeloid cell', 'Fibroblast',
                     'Epithelial cell', 'Endothelial cell', 
                     'Mast cell', 'Smooth muscle cell'] 
to_exclude = [] 

df_pred, summary = \
    HiCAT( X, mkr_file, log_transformed = False,
           target_tissues = target_tissues, target_cell_types = target_cell_types, 
               minor_types_to_exclude = to_exclude, mkr_selector = '100000', 
               N_neighbors_minor = 31, N_neighbors_subset = 1,  
               Clustering_algo = 'lv', Clustering_resolution = 1, 
               Clustering_base = 'pca', N_pca_components = 15, 
               cbc_cutoff = 0.01, Target_FPR = 0.05, pval_th = 0.05,
               cycling_cell = False, copy_X = False, verbose = False )
ValueError: Input X contains NaN.
PCA does not accept missing values encoded as NaN natively. For supervised learning, you might want to consider sklearn.ensemble.HistGradientBoostingClassifier and Regressor which accept missing values encoded as NaNs natively. Alternatively, it is possible to preprocess the data, for instance by using an imputer transformer in a pipeline or drop samples with missing values. See https://scikit-learn.org/stable/modules/impute.html You can find a list of all estimators that handle NaN values at the following page: https://scikit-learn.org/stable/modules/impute.html#estimators-that-handle-nan-values

Thank you in advance for all your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.