Last data update: 2014.03.03

R: Find closest refseq gene
findClosestGeneR Documentation

Find closest refseq gene

Description

This function is used to find the nearest refseq transcript(s) to a point in the genome specified. Note that it is limited to the refseq transcripts listed at genome.ucsc.edu, where this function goes for information.

Usage

findClosestGene(chrom, pos, genome = "hg17", position = "txStart")

Arguments

chrom

Usually specified like 'chr1', 'chr2', etc.

pos

A position in base pairs in the genome

genome

Something like 'hg16', 'hg17', 'mm6', etc.

position

The location to measure distance from: one of 'txStart', 'txEnd', 'cdsStart', 'cdsEnd'

Details

The first time the function is run, it checks to see if the refflat table for the given genome is present in the package environment. If not, it downloads it to the /tmp directory and gunzips it (using getRefflat. It is then stored so that in future calls, there is no re-download required.

Value

A data frame with the gene name, refseq id(s), txStart, txEnd, cdsStart, cdsEnd, exon count, and distance. Note that distance is measured as pos-position, so negative values mean that the point in the gene is to the left of the point specified in the function call (with the p-tel on the left).

Note

The function may return more than one transcript, as several transcripts may have the same start site

Author(s)

Sean Davis <sdavis2@mail.nih.gov>

Examples

findClosestGene('chr1',100000000,'hg17')

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ACME)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ACME/findClosestGene.Rd_%03d_medium.png", width=480, height=480)
> ### Name: findClosestGene
> ### Title: Find closest refseq gene
> ### Aliases: findClosestGene
> ### Keywords: IO
> 
> ### ** Examples
> 
> findClosestGene('chr1',100000000,'hg17')
trying URL 'http://hgdownload.cse.ucsc.edu/goldenPath/hg17/database/refFlat.txt.gz'
Content type 'application/x-gzip' length 3423284 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

     geneName      name chrom strand   txStart     txEnd  cdsStart    cdsEnd
2388      AGL NM_000642  chr1      + 100027660 100101600 100028619 100099228
     exonCount Distance
2388        34    27660
Warning message:
In read.table(file = file, header = header, sep = sep, quote = quote,  :
  seek on a gzfile connection returned an internal error
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>