The new query widgets to query patients by genetic variants comes with autocomplete functionality. This functionality assists the users in selecting either rsIDs or gene names while querying. As the users types in, the autocomplete function looks up rsIDs or gene names beginning with the characters in real time. The list of matching strings is then returned and offered as suggestions from which the user can pick.
The following figure is an example of auto-complete feature for rsID concept :
The auto-complete feature is based on 2 main parts
- The actual data stored in database, and
- A method to query the data from database and present it to the web-client.
Data for autocomplete
A list of identifiers and gene names – that are present only in the dataset – needs to be stored in a backend i2b2 metadata table where the actual value will be located in the c_name field of the table. For the example given above to work the data in metadata table (metadata_genomics in our example) may look like following:
rs12640778 | C to T
Above the change from reference to alternate allele has been appended to the dbSNP rs identifier and stored in c_name field and c_basecode is the concept code for SNP.
Sample scripts can be found inside the package in “Scripts for Sample Data” folder that loads auto-complete sample data in metadata_genomics table.
Method to query autocomplete data
In our example we have implemented a PHP script to query the autocomplete data and present it to the query widgets as a user types in rs identifier or gene name.
The PHP file may be placed on the web server inside the i2b2 webclient and configured to work in your specific database environment. Stubs are also provided to implement your own autocomplete.
Example PHP code can be found inside the package called 'genomicsAutoComplete.php' under the 'Script for Genomic Autocomplete' folder.webclient” folder on the webserver.