#' @title Extract protein-coding genes from basic annotation file
#'
#' @description This function takes a dataframe of basic annotations provided by Gencode as input. (To load the gtf file, check load_gtf function). The function extracts from the dataframe all the protein-coding genes and gives as an output a dataframe in the R Global Environment. The output dataframe includes the gene, transcript and exon annotations.
#' @usage extract_pc(x)
#' @param x The name of the downloaded basic annoation gtf file from GENCODE website
#' @export
#' @keywords
#' @seealso
#' @return A dataframe of protein-coding genes from the gtf file selected
#' examples \dontrun {
#' # You don't have to run this
#' load_gtf("gencode.v27.lncRNAs.gtf")
#’}
extract_pc <- function(x) {
a <- subset(x, x$gene_type=="protein_coding")
b <- subset(a, a$type=="gene" | a$type=="transcript" | a$type=="exon")
return(b)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.