biothings / mygene.info

MyGene.info: A BioThings API for gene annotations
http://mygene.info
Other
113 stars 20 forks source link

Searching for common gene names using post requests do not work #22

Closed endrebak closed 6 years ago

endrebak commented 6 years ago

Clojure example:

(client/post "http://mygene.info/v3/query" {:form-params {:q "CDK3"}})
{:request-time 1527, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :chunked? false, :reason-phrase "OK", :headers {"Access-Control-Max-Age" "60", "Access-Control-Allow-Headers" "Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control", "Server" "TornadoServer/4.5.1", "Content-Type" "application/json; charset=UTF-8", "Access-Control-Allow-Origin" "*", "Content-Length" "53", "Connection" "Close", "Access-Control-Allow-Methods" "GET,POST,OPTIONS", "Date" "Thu, 21 Sep 2017 14:41:27 GMT", "Access-Control-Allow-Credentials" "false", "Cache-Control" "max-age=604800, public"}, :orig-content-encoding nil, :status 200, :length 53, 
:body "[\n  {\n    \"query\": \"CDK3\",\n    \"notfound\": true\n  }\n]", :trace-redirects []}

You can also just search for CDK3 in the API and see that you get no results. CDK3 and other common gene names work for the get queries though :)

Thanks for the awesome work btw.

newgene commented 6 years ago

@endrebak, POST request to our /v3/query endpoint is meant to be used as the batch query. The typical use case would be to pass a list of terms to "q" parameter (e.g. comma-separated), and also pass a "scopes" parameter to tell us what ID types you want to query for. In your case, you just need to pass "scopes=symbol" since your query term is a symbol. If needed, you can also pass multiple field names to "scopes" parameter. You can give it a try here:

http://mygene.info/tryapi/

The list of available field names can be passed to "scopes" parameter:

http://docs.mygene.info/en/latest/doc/data.html#available-fields

endrebak commented 6 years ago

Sorry for not reading the docs well enough! Mygene is incredible, glad it exists now that biomart has become a bit wonky.