Skip to content

Annotate cell type through gpt-4 without openai key.

License

Notifications You must be signed in to change notification settings

erganzi90/AICelltype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AICelltype

A python package same to R package GPTCelltype. Annotate cell type in scRNAseq study through gpt-4 but have no more need of openai key. More time spend with gpt4 model(about 10s) because of agency, try time saving method (about 5s) with qwen or ERNIE model. Patient please, remember LLM need time to cook your answer.

Installation

You can use pip install package directly.

pip install AICelltype

However I strongly recommend a virtual environment, if you do not have conda please install Miniconda first.

conda create -n aicelltype_env python=3.10.0
conda activate aicelltype_env
pip install AICelltype

Parameters

tissue_name
      In theory, tissue_name can be any type of biological tissue.
gene_list
      Identify one cell type for each row in gene_list.
model
      One model should be chosen from ['gpt4', 'qwen-max', 'ERNIE-4.0'].
      gpt4: annotate cell type through gpt4 (default);
      qwen-max: annotate cell type through ali qwen model, QWEN_KEY needed, refer to link for a key;
      ERNIE-4.0: annotate cell type through baidu qianfan model, API_KEY and SECRET_KEY, refer to link for them.

Usage

tissue_name = 'human prostate'
gene_lt = [
    ['KLK3', 'KRT8', 'KLK2', 'MSMB', 'ACPP', 'KLK1', 'KLK4'],
    ['MMRN1', 'FLT4', 'RELN', 'CCL21', 'PROX1', 'LYVE1'],
    ['CD69', 'IL7R', 'CD3D', 'CD3E', 'CD3G', 'ACTA2', 'MYO1B', 'ACTA2', 'ANPEP', 'PDGFRB', 'CSPG4'],
    ['DDX49', 'LOC105371196', 'MTND1P30', 'LOC105373682', 'TAGLN2', 'ZNF836', 'ZNF677', 'COILP1']
]

usage1:
    # gpt4 model
    from AICelltype import aicelltype
    cell_lt = aicelltype(tissue_name, gene_lt, model='gpt4')
    print(cell_lt)
output1:
    ['Prostate Epithelial Cells', 'Lymphatic Endothelial Cells', 'T Cell and Myofibroblast', 'Unknown Cell Type']  # In result, you can get a list with four cell types which have the same order with parameter gene_list.

usage2:
    # qwen-max model
    import os
    os.environ['QWEN_KEY'] = 'your QWEN_KEY'  # Add QWEN_KEY to environ, keep secret to yourself.
    
    from AICelltype import aicelltype
    cell_lt = aicelltype(tissue_name, gene_lt, model='qwen-max')
    print(cell_lt)
output2:
    ['Prostate secretory epithelial cell', 'Lymphatic endothelial cell', 'Immune cell (likely T-cell) and smooth muscle cell mixture', 'Unknown cell type']

usage3:
    # ERNIE-4.0 model
    import os
    os.environ['API_KEY'] = 'your AIP_KEY'  # Add API_KEY to environ, keep secret to yourself.
    os.environ['SECRET_KEY'] = 'your SECRET_KEY'  # Add SECRET_KEY to environ, keep secret to yourself.
    
    from AICelltype import aicelltype
    cell_lt = aicelltype(tissue_name, gene_lt, model='ERNIE-4.0')
    print(cell_lt)
output3:
    ['Prostate glandular cells (or Prostate epithelial cells)', 'Lymphatic endothelial cells', 'T-cells (or T-lymphocytes)', 'Unknown cell type (or Possibly cancer-associated cells or Stromal cells; needs further investigation)']  # This model give more explaination.

FAQ

See https://github.com/erganzi90/AICelltype/issues

About

Annotate cell type through gpt-4 without openai key.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages