I'm trying to access identical protein information for a list of protein accession numbers. My goal it to take protein ID's, get identical protein list, use the nucleotide coordinates from that list to specifically download the upstream and downstream region of a given gene.

I was hoping to use the biopython Entrez module.

I've used the below code

    epost_1 = Entrez.read(Entrez.epost("protein", id=",".join(Prot_ID_list)))
    webenv = epost_1["WebEnv"]
    query_key = epost_1["QueryKey"]
    prot_link = Entrez.read(Entrez.elink(dbfrom="protein", db="protein", LinkName="protein_protein_identical", webenv=epost_1["WebEnv"], query_key=epost_1["QueryKey"]))

However, this doesn't work. It just returns me a list of protein IDs that I originally posted.

I've also tried using eutils on ubuntu

    epost -db protein -id Prot_ID_List | elink -related -name protein_protein_identical | efetch -format text

but it just gives an error "QueryKey value not found in fetch input". I tried variations on this to no avail. I am probably doing something very wrong with eutils, but I am not sure what.

Any help is greatly appreciated.


It appears I was approaching the question wrong. You don't need to 'link' to the identical protein list, despite the 'protein_protein_identical' link name, and description [here][1] on the NCBI website.

Instead, it is information intrinsic to each accession number. 

    epost_1 = Entrez.read(Entrez.epost("protein", id=",".join(prot_list)))
    	webenv = epost_1["WebEnv"]
    	query_key = epost_1["QueryKey"]
    	iden_prots = Entrez.efetch(db="protein", rettype='ipg', retmode='text', webenv=epost_1["WebEnv"], query_key=epost_1["QueryKey"])

I used the above to get the identical protein list. rettype=ipg downloads the identical protein list in tab-delimited format. 
  [1]: https://eutils.ncbi.nlm.nih.gov/corehtml/query/static/entrezlinks.html

Hopefully other people come across this if they get stuck like I did.