injectSNPs             package:BSgenome             R Documentation

_S_N_P _i_n_j_e_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Inject SNPs from a SNPlocs data package into a genome.

_U_s_a_g_e:

       available.SNPs(type=getOption("pkgType"))
       injectSNPs(x, SNPlocs_pkgname)

       ## Related utilities
       SNPlocs_pkgname(x)
       SNPcount(x)
       SNPlocs(x, seqname)

_A_r_g_u_m_e_n_t_s:

    type: Character string indicating the type of package ('"source"',
          '"mac.binary"' or '"win.binary"') to look for. 

       x: A BSgenome object. 

SNPlocs_pkgname: The name of a SNPlocs data package containing SNP
          information for the single sequences contained in 'x'. This
          package must be already installed ('injectSNPs' won't try to
          install it). 

 seqname: The name of a single sequence in 'x'. 

_V_a_l_u_e:

     'available.SNPs' returns a character vector containing the names
     of the SNPlocs data packages that are currently available on the
     Bioconductor repositories for your version of R/Bioconductor. A
     SNPlocs data package contains basic SNP information (location and
     alleles) for a given organism.

     'injectSNPs' returns a copy of the original genome 'x' where some
     or all of the single sequences were altered by injecting the SNPs
     defined in the 'SNPlocs_pkgname' package.

     'SNPlocs_pkgname', 'SNPcount' and 'SNPlocs' return 'NULL' if no
     SNPs were injected in 'x' (i.e. if 'x' is not a BSgenome object
     returned by a previous call to 'injectSNPs'). Otherwise
     'SNPlocs_pkgname' returns the name of the package from which the
     SNPs were injected, 'SNPcount' the number of SNPs for each altered
     sequence in 'x', and 'SNPlocs' their locations in the sequence
     whose name is specified by 'seqname'.

_N_o_t_e:

     'injectSNPs', 'SNPlocs_pkgname', 'SNPcount' and 'SNPlocs' have the
     side effect to try to load the SNPlocs data package if it's not
     already loaded.

_A_u_t_h_o_r(_s):

     H. Pages

_S_e_e _A_l_s_o:

     BSgenome-class, '.inplaceReplaceLetterAt'

_E_x_a_m_p_l_e_s:

       ## Get the list of SNPlocs data packages currently available:
       available.SNPs()

       if (interactive()) {
         ## Make your choice and install with:
         source("http://bioconductor.org/biocLite.R")
         biocLite("SNPlocs.Hsapiens.dbSNP.20071016")
       }

       ## Inject SNPs from dbSNP into the Human genome:
       library(BSgenome.Hsapiens.UCSC.hg18)
       Hsapiens
       SNPlocs_pkgname(Hsapiens)

       HsWithSNPs <- injectSNPs(Hsapiens, "SNPlocs.Hsapiens.dbSNP.20071016")
       HsWithSNPs  # note the extra "with SNPs injected from ..." line
       SNPlocs_pkgname(HsWithSNPs)
       SNPcount(HsWithSNPs)
       SNPlocs(HsWithSNPs, "chr1")

       alphabetFrequency(Hsapiens$chr1)
       alphabetFrequency(HsWithSNPs$chr1)

