Learn R Programming

cnvGSA (version 1.10.0)

getCnvGenes: Determine genes hit by CNVs

Description

Takes as input a data frame of CNVs and a data frame of gene coordinates and returns the genes hit by each CNV.

Usage

getCnvGenes( cnv, genemap, delim )

Arguments

cnv
Data frame containing the CNVs. It should contain at least the following columns: - Chr: Chromosome on which the CNV is found (e.g. ``1'', ``12'', ``X'') - Coord_i: Initial coordinate (aka start position) of the CNV on the chromosome - Coord_f: Final coordinate (aka end position) of the CNV on the chromosome
genemap
Data frame containing genes along with the chromosomes and coordinates for each. The columns should be similar to the cnv data frame: - Chr: Chromosome on which the gene is found (e.g. ``1'', ``12'', ``X'') - Coord_i: Initial coordinate (aka start position) of the gene on the chromosome - Coord_f: Final coordinate (aka end position) of the gene on the chromosome - GeneID: Gene ID
delim
Character to be used to separate genes in the output for each CNV.

Value

A vector in which each element contains a delimited string of the genes that fall within the range of the corresponding CNV in the input.

Examples

Run this code
library("cnvGSAdata")

## Read in the example gene map
genemapFile <- system.file(
	"extdata",
	"merge_00k_flank_hg18_refGene_jun_2011_exon.gff",
	package = "cnvGSAdata"
)
fields <- read.table(
	genemapFile,
	sep = "\t",
	comment.char = "",
	quote = "\"",
	header = FALSE,
	stringsAsFactors = FALSE
)
genemap <- data.frame(
	Chr = fields[,1],
	Coord_i = fields[,4],
	Coord_f = fields[,5],
	GeneID = fields[,11],
	stringsAsFactors = FALSE
)
genemap$Chr <- sub(genemap$Chr, pattern = "chr", replacement = "")

## Read in a few CNVs
cnvFile <- system.file("extdata", "cnv.gvf", package="cnvGSAdata")
cnv <- readGVF(cnvFile)
cnv <- cnv[1:5,]

## Get CNV genes
delim <- ";"
genes <- getCnvGenes(cnv, genemap, delim)

Run the code above in your browser using DataLab