If I run an analysis which generates statistical tests on many SNPs I would naturally want to get more details on the most significant SNPs. Directly from within R one can get the information by loading RSNPer (from Bioconductor) and simply issuing a command SNPinfo(2073285). Unfortunately, the command cannot handle a vector and therefore only wants to do one at a time. I tried the lapply and sapply functions but was stymied temporarily lapply(best.snp,SNPinfo) #where best.snp is a vector of SNPs Error in FREQ[[1]] : subscript out of bounds [I do not know what that means] Nevertheless, I found that one of the SNPs was causing this and could bypass it by using the try function. lapply(best.snp,function(x) try(SNPinfo(x))) which let R continue One can then extract numbers or values out of the resultant output but this method lacks finesse and is not easy. Do you know of another method that would read the data and then write the resultant data to a dataframe? Another very useful feature for which I would like to use the same treatment is to use the SNPinfo as a way to get the gene information lapply(best.snp,function(x) try(geneDetails(SNPinfo(x)))) -- Farrel Buchinsky Mobile: (412) 779-1073 [[alternative HTML version deleted]]
Vincent Carey 525-2265
2007-Feb-05 01:23 UTC
[R] RSNPper SNPinfo and making it handle a vector
> If I run an analysis which generates statistical tests on many SNPs I would > naturally want to get more details on the most significant SNPs. Directly > from within R one can get the information by loading RSNPer (from > Bioconductor) and simply issuing a command SNPinfo(2073285). Unfortunately, > the command cannot handle a vector and therefore only wants to do one at a > time. > I tried the lapply and sapply functions but was stymied temporarily > lapply(best.snp,SNPinfo) #where best.snp is a vector of SNPs > Error in FREQ[[1]] : subscript out of bounds [I do not know what that means] > Nevertheless, I found that one of the SNPs was causing this and could bypass > it by using the try function. > > lapply(best.snp,function(x) try(SNPinfo(x))) which let R continue > One can then extract numbers or values out of the resultant output but this > method lacks finesse and is not easy.looks pretty easy to me. there is the nuisance of digging through the output but i have no use cases or -- to my knowledge, until you wrote -- any active users other than myself. so little motivation to push further. additionally, snpper is not particularly well maintained (builds seem pretty old) and i think it is going to be replaced. so i don't plan to put much more effort into it until i learn more about snpper.chip.org durability.> > Do you know of another method that would read the data and then write the > resultant data to a dataframe?i think you'll be able to do this with your lapply -- and contribute the code?> > Another very useful feature for which I would like to use the same treatment > is to use the SNPinfo as a way to get the gene information > lapply(best.snp,function(x) try(geneDetails(SNPinfo(x))))as above
Farrel Buchinsky <fjbuch at gmail.com> wrote:> If I run an analysis which generates statistical tests on many SNPs I would > naturally want to get more details on the most significant SNPs. Directly > from within R one can get the information by loading RSNPer (from > Bioconductor) and simply issuing a command SNPinfo(2073285). Unfortunately, > the command cannot handle a vector and therefore only wants to do one at a > time. > > Another very useful feature for which I would like to use the same treatment > is to use the SNPinfo as a way to get the gene information > lapply(best.snp,function(x) try(geneDetails(SNPinfo(x))))And Vincent Carey 525-2265 <stvjc at channing.harvard.edu> wrote:> additionally, snpper is not particularly well maintained (builds seem > pretty old) and i think it is going to be replaced. so i don't plan > to put much more effort into it until i learn more about snpper.chip.org > durability.You might instead look at Ensembl via the biomaRt package -- the HapMap Biomart interface does not (yet) implement the XML Mart interface that BiomaRt uses (boo hiss). These _are_ vectorized. I have made a couple of wrappers specific to SNPs, which you can email me about if they sound useful ("snps.by.name", "snps.by.region", "annotate.snps", "maf": they probably need to be updated before I show them off ;)). David Duffy -- | David Duffy (MBBS PhD) ,-_|\ | email: davidD at qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v
"Farrel Buchinsky" <fjbuch at gmail.com> wrote:> I tried biomaRt > > library(biomaRt) > ensnp = useMart("snp", dataset = "hsapiens_snp") > snp = getSNP(chromosome = 17, start = 73649033, end = 73679033, mart = > ensnp) > show(snp) > > Gave me a nice table but it did not seem to permit starting from the point > of knowing the SNP and entering a list of rs######. I guess I could always > fudge around. But it does not provide the one-stop I was looking for.Try, for example, getBM(attributes=c("refsnp_id","chr_name","chrom_start", "ensembl_external_gene_id","allele", "validated"), filter="refsnp", values=(refsnp=c("rs17166282","rs3897937")), mart=ensnp) -- | David Duffy (MBBS PhD) ,-_|\ | email: davidD at qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v