This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to get RID from blast rest api url using php

Iam working on blast api. I created program to get RID I don't know how to get that RID. Here another problem in NCBI blast common url documentation Format_type available for CMD=Put also but url not return the xml format. Here is the code.

https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Put&QUERY=SSWWAHVEMGPPDPILGVTEAYKRDTNSKK&PROGRAM=blastp&FILTER=L&DATABASE=nr&FORMAT_TYPE=XML";
$nblast = new BlastAPI();
$nblast->blastdata($url);
php blast ncbi

1 answer

I don't know how to get that RID

you have to "grep" the RID in the BLAST output:

curl -sL "https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Put&QUERY=SSWWAHVEMGPPDPILGVTEAYKRDTNSKK&PROGRAM=blastp&FILTER=L&DATABASE=nr&FORMAT_TYPE=XML" | grep "RID = "
    RID = AGRY2BNM015

and reuse it to ping the blast server until you get the final XML.

so , you are able to retrieve the RID. What's you're problem ?

I have the same issue, did you solve it? The response is always one long line of html. I want json which should be a valid FORMAT_TYPE yet I always get the same type of response back.

From what I can tell, NCBI ignores FORMAT_TYPE for the initial query to BLAST. it only respects it in the second stage of returning the results

Log in to answer this question.