Posts

Showing posts with the label Python

Hydrophobicity plot using BioPython on Google Colab Notebook

Image
A hydrophobicity or lipophilicity plot is a 2D graphical display of the hydrophobic regions in the protein. The Kyte-Doolittle scale was widely used for identifying surface-exposed regions and transmembrane regions. The plot has the amino acid sequence of a protein on its x -axis and a degree of hydrophobicity on its y -axis. The graph regions with a positive value are hydrophobic. There are several hydrophobicity scales have been published for various uses. The commonly used hydrophobicity scales are Kyte-Doolittle scale, Engelman scale (GES scale), Eisenberg scale, Hopp-Woods scale, Cornette scale, Rose scale, and Janin scale. For further details, refer my previous article https://www.biob.in/2014/05/hydrophobicity-plot-using-biopython.html Program Implementation In this tutorial, I have used Google Colab Notebook for running the Python program. Click here for interactive demo. Python Program try: import google.colab !pip install biopython except ImportError: pa...

Simple Server and Client Chat using Python

Image
In Python language, socket (or network socket) is a module used to communicate between two computers. It provides two types of interface to access the network, namely low-level (platform dependent connections — Example: Telnet) and high-level (application dependent connections — Example: HTTP, FTP, SMTP, etc.). This is a simple tutorial to establish the low-level socket connection between server and client to communicate messages using the TCP/IP protocol. Server and Client Chat In this tutorial, I have used two scripts server.py to serve data by sending an invitation to the client, and client.py to receive data on acceptance of the invitation. After accepting the invitation, both server and client share messages mutually. — Server — An server script performs the sequence of functions such as socket() , bind() , listen() , and accept() (repeats for more than one client) to communicate with the client. The description of each functions used in the ser...

Simple WebServer using Python

Image
This is a simple example to develop your own Python web server used for application development or testing Python script and should not be used on a public network . It works similar to the Apache web server with limited functionalities and not intended to be a full-featured web server. This tutorial demonstrates just to activate the built-in web server through a batch file. Instructions For developing a Python web server, we simply need Python software alone. The batch file (.bat) was created to activate the built-in web server, automatically open the default web browser with custom folder as root directory (www), and minimize the command line window while running the Python script. Step 1: Download and install Python software according to your system platform. I have downloaded Windows x86-64 executable installer for 64-bit Windows 10 operating system. Step 2: Create a new folder named www ( optional , your path to the webpages). Also, create a new file index.html in...

Installing Latest PyMOL Software for FREE

Image
Introduction to PyMOL PyMOL is a Python-enhanced OpenGL based molecular visualization tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source PyMOL is available at SourceForge.net ( https://sourceforge.net/projects/pymol/ ) for free to everyone. The commercial graphical end PyMOL is developed, maintained and distributed by Schrödinger, Inc ( https://www.pymol.org/ ). PyMOL can produce high-quality 3D images of small molecules and biological macromolecules, such as proteins. According to the original author, almost a quarter of all published images of 3D protein structures in the scientific literature were made using PyMOL. Requirements for PyMOL Installation In this tutorial, I have explained how to install the latest PyMOL software (the latest version of PyMOL software as on September 15, 2016 is 1.8.3.2) for free. I have chosed Windows 10 Enterprise OEM 64-bi...

Basic Calculator using Python GUI (Tkinter) Program

Image
This is a simple graphical user interfaced (GUI) Python application designed using Tkinter package to perform basic arithmetic calculations such as addition, subtraction, multiplication, and division of two numbers through the mouse click event. Copy an icon image ‘favicon.ico’ to the working directory to change the default icon in the title bar of the application. Introduction to Python Tkinter In Python, the tkinter package (“Tcl/Tk interface”) is the standard interface to the Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, as well as on Windows systems. ( Tk itself is not part of Python ; it is maintained at ActiveState .) You can check that tkinter is properly installed on your system by running python -m tkinter from the command line; this should open a window demonstrating a simple Tk interface. For more details, refer to the official site of Python ( python.org ). Source Code # calc.py - a Python calculator from tkinter imp...

Polynomial Graph using Python

Image
Introduction to Polynomial Graph Polynomial curve a is smooth and continues line of graph, connected by a series of co-ordinates calculated using a polynomial equation (For example, y = f ( x ), where f ( x ) = A x 2 + B x + C). In this program, I have used a polynomial equation y = 3 x 2 + 4 x + 2 with x values range from 0 to 5. The program generated co-ordinate points ( x , y ) in the graph will be (0, 2), (1, 9), (2, 22), (3, 41), (4, 66), and (5, 97). Program Implementation In this tutorial, I have used Python 3.5.2 (64-bit) software, and 7 modules: MatPlotLib 2.0.2 , PyParsing 2.2.0 , Python-DateUtil 2.6.1 , PyTZ 2017.2 , SetupTools 36.2.0 , Cycler 0.10.0 , and NumPy-MKL 1.13.1 implemented in Windows 10 Enterprise operating system. The 7 modules are chosen based on the compatibility of Python and OS version and bit. Source Code import numpy as np import matplotlib.pyplot as plt a = 3 b = 4 c = 2 x = np.linspace(0, 10, 256, endpoint = True) y = (a * (x * x)) + (b ...

Sine and Cosine Graph using Python

Image
Introduction to Sine/Cosine Graph The sine and cosine graphs are almost identical, except the cosine curve ( y = cos ( x )) starts at amplitude y = 1, when angle x = 0° (whereas the sine curve ( y = sin ( x )) starts at amplitude y = 0). We say the cosine curve is a sine curve which is shifted to the left by 90°. The graph of sine and cosine is like a wave that forever oscillates between -1 and 1, in a shape that repeats itself every 360° (2π) units. Program Implementation In this tutorial, I have used Python 3.5.2 (64-bit) software, and 7 modules: MatPlotLib 2.0.2 , PyParsing 2.2.0 , Python-DateUtil 2.6.1 , PyTZ 2017.2 , SetupTools 36.2.0 , Cycler 0.10.0 , and NumPy-MKL 1.13.1 implemented in Windows 10 Enterprise operating system. The 7 modules are chosen based on the compatibility of Python and OS version and bit. Source Code import numpy as np import matplotlib.pyplot as plt X = np.linspace(-np.pi, np.pi, 256, endpoint = True) C, S = np.cos(X), np.sin(X)...

Exponential Graph using Python

Image
Introduction to Exponential Graph Exponential curve a is smooth and continues line of graph, connected by a series of co-ordinates calculated using a polynomial equation containing variable exponential value (For example, y = f ( x ), where f ( x ) = A e B x + C). In this program, I have used a polynomial equation with a exponential variable y = 5 e -2 x + 1 with x values range from 0 to 10. The program generated co-ordinate points ( x , y ) in the graph will be (0, 6.0), (1, 1.7), (2, 1.1), (3, 1.0), (4, 1.0), (5, 1.0), (6, 1.0), (7, 1.0), (8, 1.0), (9, 1.0), and (10, 1.0). Program Implementation In this tutorial, I have used Python 3.5.2 (64-bit) software, and 7 modules: MatPlotLib 2.0.2 , PyParsing 2.2.0 , Python-DateUtil 2.6.1 , PyTZ 2017.2 , SetupTools 36.2.0 , Cycler 0.10.0 , and NumPy-MKL 1.13.1 implemented in Windows 10 Enterprise operating system. The 7 modules are chosen based on the compatibility of Python and OS version and bit. Source Code import numpy as...