feature-link-functions.Rd
When listing features in an interactive table, it's often useful to link the feature to an external webpage that has more information about that feature. We include a series of functions to link entrez or ensembl id's to different web pages. The data.frame needs to have a `feature_id` column which will be used to link out to the reference page.
If `link.col` is not found in the data.frame `x` then the provided functions are NO-OPS, ie. the same data.frame is simply returned.
.empty_link_function(x, link.col = NULL)
ncbi.entrez.link(x, link.col = "symbol")
genecards.entrez.link(x, link.col = "symbol")
a modified `x` with an html link in `link.col`.
These were implemented a while ago when our world focused on entrez id's, we need to update.
ncbi.entrez.link
: links gene to ncbi web site by entrez id.
genecards.entrez.link
: links a gene row to the genecards website
by entrez id
sr <- sparrow::exampleSparrowResult()
lfc <- sparrow::logFC(sr)
# the symbol column in `lfhc` will be a linked to the entrez web page for
# each gene
linked <- ncbi.entrez.link(lfc, link.col = "symbol")
head(linked[["symbol"]])
#> [1] "<a href=\"https://www.ncbi.nlm.nih.gov/gene/?term=1\" target=\"_blank\">A1BG</a>"
#> [2] "<a href=\"https://www.ncbi.nlm.nih.gov/gene/?term=100\" target=\"_blank\">ADA</a>"
#> [3] "<a href=\"https://www.ncbi.nlm.nih.gov/gene/?term=1000\" target=\"_blank\">CDH2</a>"
#> [4] "<a href=\"https://www.ncbi.nlm.nih.gov/gene/?term=10000\" target=\"_blank\">AKT3</a>"
#> [5] "<a href=\"https://www.ncbi.nlm.nih.gov/gene/?term=100009676\" target=\"_blank\">LOC100009676</a>"
#> [6] "<a href=\"https://www.ncbi.nlm.nih.gov/gene/?term=10001\" target=\"_blank\">MED6</a>"