Untitled
unknown
plain_text
a year ago
804 B
6
Indexable
# Install and load the required packages
if (!requireNamespace("annotate", quietly = TRUE)) {
install.packages("BiocManager")
BiocManager::install("annotate")
}
if (!requireNamespace("org.Hs.eg.db", quietly = TRUE)) {
BiocManager::install("org.Hs.eg.db")
}
library(annotate)
library(org.Hs.eg.db)
# Read Entrez Gene IDs from a file
entrez_ids <- readLines("path/to/entrez.txt") # Replace with your file's path
# Use the lookUp function to map Entrez IDs to HGNC symbols
symbols <- lookUp(entrez_ids, "org.Hs.eg", "SYMBOL")
# Convert to a data frame for better visualization
result <- data.frame(EntrezGene_ID = names(symbols), HGNC_Symbol = unlist(symbols))
# Save the results to a CSV file
write.csv(result, "entrez_to_hgnc_mapping.csv", row.names = FALSE)
# Print the results
print(result)Editor is loading...
Leave a Comment