biomaRt error Error in scan.... Line 1 did not have 3 elements.
1
2
Entering edit mode
amp221 ▴ 20
@amp221-24322
Last seen 3.5 years ago

I tried running my pipeline and I encounter this error in biomart-getMB function: Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 1 did not have 3 elements.

It is a well-used pipeline and I never encounter this error. After a lot of time struggling with my script, I tried getMB biomart webpage example, with the same result:

ensembl = useEnsembl(biomart="ensembl", dataset="hsapiensgeneensembl") chr1genes <- getBM(attributes=c('ensemblgeneid','ensembltranscriptid','hgncsymbol','chromosomename','startposition','endposition'), filters ='chromosomename', values ="1", mart = ensembl)

Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 1 did not have 3 elements.

Anyone knows how to solve it??

Thank you in advance

biomaRt • 2.6k views
ADD COMMENT
0
Entering edit mode

The error may be related to issues being discussed on this thread.

ADD REPLY
0
Entering edit mode

Thank you so much for your link. Indeed, after updating biomaRt, adding host and restarting R session, it works fine!

ADD REPLY
0
Entering edit mode
Mike Smith ★ 6.5k
@mike-smith
Last seen 1 hour ago
EMBL Heidelberg

With the latest version of R and biomaRt I'm unable to reproduce this at the moment (see the example code below).

I'm a bit confused by the error message, as I think it relates to the result sent back from the server. This is normally a text file, which biomaRt reads back in. It will throw this error if you've asked for 3 columns of data in your attributes argument, but whatever gets sent back doesn't actually have 3 columns. However you've clearly asked for 6 attributes, so perhaps my diagnosis is incorrect.

Currently (Mon Oct 12 08:59:39 CEST 2020) the Ensembl site has the following message, suggesting there's some issues their side.

This site is currently in maintenance mode and has limited functionality. We apologise for any inconvenience this may cause. We are working to restore full functionality.`

Since it's working for me this was hopefully some transient thing that has passed now.

library("biomaRt")

ensembl <- useEnsembl(biomart = "ensembl", dataset="hsapiens_gene_ensembl") 
chr1genes <- getBM(attributes = c('ensembl_gene_id','ensembl_transcript_id','hgnc_symbol',
                                'chromosome_name','start_position','end_position'), 
                   filters ='chromosome_name', values ="1", mart = ensembl)
head(chr1genes)
#>   ensembl_gene_id ensembl_transcript_id hgnc_symbol chromosome_name
#> 1 ENSG00000227205       ENST00000475753      PFN1P9               1
#> 2 ENSG00000226446       ENST00000443481    NOTCH2P1               1
#> 3 ENSG00000134249       ENST00000369400      ADAM30               1
#> 4 ENSG00000134250       ENST00000256646      NOTCH2               1
#> 5 ENSG00000134250       ENST00000493703      NOTCH2               1
#> 6 ENSG00000134250       ENST00000478864      NOTCH2               1
#>   start_position end_position
#> 1      119853316    119853748
#> 2      119886304    119886927
#> 3      119893533    119896515
#> 4      119911553    120100779
#> 5      119911553    120100779
#> 6      119911553    120100779

sessionInfo()
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Linux Mint 19
#> 
#> Matrix products: default
#> BLAS:   /home/msmith/Applications/R/R-4.0.2/lib/libRblas.so
#> LAPACK: /home/msmith/Applications/R/R-4.0.2/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] biomaRt_2.45.6
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.5           pillar_1.4.6         dbplyr_1.4.4        
#>  [4] compiler_4.0.2       highr_0.8            prettyunits_1.1.1   
#>  [7] tools_4.0.2          progress_1.2.2       digest_0.6.25       
#> [10] bit_4.0.4            lifecycle_0.2.0      tibble_3.0.3        
#> [13] BiocFileCache_1.13.1 RSQLite_2.2.1        evaluate_0.14       
#> [16] memoise_1.1.0        pkgconfig_2.0.3      rlang_0.4.7         
#> [19] DBI_1.1.0            curl_4.3             yaml_2.2.1          
#> [22] parallel_4.0.2       xfun_0.18            dplyr_1.0.2         
#> [25] stringr_1.4.0        httr_1.4.2           knitr_1.30          
#> [28] xml2_1.3.2           rappdirs_0.3.1       generics_0.0.2      
#> [31] vctrs_0.3.4          S4Vectors_0.27.13    askpass_1.1         
#> [34] IRanges_2.23.10      hms_0.5.3            tidyselect_1.1.0    
#> [37] stats4_4.0.2         bit64_4.0.5          glue_1.4.2          
#> [40] Biobase_2.49.1       R6_2.4.1             AnnotationDbi_1.51.3
#> [43] XML_3.99-0.5         rmarkdown_2.4        purrr_0.3.4         
#> [46] blob_1.2.1           magrittr_1.5         ellipsis_0.3.1      
#> [49] htmltools_0.5.0      BiocGenerics_0.35.4  assertthat_0.2.1    
#> [52] stringi_1.5.3        openssl_1.4.3        crayon_1.3.4
ADD COMMENT
2
Entering edit mode

Hi Mike, I am receiving the same error, running a pipeline which ran successfully with no errors a few days ago. This is with the most up-to-date version of biomaRt.

Update - it works for me now by switching out 'useDataset/useMart' with 'useEnsembl'! Thanks.

ADD REPLY

Login before adding your answer.

Traffic: 911 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