Entering edit mode
mmaguire
▴
20
@mmaguire-4574
Last seen 10.2 years ago
To whom it may concern,
I work in the DGVa group at EBI, this group works on structural
variants. I ran into a problem using the R package biomaRt when
attempting to retrieve information from the "snps" mart
"hsapiens_structvar" dataset,
here is my code with comments:
Here is the R code that I've written:
# Testing retrieval of SVs from Biomart
library(biomaRt)
# Select the version "ENSEMBL VARIATION 61 (SANGER UK)"
ensembl.var <- useMart("snps")
# Select SV dataset from the chosen mart
sv <- useDataset("hsapiens_structvar", mart=ensembl.var)
# Set attributes and filters for the chosen dataset and retrieve the
data into a data frame
chr6.svs<-getBM(c("chrom_start", "chrom_end",
"structural_variation_name"), filters=c("chr_name"), values=list(6),
mart=sv)
# Check for returned data (brings back 65,532 rows for chromosome 6)
summary(chr6.svs)
# Write the data frame to a text file
write.table( chr6.svs, file='chr6_svs_from_biomart.txt', sep="\t",
quote=FALSE, append=FALSE, na="", row.names=FALSE )
# Adding "description" to the vector of attributes in the above call
to function "getBM()" causes the code to fail with the error given
below.
chr6.svs <- getBM(c("chrom_start", "chrom_end",
"structural_variation_name", "description"), filters=c("chr_name"),
values=list(6), mart=sv) # Does not work
#Error returned by R when attempting to get the SV description
attribute:
# Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings, :
# line 135 did not have 4 elements
The code fails when the SV "description" attribute is added. I think
the problem arises due to the spaces in the "description" field with R
incorrectly interpreting each space delimited word as vector element.
My R is limited so I may be wrong. Anyway, I can run the same query
from the web interface and correctly retrieve the "description"
attribute.
I've checked this with our Biomart person, Rhoda Kinsella, and the
data in the Biomart looks correct and, as stated above, we can export
it from the web interface.
Any help gratefully received.
Cheers
Mick
> Michael Maguire
> Variation Archive Bioinformatician
> European Bioinformatics Institute
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge CB10 1SD
>
> Phone +44 1223 494674
> Email mmaguire@ebi.ac.uk
[[alternative HTML version deleted]]