Dear community,
I don't think the following question deserve a new post, given that it's largely inspired from Sej Modha answer, thus I am commenting on his answer :
Question title : "Retrieving blast staxids from saccver with ncbi E-utilities"
I am parsing blast+ output (custom outfmt 6 with saccver column).
I am interested in retrieving the staxids info for each hit.
The blast was done against a custom database, thus I cannot request the staxids column directly in the output.
But I can map saccver with staxids.
My issue is that I did not manage to do it efficiently yet, let me explain :
The output contains a large number of hits, representing many different saccver.
Ideally, I need to be able to query thousands of saccver at once with efetch / esearch and get a result where each saccver is associated with the corresponding staxids (a Python dictionary for example).
If I loop on my list of saccver, the result is fine but slow : Example for a single query :
time esearch -db protein \
-query XP_001778611.1 \
| elink -target taxonomy \
| efetch -format uid;
3218
real 0m2.332s
Trying the same as above with 5 queries, hoping that the results are in the same order as the input :
Truth :
saccver, staxids
XP_001778611.1, 3218
XP_006409976.1, 72664
NP_001149654.2, 4577
XP_014499952.1, 3916
XP_016732373.1, 3635
time esearch -db protein \
-query XP_001778611.1,NP_001149654.2,XP_014499952.1,XP_006409976.1,XP_016732373.1 \
| elink -target taxonomy \
| efetch -format uid;
72664
4577
3916
3635
3218
real 0m2.290s
Sadly, staxids results are sorted decreasingly, thus I don't see a way to map them to input saccver list here.
Last thing I tried was querying in the xml protein_db output, but I still fail to map saccver to staxids here :
time efetch -db protein \
-id XP_001778611.1,XP_006409976.1,NP_001149654.2 \
-format xml \
| xtract -pattern Bioseq-set_seq-set \
-group Seqdesc_source \
-sep "@" \
-element Object-id_id \
-group Textseq-id \
-sep "@" \
-element Textseq-id_accession;
3218 72664 4577 XM_001778559 XP_001778611 XM_006409913 XP_006409976 NM_001156182 NP_001149654
real 0m1.204s
Any suggestions ?
Best regards
context needed: is it a cmd-line program or is it a web-page ?
its on a webpage so i'm work in java then convert to html format
in java ????? I hope you mean javascript ?!
Java is to javascript as ham is to hamster, right? :-p
yup javascript! as the name suggests this is all new territory for me!