knitr::opts_chunk$set( echo = TRUE, message = FALSE, warning = FALSE, eval = FALSE )
This guide provides detailed instructions for installing and configuring mLLMCelltype for cell type annotation in single-cell RNA sequencing data.
Before installing mLLMCelltype, ensure your system meets the following requirements:
mLLMCelltype is now available on CRAN. You can install it directly using:
# Install from CRAN install.packages("mLLMCelltype")
This will install the stable version of mLLMCelltype with all required dependencies.
To install the latest development version from GitHub:
# Install devtools if not already installed if (!requireNamespace("devtools", quietly = TRUE)) { install.packages("devtools") } # Install mLLMCelltype development version devtools::install_github("cafferychen777/mLLMCelltype", subdir = "R")
If you have downloaded the source code or need to install from a local copy:
# Assuming the package is in the current working directory devtools::install_local("path/to/mLLMCelltype/R")
mLLMCelltype depends on several R packages that will be automatically installed during the installation process. The main dependencies include:
For visualization and integration with single-cell analysis workflows, the following packages are recommended but not required:
mLLMCelltype requires API keys to access different LLM providers. You will need to obtain API keys for at least one of the supported providers:
Create a new API key
Anthropic (Claude-3.7/3.5)
Generate an API key
Google (Gemini-2.0/2.5)
Generate an API key
Other Providers
There are three ways to set up your API keys:
Create a .env file in your project directory with your API keys:
# API Keys for different LLM models OPENAI_API_KEY=your-openai-key ANTHROPIC_API_KEY=your-anthropic-key GEMINI_API_KEY=your-gemini-key DEEPSEEK_API_KEY=your-deepseek-key QWEN_API_KEY=your-qwen-key ZHIPU_API_KEY=your-zhipu-key STEPFUN_API_KEY=your-stepfun-key MINIMAX_API_KEY=your-minimax-key GROK_API_KEY=your-grok-key OPENROUTER_API_KEY=your-openrouter-key
Then load the environment variables in your R script:
library(dotenv) dotenv::load_dot_env()
You can directly provide API keys in function calls:
library(mLLMCelltype) results <- annotate_cell_types( input = your_marker_data, tissue_name = "human PBMC", model = "claude-sonnet-4-6", api_key = "your-anthropic-key", top_gene_count = 10 )
Set API keys as R environment variables:
Sys.setenv(OPENAI_API_KEY = "your-openai-key") Sys.setenv(ANTHROPIC_API_KEY = "your-anthropic-key") # Set other API keys as needed
To verify that mLLMCelltype is installed correctly and API keys are set up properly:
library(mLLMCelltype) # Check if the package is loaded correctly packageVersion("mLLMCelltype") # Verify API key setup for a specific provider api_key <- get_api_key("anthropic") if (!is.null(api_key) && api_key != "") { cat("Anthropic API key is set up correctly\n") } else { cat("Anthropic API key is not set up\n") }
If you encounter issues during installation:
install.packages("devtools") to ensure you have the latest versionIf you encounter issues connecting to LLM APIs:
# Example of setting proxy for httr httr::set_config(httr::use_proxy(url = "proxy_url", port = proxy_port))
For large datasets, you might encounter memory issues:
memory.limit(size = 16000) on Windows to increase available memoryNow that you have installed mLLMCelltype, you can proceed to:
If you encounter any issues not covered in this guide, please open an issue on our GitHub repository.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.