Skip to content

Can we use GI numbers with NCBI Entrez epost? #926

Closed

Description

@peterjc

Spin out from #925.

The NCBI are retiring GI numbers - see e.g. https://www.ncbi.nlm.nih.gov/news/03-02-2016-phase-out-of-GI-numbers/

What does this mean for Entrez post (epost)? The help page http://www.ncbi.nlm.nih.gov/books/NBK25499/ still says UIDs, which in the context of the sequence databases meant GI numbers.

Example:

>>> from Bio import Entrez
>>> Entrez.email = "[email protected]"
>>> print(Entrez.epost(db="nuccore", id=",".join(accessions)).read())
<?xml version="1.0"?>
<!DOCTYPE ePostResult PUBLIC "-//NLM//DTD ePostResult, 11 May 2002//EN" "http://www.ncbi.nlm.nih.gov/entrez/query/DTD/ePost_020511.dtd">
<ePostResult>
    <QueryKey>1</QueryKey>
    <WebEnv>NCID_1_12213040_130.14.18.34_9001_1472889021_1242921509_0MetA0_S_MegaStore_F_1</WebEnv>
    <ERROR>IDs contain invalid characters which was treated as delimiters.</ERROR>
    <ERROR>Some IDs have invalid value and were omitted. Maximum ID value 18446744073709551615</ERROR></ePostResult>

It seems this still only accepts numerical identifiers...

Activity

  1. peterjc commented on Sep 3, 2016

    @peterjc
    MemberAuthor

    http://www.ncbi.nlm.nih.gov/mailman/pipermail/utilities-announce/2016-September/000106.html

    NCBI will be presenting a short webinar at noon EDT on Wed, Sept. 7 entitled "The E-utilities in an Age Without GI Numbers".

    This webinar will briefly describe NCBI's future plans for the E-utilities API in a time where GI numbers are no longer used as the primary identifiers for sequence records. You will learn how to convert GI numbers to accession.version identifiers and how to quickly determine the most recent version of an accession. You'll also learn about a new E-utility parameter (to be released this fall) that allows these tools to work only with accession.version identifiers.

    Hopefully this will be followed up with some online guidance...

  2. pkundert commented on Oct 10, 2016

    @pkundert

    Any updates on the change-over from GI to accession numbers? I use a script to automate generating knock-out vectors. Even after updating xcode and biopython, I still see this error message:

    File "dictyko.py", line 624, in
    gbrecord = locus_maps(gene, flank) ###returns outfile name to use in primer stuff
    File "dictyko.py", line 89, in locus_maps
    gi_id, ORF_start, ORF_end, strand = fetch_gene_coordinates(gene)
    File "dictyko.py", line 59, in fetch_gene_coordinates
    rec = Entrez.read(handle)
    File "/Library/Python/2.7/site-packages/Bio/Entrez/init.py", line 376, in read
    record = handler.read(handle)
    File "/Library/Python/2.7/site-packages/Bio/Entrez/Parser.py", line 205, in read
    self.parser.ParseFile(handle)
    File "/Library/Python/2.7/site-packages/Bio/Entrez/Parser.py", line 513, in externalEntityRefHandler
    self.dtd_urls.append(url)
    UnboundLocalError: local variable 'url' referenced before assignment

  3. peterjc commented on Oct 10, 2016

    @peterjc
    MemberAuthor

    @pkundert the UnboundLocalError looks like old bug fixed in release 1.66 - see #527, can you update and retry please? Our current release is Biopython 1.68 released in August 2016.

  4. peterjc commented on Oct 10, 2016

    @peterjc
    MemberAuthor

    The NCBI archives its webinars at https://www.ncbi.nlm.nih.gov/home/coursesandwebinars.shtml

    The The E-utilities in an Age Without GI Numbers video is at https://www.youtube.com/watch?v=O2_n6cBuFwE&feature=youtu.be with files including the slides at ftp://ftp.ncbi.nlm.nih.gov/pub/education/public_webinars/2016/09Sep07_EUtils_GIs/

  5. peterjc commented on Oct 10, 2016

    @peterjc
    MemberAuthor

    Key point is new Entrez parameter adding idtype=acc to the URL (might be live now, wasn't at the time of the webinar), which in Biopython would mean efetch(..., idtype="acc") should work.

    Also they highlight efetch(db="nuccore", id=old_gi_numbers, rettype="acc") to convert to accession.version output - might be a good addition to our documentation?

  6. pkundert commented on Oct 10, 2016

    @pkundert

    I'm running Biopython 1.68, so it must be something about the GI to accession switch. I'll try to debug. Thanks so much for the resources!

  7. peterjc commented on Oct 10, 2016

    @peterjc
    MemberAuthor

    Regarding the exception, please double check the version of Biopython - I'm pretty sure you are not using Biopython 1.68 as the line numbers have changes - e.g. the self.dtd_urls.append(url) line is now 608, not 513 - see https://github.com/biopython/biopython/blob/biopython-168/Bio/Entrez/Parser.py#L608

  8. StuntsPT commented on Oct 24, 2016

    @StuntsPT
    Contributor

    So, GI numbers are now phased out of fasta files (for example), but idtype=acc is still now working in e-utils.
    Can anyone please confirm that it's not just me doing something wrong?
    I can't get esearch to return me accession numbers neither using biopython nor using the API directly (here's an example):

    https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?term=Lacerta+monticola[organism]&db=nuccore&retmax=100000000&usehistory=y&idtype=acc
    

    Returns the same, regardless of the existence of "&idtype=acc".

  9. peterjc commented on Oct 24, 2016

    @peterjc
    MemberAuthor

    The webinar did say the history feature does not yet support idtype=acc, see slide 16 from ftp://ftp.ncbi.nlm.nih.gov/pub/education/public_webinars/2016/09Sep07_EUtils_GIs/Eutils_without_GI_webinar_20160907.pdf

    However, Entrez History operations (&WebEnv, &query_key) will NOT work for GI-less sequences

    From memory the video audio did they are thinking about how to deal with that.

  10. StuntsPT commented on Oct 24, 2016

    @StuntsPT
    Contributor

    Thanks @peterjc. I somehow missed that part!
    Sorry about the OT, but do you know of an alternative way to get the results of a large query without usehistory=y?
    Also,

    https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?term=Lacerta+monticola[organism]&db=nuccore&idtype=acc
    

    does not seem to return accession numbers, but rather GIs, and this is a similar example to the one in the mentioned slides.

  11. StuntsPT commented on Oct 24, 2016

    @StuntsPT
    Contributor
  12. peterjc commented on Oct 25, 2016

    @peterjc
    MemberAuthor

    Thank you :)

  13. StuntsPT commented on Mar 2, 2017

    @StuntsPT
    Contributor

    As promised, now that NCBI has updated the Entrez API to allow esearch to return Accession numbers, I have updated the docs.
    Please look at #1071.
    I thought about simply adding the parameter idtype="acc" in the code, but 1) it's not how the API works, and 2) it would break existing code.
    Although I'm not really sure the alternative of simply having half working code is better than having broken code... but 1) makes me pend towards just changing the docs and not obscure the idtype="acc" parameter by hard-coding it.

  14. added a commit that references this issue on Oct 31, 2017
    6e60e57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions