Clark Jeremy
2024-Nov-15 09:55 UTC
[R] R coding to extract allele frequencies from NCBI for ALL alleles of one SNP?
Dear All, The following code extracts from NCBI very nice output for ONE allele of a SNP (often the allele with the second largest frequency - usually termed the minor allele). It gives an average minor allele frequency from all NCBI sources (which is what I want, except I'd like the addition of data for all the other alleles of one SNP) plus a table of minor allele frequencies from each source (which would also be nice - but not necessary). Does there exist a package in R with coding which could extract the data from NCBI for all the alleles of one SNP ? I've looked at getBM() from package biomaRt and searched via Google and Copilot- so far with no success. Many thanks. remotes::install_github("ropensci/rsnps") library("rsnps") # Define the SNP ID snp_id <- "rs11134679" ## this SNP has alleles A, C, G and T, but results are only for A # Query the dbSNP database result <- rsnps::ncbi_snp_query(snp_id) result2 <- as.data.frame(result) result2 result2$maf_population [[alternative HTML version deleted]]
Bert Gunter
2024-Nov-15 15:28 UTC
[R] R coding to extract allele frequencies from NCBI for ALL alleles of one SNP?
If you haven't already done so, this might be better posted on Bioconductor: https://www.bioconductor.org/ Cheers, Bert On Fri, Nov 15, 2024 at 2:53?AM Clark Jeremy <jeremy.clark at pum.edu.pl> wrote:> Dear All, > > The following code extracts from NCBI very nice output for ONE allele of a > SNP (often the allele with the second largest frequency - usually termed > the minor allele). It gives an average minor allele frequency from all NCBI > sources (which is what I want, except I'd like the addition of data for all > the other alleles of one SNP) plus a table of minor allele frequencies from > each source (which would also be nice - but not necessary). Does there > exist a package in R with coding which could extract the data from NCBI for > all the alleles of one SNP ? I've looked at getBM() from package biomaRt > and searched via Google and Copilot- so far with no success. Many thanks. > > remotes::install_github("ropensci/rsnps") > library("rsnps") > # Define the SNP ID > snp_id <- "rs11134679" ## this SNP has alleles A, C, G and T, but results > are only for A > # Query the dbSNP database > result <- rsnps::ncbi_snp_query(snp_id) > result2 <- as.data.frame(result) > result2 > result2$maf_population > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]