Question: How to convert data from NCBI E-utilities.efetch to python data object?
0
gravatar for MatthewP
4 weeks ago by
MatthewP60
China
MatthewP60 wrote:

Hello, everyone! I want to use E-utilities to get all gene information. I already get all gene UIDs and next step is use E-utils.efetch get gene record. However I find it's hard to extract informations I need from the E-utils.efetch return data. Here is one example link getting gene records from E-utils, click to see the data returned:
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=gene&id=79669,10059,23548,8999
Return data looks like:

Entrezgene ::= {
  track-info {
    geneid 79669,
    status live,
    create-date std {
      year 2001,
      month 3,
      day 12
    },
    update-date std {
      year 2018,
      month 12,
      day 8
    }
  },
  type protein-coding,
  source {
    genome genomic,
    origin natural,
    org {
      taxname "Homo sapiens",
      common "human",
      db {
        {
          db "taxon", ...

The problem is I need to convert such data into python object(dict, list) to extract information I need, this is hard. I google and can't find any packages for such job. It's there some easy way? Otherwise I had to write scripts myself.

python ncbi • 128 views
ADD COMMENTlink modified 28 days ago • written 4 weeks ago by MatthewP60
1

Hello MatthewP ,

the format of the return is called ASN.1. This format can be parsed and transformed in a dictionary using the ASN1.tools package for python. Have a look into the examples to see how it works.

fin swimmer

ADD REPLYlink written 4 weeks ago by finswimmer10k
1

It would probably be worth your while to abandon ASN.1 style results, in favour of some of the more broadly applicable formats, as discussed here for instance.

ADD REPLYlink written 4 weeks ago by jrj.healey10k
1
gravatar for MatthewP
28 days ago by
MatthewP60
China
MatthewP60 wrote:

Hello, I find E-utils can return xml if you set retmode=xml. Example:
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=gene&id=79669,10059,23548,8999&retmode=xml
Here is all support retmode list:
https://www.ncbi.nlm.nih.gov/books/NBK25499/table/chapter4.T._valid_values_of__retmode_and/?report=objectonly
For some newbee like me.

ADD COMMENTlink written 28 days ago by MatthewP60
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1393 users visited in the last hour