prune.genes: Prune markers by physical position

Description Usage Arguments Details Value Author(s) Examples

View source: R/gene.R

Description

Selects subset of markers so that all excluded markers are within threshold physical genes of included markers.

Usage

1
prune.genes(chr, pos, genetable, genes, win.size = 10000)

Arguments

chr

Chromosome

pos

Position

genetable

A data frame of a UCSC genome browser table

genes

Genes

win.size

Distance threshold

Details

To write.

genetable could be the refgene or GENCODE table from UCSC. It must have columns “chrom”, “txStart”, “txEnd”, “name2”.

Value

A vector of true/false.

Author(s)

Toby Johnson Toby.x.Johnson@gsk.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(gencode14.UGT1A1)
markers <- data.frame(CHROM = paste("chr", c(rep(1, 1000), rep(2, 3000)), sep = ""),
                      POS = sort(runif(4000, 233000000, 235000000)),
		      pval = runif(4000, 1e-5, 1))
## within 5kb of either of two genes
markers$nearGene <- prune.genes(markers$CHROM, markers$POS, gencode14.UGT1A1, c("DNAJB3", "HJURP"), 5000)
with(markers, table(CHROM, nearGene))

leftrightpos <- c(234568893, 234781945)
plot.new()
plot.window(leftrightpos, c(-5, 5))
abline(h = 0, col = "grey")
gene.draw(2, leftrightpos[1], leftrightpos[2], gencode14.UGT1A1, genesep = 5000)
axis(1, at = pretty(leftrightpos * 1e-6)*1e6, labels = pretty(leftrightpos * 1e-6))
title(xlab = "chr2 genomic position (Mb)")
axis(2, at = 0:5, las = 1)
box()

with(markers, points(POS, -log10(pval), pch = 21, bg = ifelse(nearGene, "red", "grey")))

tobyjohnson/gtx documentation built on Aug. 30, 2019, 8:07 p.m.