The function maps SNPs to classes based on genome coordinates
Usage
map2class(coords, SNPs, extend.boundary = 0)
Arguments
coords
A data frame containing chromosome and upper and lower coordinates for a each class to be mapped. This must include column names 'chr', 'start', 'stop', and 'class'.
SNPs
A data frame containing genome coordinates of SNPs. This must include column names 'SNP', 'chr', 'position'.
extend.boundary
Number of base pairs to extend the class coordinates for mapping.
Details
Genomic coordinates defining the class boundaies in object, coors, and SNP location in object, SNPs should be annotated within the same build.
Note: That if using the map2class function to map SNPs to classes to use in the GenCAT function, then additional columns for effect_allele and other_allele can be used.
Value
A data frame with SNP information including class label.
Author(s)
Eric Reed, Sara Nunez, Jing Qian, Andrea Foulkes
Examples
data('CardioData')
data('coords')
######################
#Mapping SNPs to genes
######################
print(head(coords))
#Subset CardioData to decrease CPU time
CardioDataSub<-CardioData[CardioData$chr < 15,]
set.seed(1)
CardioDataSub<-CardioDataSub[sample(1:nrow(CardioDataSub), 100),]
print(head(CardioDataSub))
CardioMapped<-map2class(coords, CardioDataSub, extend.boundary = 5000)
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(GenCAT)
Loading required package: dplyr
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
Loading required package: ggplot2
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GenCAT/map2class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: map2class
> ### Title: Mapping SNPs to Classes
> ### Aliases: map2class
> ### Keywords: ~kwd1 ~kwd2
>
> ### ** Examples
>
> data('CardioData')
> data('coords')
>
> ######################
> #Mapping SNPs to genes
> ######################
> print(head(coords))
chr start stop class
1 1 69090 70008 OR4F5
2 1 367658 368597 OR4F29-1
3 1 621095 622034 OR4F29-2
4 1 861120 879961 SAMD11
5 1 879582 894679 NOC2L
6 1 895966 901099 KLHL17
>
> #Subset CardioData to decrease CPU time
> CardioDataSub<-CardioData[CardioData$chr < 15,]
> set.seed(1)
> CardioDataSub<-CardioDataSub[sample(1:nrow(CardioDataSub), 100),]
>
> print(head(CardioDataSub))
SNP effect_allele other_allele testStat chr position
28809 rs17076895 G A -0.3420408 13 19756051
37688 rs1955633 G T -0.4473971 14 58483217
57498 rs4772299 G A -1.7237480 13 101147019
88758 rs9535722 C A -0.7384099 13 52207488
19668 rs12886900 G A 0.1953169 14 79443038
88135 rs9530612 C A 0.8900307 13 77522290
>
> CardioMapped<-map2class(coords, CardioDataSub, extend.boundary = 5000)
[1] "Mapping SNPs to classes on chromosome 13."
[1] "Mapping SNPs to classes on chromosome 14."
>
>
>
>
>
> dev.off()
null device
1
>