+1-415-670-9189
info@expertsmind.com
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

#!/usr/local/bin/python3

import cgi,json
import os
import mysql.connector

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

2- search.cgi
#!/usr/local/bin/python3
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
conn.close()
print(json.dumps(results)) if name fls' __main __ . '.
__ __
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>
<![endif]-->
<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>
</head>
<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>
<p>
<span id='match_countl>0</span> match (es) found.
</p>
<table>
<thead> <tr>
<td>Locus tag</td>
<td>Product</td>
</tr>
</thead> <tbody>
<!--this will be filled in by javascript when there are results -->
</tbody> </section>
</body>
</html>

Attachment:- Programming.rar




Put your comment
 
Minimize


Ask Question & Get Answers from Experts
Browse some more (Programming Languages) Materials
Problem 1: Complete the implementation of Calculator.scala. Elbonia has a simple sliding scale income tax scheme. Your tax rate is determined by your income according to the
Write a program that encodes English language phrases into pig Latin. Pig Latin is a form of coded language oftenused for amusement. Many variations exist in the methods use
Loop the program using a WHILE LOOP to get the next equation to be tested and repeat the process - Write a program to test for the case of a math equation entered via the keyb
Design a program that displays the sum of the integer numeric values stored in two arrays, in a tabular format. The design defines two arrays of the same size (each array ha
Construct a Markov Algorithm that will reverse the order of an input string that consists of zero or more upper case letters - It will always have the following effect: whate
Write shell script to determine whether given file exist or not, file name is supplied as command line argument, also check for sufficient number of command line argument
Use a one dimensional array to solve the following problem: Write an application that inputs five numbers, each between 10 and 100, inclusive.
A class that represents a person who belongs to a SACCO has two data members to store values of the two loans the person owes the SACCO. Add a parameterized constructor that