Team:Exeter/lab book/glyco/wk6

From 2012.igem.org

(Difference between revisions)
Line 92: Line 92:
     <p><b><i>30/07/12</i></b></p>
     <p><b><i>30/07/12</i></b></p>
-
<p><i>GlycoBase Version 2.0</i></p>
+
<p><i>Using Bottle.Py</i></p>
-
<p>New features include:
+
<p>Completed example, importing 'route' using '@route('/attempt/:name') and running on localhost port 8080.</p>
-
</br>1) Randomize Button
+
<p>Ran the app.py python file using Windows command prompt. Output shows Bottle server listening on 'http://localhost:8080/'.</p>
-
</br>2) Drop down menu for the sugar unit choice</p>
+
<p>Went to URL http://localhost:8080/attempt/one.</p>
-
<p>To implement the randomize button I need to create a table highlighting all possible combinations.</p>
+
-
<p>Assign each of these an integer key, selected via the random number generator function.</p>
+
<p>Union operator used like an AND function for select statements.</p>
<p>Union operator used like an AND function for select statements.</p>
-
<p>Would it be better to build the chain as we go?</p>
+
<p>The message 'hello iGEM team' displayed, written to be in localhost port 8080.</p>
<p>SQL count could be useful for the dropdown menu.</p>
<p>SQL count could be useful for the dropdown menu.</p>
-
<p>rand_integer = random.randint(1,100) used to select a random integer between 1 and 100.</p>
+
<p>Completed second example using dynamic route http://localhost:8080/dynamic. The web address 'dynamic' is stored as variable unknown. This is printed on the screen and the web address changed.</p>
-
<p>The SQL select distinct statement: In a table, some of the columns may contain duplicate values. This is not a problem, however sometimes you will want to list only the different (distinct) values in a table. The 'distinct' keyword can be utilized in such situations.</p>
+
<p>Third example uses more than one dynamic route.</p>
-
<p>This is very useful in populating a drop down menu for sugars into the interface.</p>
+
<p>Expected output:
-
<p>Use a script to create a text file with the separate sugar names, then subsequently call this text file in the interface mainloop().</p>
+
</br>path 1:p1
-
<p>Display is unclear in interface, call a meeting to decide layout.</p>
+
</br>path 2:p2</p>
-
     <p><b><i>25/07/12</i></b></p>
+
<p>Web browser input http:/localhost:8080/p1/p2, where p1 and p2 are now variables recorded under path 1 and path 2.</p>
-
<p><i>Exception Handling</i></p>
+
    <p><b><i>01/08/12</i></b></p>
-
<p>Used to catch errors which occur whenever the application may be running such that users do not 'see' the error.</p>
+
<p>More bottle examples completed along with http request methods.<p>
-
<p>The most common errors in GlycoBase 2.0 are as follows:</p>
+
     <p><b><i>02/08/12</i></b></p>
-
<p>1) Value Error
+
<p><i>Web based to do list</i></p>
-
</br>This error occurs when the user attempts to call the randomize method without entering the desired length of repeat unit.</p>
+
<p>Each page visible in the browser is generated when the URL is called. A 'route' in the bottle is an address on the server. When called Bottle accepts the call and checks if there is any Python function defined. Bottle then executes any code called.</p>
-
<p>2) Operational Error
+
<p>Important point is the decorator statement @route('toDO'). Functions are bound to this route. Bottle returns result of function bound to route. You may bind multiple routes to functions but each route can only have one function.</p>  
-
</br>This error occurs whenever the user calls a method that makes use of the SQL database before creating the database.</p>
+
<p><i>Bottle Template to Format the Output</i></p>  
-
<p>Error 1 best fixed printing a message to the output text widget.</p>
+
<p>Bottle expects a string or list of strings from a function.
-
<p>Error 2 can occur in several places, for example using the randomize button or entering a sugar string and the 'fetch enzymes' <i>before</i> creating the database. Best fixed by calling the database and relooping to the main program.</p>
+
</br>The string can be text formatted using HTML markup.
-
 
+
</br>Templates are stored as .tpl files and can be called from within functions.
-
    
+
</br>They contain a mix of HTML mark-up and Python statements.  
-
   
+
</br>Every line beginning with % is interpreted as Python code. All condition must be closed with % end.
 +
</br>Access a variable within a non-python code line with double curly braces.</p>
 +
<p>Using GET or POST values studied.</p>
 +
<Used 'dynamic routing' to edit existing items and validated these.</p>  
 +
<p>Reviewed 'dynamic routes using regular expressions', returning static files and how to catch errors.</p>     
     </font>
     </font>
     </div>
     </div>

Revision as of 09:59, 26 September 2012

ExiGEM2012 Lab Book Glyco wk5

Glycobase: 30th July - 3rd August 2012

30/07/12

Using Bottle.Py

Completed example, importing 'route' using '@route('/attempt/:name') and running on localhost port 8080.

Ran the app.py python file using Windows command prompt. Output shows Bottle server listening on 'http://localhost:8080/'.

Went to URL http://localhost:8080/attempt/one.

Union operator used like an AND function for select statements.

The message 'hello iGEM team' displayed, written to be in localhost port 8080.

SQL count could be useful for the dropdown menu.

Completed second example using dynamic route http://localhost:8080/dynamic. The web address 'dynamic' is stored as variable unknown. This is printed on the screen and the web address changed.

Third example uses more than one dynamic route.

Expected output:
path 1:p1
path 2:p2

Web browser input http:/localhost:8080/p1/p2, where p1 and p2 are now variables recorded under path 1 and path 2.

01/08/12

More bottle examples completed along with http request methods.

02/08/12

Web based to do list

Each page visible in the browser is generated when the URL is called. A 'route' in the bottle is an address on the server. When called Bottle accepts the call and checks if there is any Python function defined. Bottle then executes any code called.

Important point is the decorator statement @route('toDO'). Functions are bound to this route. Bottle returns result of function bound to route. You may bind multiple routes to functions but each route can only have one function.

Bottle Template to Format the Output

Bottle expects a string or list of strings from a function.
The string can be text formatted using HTML markup.
Templates are stored as .tpl files and can be called from within functions.
They contain a mix of HTML mark-up and Python statements.
Every line beginning with % is interpreted as Python code. All condition must be closed with % end.
Access a variable within a non-python code line with double curly braces.

Using GET or POST values studied.

Reviewed 'dynamic routes using regular expressions', returning static files and how to catch errors.