Let's say I have the genome hg19
loaded into R via BSGenome
library("BSgenome")
hg19genome = getBSgenome('BSgenome.Hsapiens.UCSC.hg19', masked=FALSE)
I then have a list of SNPs loaded as a GRanges object, gr
library(GenomicRanges)
> gr
GRanges object with 212 ranges and 3 metadata columns:
seqnames ranges strand | width REF ALT
<Rle> v <IRanges> <Rle> | <numeric>
[1] 1 [86099032, 86099032] * | 1 C T
[2] 1 [86099033, 86099033] * | 1 C A
[3] 1 [86099199, 86099199] * | 1 G A
....
Is there a straightforward way to inject these SNPs into hg19genome
?