We recently posted on this blog the idea of creating a computer engine to play the game 20 questions. But instead of asking users to thing of common objects in the world, we’d ask people to think of their favorite gene.
Well, I took advantage of a recent long weekend to throw together a prototype “20 Questions for Genes” game. Give it a spin! (If you want help picking a test gene and retrieving the corresponding GO terms, check out our annotation browser.)
For the technically inclined, let me describe the framework we put together to run the game. There are two basic components. First, there is the web site that handles all user interactions, serving as the intermediary between the human player and the computer guesser. All questions are posed as either a Gene Ontology term (a fact-finding question) or an NCBI gene ID (a guess on the gene’s identity). This web framework lives (obviously) at the main website linked above.
Second, there is the back-end web service that generates the next question based on all prior questions and answers, and it is called by the front-end game UI. The web service interface is very simple. The first time the server is called (without any passed parameters), it returns a GO identifier corresponding to the first question to be posed to the user. For example, my prototype server is hosted at http://sulab.scripps.edu/20q-engine/cgi-bin/20q-engine.cgi, and that call very simply returns “GO:0016020”. The front-end UI uses this Gene Ontology identifier (corresponding to “membrane”) as the first question to the game player. On the second call, the service receives the answer to the first question as a passed URL parameter. For example, depending on the uesr’s response:
- YES: http://sulab.scripps.edu/…/20q-engine.cgi?userResponses='[{“GO:0016020”:0}]’
- NO: http://sulab.scripps.edu/…/20q-engine.cgi?userResponses='[{“GO:0016020”:1}]’
The service always simply returns the next question to ask the user based on previous answers provided, and the question always comes in the form of a GO identifier or an Entrez Gene ID.
Anyone else want to try their hand at creating a 20 questions guesser? All you have to do is create a web service that takes past questions as input, and returns the next question to pose to the user as output. And as we mentioned before, we think this would be an outstanding project for students who are learning about computer programming, machine learning, or artificial intelligence.
For those who want to dig in further into what we’ve done, you can check out the code repositories for the front-end game playing UI and for the back-end guess generator.
In the next post, I’ll describe the results of our benchmarking simulations.
Trackbacks/Pingbacks