#' Extract Gene IDs from FeatureData or Convert from Probes
#'
#' @param gse_ESet ExpressionSet S4 object.
#' @param data_species A string stating the species of your sequenced data e.g. "hsapiens".
#' @param target_namespace The namespace you'd like your probe set to be converted to. A comprehensive
#' list can be found on the gProfileR online tool under the g:Convert tab.
#' @param convert_to_species This option is only passed if you need to convert your probeset or gene symbols
#' to another species for downstream analysis. Ignore if no conversion is necessary.
#' @param numeric_ns Your probes are from a specific probe set and identifying that probeset helps
#' gconvert know how to convert the probes properly. A list of probe sets properly formatted for
#' gconvert can be found on the gProfileR webpage under the g:Convert tab.
#'
#' @return gene_symb a list of gene symbols corresponding to the rows of your expression data
#' @export
#'
#' @examples
#'
#' gse <- download_gse_data("GSE108000")
#'
#' gene_symb <- extract_or_convert_gene_ids(gse, data_species = "hsapiens",
#' target_namespace = "ENTREZGENE",
#' numeric_ns = "AFFY_HUEX_1_0_ST_V2")
#'
extract_or_convert_gene_ids <- function(gse_ESet = NULL, data_species = NULL,
target_namespace = NULL, convert_to_species = NULL,
numeric_ns = "") {
feature_headers <- Biobase::varLabels(Biobase::featureData(gse_ESet))
if ("GENE_SYMBOL" %in% feature_headers) {
gene_symb <- gse_ESet@featureData@data$GENE_SYMBOL
}else{
probe_names <- rownames(Biobase::exprs(gse_ESet))
converted_probes <- gProfileR::gconvert(probe_names, organism = data_species,
target = target_namespace, numeric_ns = numeric_ns)
gene_symb <- converted_probes$target
}
return(gene_symb)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.