[R] efetch result not in character format

David Winsemius dwinsemius at comcast.net
Sat Jun 10 07:00:32 CEST 2017


> On Jun 9, 2017, at 10:45 AM, Ezra Bekele <ezrabekele17 at gmail.com> wrote:
> 
> Hi,
> 
> I want to use reutils to obtain the accession numbers of a query search in
> character format. When I use efetch, the accession number isn't in a
> character format, and I'm not sure if the number is accurate, because I get
> the error:
> 
> Error in file.exists(destfile) : object 'destfile' not found
> 
> This is what I tried:
> 
> UIDs<-esearch( "Methylation" )

When I follow the rabbithole that is a question about a package I don't use, I first read the help pages for the functions that are proposed:
Search on efetch:
+++++++++++
Value

An efetch object.
+++++++

=====follow link to efetch======

Class "eutil": Reference classes that hold the response from EUtils requests.

Description
The reference classes eutil, einfo, esearch, esummary, efetch, elink, epost,egquery, espell, and ecitmatch implement the request generator for interaction with the NCBI services. They should not be used direcly, but initialized through the respective constructor functions einfo, esearch, esummary, efetch, elink, epost, egquery, espell, andecitmatch.
===

Note second sentence, and ...


> print(accession_numbers)
Object of class ‘efetch’ 
NDEW01000036.1
NDEX01000017.1
NDET01000017.1
NDEX01000020.1
NDEX01000029.1
NDET01000061.1
NDET01000086.1
NDEW01000125.1
NDEW01000140.1
NDEQ01000011.1
NDEY01000012.1
NDEY01000036.1
...
EFetch query using the ‘nuccore’ database.
Query url: ‘https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?=efetch&db=nuccore...’
Retrieval type: ‘acc’, retrieval mode: ‘text’

> str(accession_numbers)
Error: This document does not contain XML data


I'm not going to be much help beyond this.


> 
> accession_numbers = efetch(UIDs, rettype = "acc")
> 
> How do I obtain only the accession number and is the number accruate?
> 
> Thank you
> 
> 	[[alternative HTML version deleted]]

Asking nicely: Please do post in plain text as suggested strongly by the Posting Guide.
> 
> ______________________________________________
> 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 http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list