R/extract_pc.R

Defines functions extract_pc

Documented in extract_pc

#' @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)
}
monahton/GencodeInterrogator documentation built on Dec. 24, 2019, 1:31 p.m.