Show how to perform a protein search as an ajax call
Course:- Programming Languages
Reference No.:- EM132257473

Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
Assignment Help >> Programming Languages

- These 3 codes are to show how to perform a protein search as an AJAX call that returned and parsed )50N formatted results and display them on the browser. - Read documantation for )Query on the autocomplete function
- After that, please show how to modify these codes to add auto-complete functionality to the search box
- The source of data is the Genbank file
- do not hard-code a list of terms in a )avascript array
- limit the number of rows returned to S so that the large lists are not returned.

1- test.cgi


import cgi,json
import os
import mysql.connector

def main()
print("Content-Type:text/html\n\ni print("It worked\n")

2- search.cgi
import cgi, json
import os
import mysql.connecting
def main():
print ("Content-Type: application/json\n\n")
form -cgi.FieldStorage()
term -form.getvalue('search_term')
conn - mysql.connector.connect(user - 'any', password-'anything' , host-'host', database -sbiotese) cursor - conn.cursor()
SELECT locus_id, product
FROM genes
WHERE product LIKE %s
cursor.excute(qry, ('%' + term + '%',))
results = {'match_count1:0, 'matches' : list()}
for (locus_id, product) in cursor:
resultsrmatchesl.append({'locus_idl:locus_id, 'product': product}) resultsrmatch_count1+-1
print(json.dumps(results)) if name fls' __main __ . '.
__ __

3- search.html

<!DOCTYPE html>
<html lang =leen"). <head>
<meta charset="utf-8"/>
<title>A3AX demo</title>
<!--[if IE]>
<script src-"http://xxxxxx/xxxx/html5.js"></script>
<link rel="stylesheet" type="text/css" href="css/search_product.css"/>
<script type-"text/javascript" src-"https://ajax.googleapis.com/ajax/jquery/xxxxxx"></script> <script type="text/javascript" src="js/search.js"></script>
<body id="main">
<h1>E.coli search </hl>
<form name-"search" id-"search" action-"">
<input name="search_term" type="search value="" autofocus="autofocus" placeholder="Enter a search term"/> </form>
<section id=eresults1>
<span id='match_countl>0</span> match (es) found.
<thead> <tr>
<td>Locus tag</td>
</thead> <tbody>
<!--this will be filled in by javascript when there are results -->
</tbody> </section>

Attachment:- Programming.rar

Put your comment

Ask Question & Get Answers from Experts
Browse some more (Programming Languages) Materials
What are the criteria for selection of a programming language for developing Internet of things OR How to determine which programming language is suitable for developing
Define some everyday if else statements you use to determine action. What are the branches of your statement? What are the relational and Boolean operators you used in your ex
Write a program to calculate students average test scores and their grades -  dimensional array to store the test score, and a parallel one-dimensional array to store grades.
Exercise JHTP (Rectangle Class): Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle's perim
Is there a downside to utilizing prototypes? Prototypes can show to user the look and feel of application but frquently the more sophisticated tools (like data entry verifica
This program will give you practice inputting data from files, writing and calling functions, using linked lists and outputting data to a file. You should only use one li
Write down class called City to track name and population. Use name as key, and give a function which compares two cities, and points out greater.
Write a method to computer the following series: m(i) = 1/2 + 2/3 + . . . + i/i + 1. Write a test program that displays the following table: I m(i) 1 0.5000 2 1.1667 . . . 19