You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can we use GI numbers with NCBI Entrez epost? #926
>>> 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...
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...
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
@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.
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?
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):
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.
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,
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.
Activity
peterjc commentedon Sep 3, 2016
http://www.ncbi.nlm.nih.gov/mailman/pipermail/utilities-announce/2016-September/000106.html
Hopefully this will be followed up with some online guidance...
pkundert commentedon Oct 10, 2016
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
peterjc commentedon Oct 10, 2016
@pkundert the
UnboundLocalErrorlooks 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.peterjc commentedon Oct 10, 2016
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/
peterjc commentedon Oct 10, 2016
Key point is new Entrez parameter adding
idtype=accto the URL (might be live now, wasn't at the time of the webinar), which in Biopython would meanefetch(..., 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?pkundert commentedon Oct 10, 2016
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!
peterjc commentedon Oct 10, 2016
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#L608StuntsPT commentedon Oct 24, 2016
So, GI numbers are now phased out of fasta files (for example), but
idtype=accis 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):
Returns the same, regardless of the existence of "&idtype=acc".
peterjc commentedon Oct 24, 2016
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.pdfFrom memory the video audio did they are thinking about how to deal with that.
StuntsPT commentedon Oct 24, 2016
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,
does not seem to return accession numbers, but rather GIs, and this is a similar example to the one in the mentioned slides.
StuntsPT commentedon Oct 24, 2016
@peterjc
&idtypeis not yet implemented:https://ncbiinsights.ncbi.nlm.nih.gov/2016/07/15/ncbi-is-phasing-out-sequence-gis-heres-what-you-need-to-know/comment-page-1/#comment-35754
I volunteer to update the docs once the new API parameter is released.
peterjc commentedon Oct 25, 2016
Thank you :)
StuntsPT commentedon Mar 2, 2017
As promised, now that NCBI has updated the Entrez API to allow
esearchto 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.Updated docs on using Entrez with Acc instead of GI (biopython#1071)