biomaRt getBM returns allele as logical instead of character
0
1
Entering edit mode
@christian-ruckert-3294
Last seen 5.5 years ago
Germany

The following biomaRt query returns the minor_allele column as logical instead of character:
 

library("biomaRt")

mart <- useMart(host="feb2014.archive.ensembl.org", biomart="ENSEMBL_MART_SNP")
ensembl <- useDataset("hsapiens_snp", mart=mart)


res <- getBM(attributes=c("chr_name","chrom_start","chrom_strand","allele","refsnp_id", "refsnp_source","minor_allele", "minor_allele_freq"),
filters=c("chr_name", "chrom_start", "chrom_end"), values=list("11", 108202735,108202740), mart=ensembl)

> res
  chr_name chrom_start chrom_strand        allele   refsnp_id refsnp_source
1       11   108202738            1           C/T rs186666661         dbSNP

  minor_allele minor_allele_freq
1         TRUE       0.000459137

> class(res$minor_allele)
[1] "logical"

 

If using a wider range the minor allele is returned correctly:

> res <- getBM(attributes=c("chr_name", "chrom_start","chrom_strand","allele","refsnp_id", "refsnp_source",  "minor_allele", "minor_allele_freq"),
filters=c("chr_name", "chrom_start", "chrom_end"), values=list("11", 108202650,108202740),
mart=ensembl)

> res
  chr_name chrom_start chrom_strand        allele   refsnp_id refsnp_source
1       11   108202681            1 HGMD_MUTATION    CD991612   HGMD-PUBLIC
2       11   108202681            1 HGMD_MUTATION    CD991613   HGMD-PUBLIC
3       11   108202685            1           A/G  rs28904920         dbSNP
4       11   108202685            1 HGMD_MUTATION   CM0910523   HGMD-PUBLIC
5       11   108202716            1           A/C rs199915459         dbSNP
6       11   108202738            1           C/T rs186666661         dbSNP
  minor_allele minor_allele_freq
1                             NA
2                             NA
3                             NA
4                             NA
5            C       0.000459137
6            T       0.000459137

> class(res$minor_allele)
[1] "character"

Is there any way to circumvent this behaviour

 

Regards,

Christian

 

 

biomart getBM logical error • 1.4k views
ADD COMMENT

Login before adding your answer.

Traffic: 768 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6