text: user146: 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?
  
  user383: This seems relatively complicated given the structure of a BSGenome object.
  The creator of the package answered this question previously on the Bioconductor support forums:
  https://support.bioconductor.org/p/86665/#86757
  
  We don't provide an easy way to inject arbitrary SNPs in an arbitrary
    BSgenome at the moment. However, it should not be too hard to forge
    the BSgenome ... package. First you would need to
    compute the sequences of the mutated chromosomes (you can
    use replaceLetterAt for this), then write them to a 2bit file (put
    them in a DNAStringSet object and call rtracklayer::export on it),
    then use that 2bit file to forge the BSgenome ....
    package (see the BSgenomeForge vignette in the BSgenome package for
    how to do this).
    - Herve Pages
  
  Here is another similar question with more info about replaceLetterAt: https://support.bioconductor.org/p/26199/
  
original_text: 146: <p>Let's say I have the genome <code>hg19</code> loaded into R via BSGenome</p>
  
  <pre><code>library("BSgenome")    
  hg19genome = getBSgenome('BSgenome.Hsapiens.UCSC.hg19', masked=FALSE)   
  </code></pre>
  
  <p>I then have a list of SNPs loaded as a GRanges object, <code>gr</code></p>
  
  <pre><code>library(GenomicRanges)
  
   &gt; gr
   GRanges object with 212 ranges and 3 metadata columns:                                                                                                                                                                                                                                                                                                                                                
          seqnames               ranges strand |     width     REF    ALT                                                                                                                                                                                                                                                                                                                             
             &lt;Rle&gt;          v &lt;IRanges&gt;  &lt;Rle&gt; | &lt;numeric&gt;                                                                                                                                                                                                                                                                                                                        
      [1]        1 [86099032, 86099032]      * |         1     C      T                                                                                                                                                                                                                                                                                                                  
      [2]        1 [86099033, 86099033]      * |         1     C      A                                                                                                                                                                                                                                                                                                                   
      [3]        1 [86099199, 86099199]      * |         1     G      A  
    ....
  </code></pre>
  
  <p>Is there a straightforward way to inject these SNPs into <code>hg19genome</code>?</p>
   383: <p>This seems relatively complicated given the structure of a BSGenome object.</p>
  
  <p>The creator of the package answered this question previously on the Bioconductor support forums:
  <a href="https://support.bioconductor.org/p/86665/#86757" rel="nofollow noreferrer">https://support.bioconductor.org/p/86665/#86757</a></p>
  
  <blockquote>
    <p>We don't provide an easy way to inject arbitrary SNPs in an arbitrary
    BSgenome at the moment. However, it should not be too hard to forge
    the BSgenome ... package. First you would need to
    compute the sequences of the mutated chromosomes (you can
    use replaceLetterAt for this), then write them to a 2bit file (put
    them in a DNAStringSet object and call rtracklayer::export on it),
    then use that 2bit file to forge the BSgenome ....
    package (see the BSgenomeForge vignette in the BSgenome package for
    how to do this).
    - Herve Pages</p>
  </blockquote>
  
  <p>Here is another similar question with more info about replaceLetterAt: <a href="https://support.bioconductor.org/p/26199/" rel="nofollow noreferrer">https://support.bioconductor.org/p/26199/</a></p>
  