0% found this document useful (0 votes)
25 views15 pages

Python Overview

This document shows a brief overview about programming in Python. It's an introductory presentation about programming language, especially in Python.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views15 pages

Python Overview

This document shows a brief overview about programming in Python. It's an introductory presentation about programming language, especially in Python.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OVERVIEW

OF
PYTHON
PYTHON FOR
GENOMIC DATA
SCIENCE

Image credit: XKCD, at [Link]

Who is This Course For?


No prior knowledge expected: intended for

students with no experience in programming


whatsoever.

For you: oriented towards programming tasks for

molecular biology.

Why Would You Want To Program?

Images courtesy of [Link] under a Creative Commons license.

Approaches to Learning How To Program


Take a class like this that teaches you the basics
Read a programming book
Find a program written by somebody else and try to

understand it
Ask an expert!

Programming Strategies*
1. Identify the required inputs, such as data or speciTications
2.
3.
4.
5.

from the user.


Make an overall design for the program, including listing
all the steps by which the program computes the output.
Decide what will be the output of the program: will the
result be in a Tile, or displayed on the screen?
ReTine the overall design by specifying more detail.
Write the program.

* Adapted from Beginning Perl for Bioinformatics by James Tisdall, Published by O'Reilly Media, Inc., 2001

Designing a Program
Write pseudocode for a program that computes the GC
percentage composition of a DNA sequence:
read DNA sequence from user
count the number of Cs in DNA sequence
count the number of Gs in DNA sequence
determine the length of the DNA sequence
compute the GC%
print GC%
6

What is Python?

Python is not

What is Python?
Python is an easy to learn, powerful programming

language
It has efTicient data structures and a simple but effective

approach to object-oriented programming


It is interpreted!
a compiled program is converted from source code into machine-

language instructions by a compiler, and then run from its binary form
an interpreted program takes the code you wrote and converts it to
binary on the Tly each time you run it. This is slower.
9

History of Python
Python was conceived and developed in the late 1980s and early

1990s by Guido van Rossum at the National Research Institute for


Mathematics and Computer Science in the Netherlands.

Python version 1.0 was released in January 1994.


Python's core syntax and certain aspects of its philosophy are

directly inherited from the language ABC, but Python is also


inTluenced by Modula-3, C, C++, Perl, Java, the Unix shell, and
other scripting languages.

Python 2.0 was released on 16 October 2000.


Python 3.0, a major, backwards-incompatible release, was

released on 3 December 2008.

10

Python Features
It is simple to use: Python syntax is clearly deTined which makes it easily

readable. Programs written in Python are typically much shorter than


equivalent C, C++, or Java programs.

It is interactive: you can write and test your programs directly from a

terminal window.

It has a large standard library: Pythons library of built-in functions

offers a wide range of programs that are already written for you.

It is portable: Python runs on many Unix variants, on Mac OS, and on

Windows.

It is extensible: you can use it as an extension language for applications

that need a programmable interface.

It is scalable: you can use it for very small or very large programs.
11

Some Python Resources


[Link] : the ofTicial Python site
Introduction to Programming using Python -http://

[Link]/formation/infobio/python/ : a programming
course for biologists at the Pasteur Institute

Beginning Python for Bioinformatics -[Link]

pub/a/python/2002/10/17/[Link] : a tutorial by
Patrick O'Brien

[Link] : an interactive Python tutorial.


Think Python: How to Think Like a Computer Scientist - http://

[Link]/thinkpython/ : a free online Python


book by Allen B. Downey

12

Some Useful Python Books

Learning Python
by Mark Lutz

Python Programming Python Programming


by John Zelle
for the Absolute
Beginner
by Michael Dawson

Python Cookbook
by David Beazley
and Brian K. Jones

13

Getting Python
The most up-to-date and current source code, binaries,
documentation, news, etc. is available at the ofTicial website of
Python:

[Link]

14

Running the Python Interpreter


$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/
clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>>

15

Common questions

Powered by AI

Python is suitable for molecular biology programming tasks due to its easy-to-learn syntax, efficient data structures, and interactive nature, which allow for rapid prototyping and iteration on complex tasks. Its large standard library supports a variety of pre-written programs, facilitating the handling of bioinformatics data. Moreover, Python is portable and extensible, making it adaptable to different operating systems and capable of integrating with other scientific tools .

Python programs tend to be shorter than those in C++ or Java because of Python's clear syntax and efficient data structures, which allow developers to express concepts succinctly. The language's high-level features reduce the necessity for complex boilerplate code, making program implementation more concise and readable .

An interpreted programming language like Python executes code by converting it to binary 'on the fly' at runtime, which can result in slower execution compared to compiled languages. In contrast, a compiled language translates the entire source code into machine-language instructions before execution, resulting in faster performance as the program runs from its binary form .

Recommended resources for learning Python include the official Python site, the 'Introduction to Programming using Python' course at the Pasteur Institute, 'Beginning Python for Bioinformatics,' 'LearnPython.org' interactive tutorial, and 'Think Python: How to Think Like a Computer Scientist' by Allen B. Downey. These resources offer structured guidance and practical exercises for beginners .

The strategy involves: 1) Reading the DNA sequence from the user, 2) Counting the number of 'C's, 3) Counting the number of 'G's, 4) Determining the sequence length, 5) Computing the GC percentage, and 6) Printing the result. This approach systematically breaks down the task into manageable steps, facilitating efficient coding and debugging .

During its development, Python has been influenced by several languages: its core syntax and philosophy are inherited from ABC; it also incorporates elements from Modula-3, C, C++, Perl, Java, and Unix shell scripting. These influences have helped shape Python's ease of use, readability, and versatility .

Python's portability is significant because it allows developers to run Python programs across a variety of operating systems, such as Unix, macOS, and Windows, without modification. This flexibility enhances its adoption for diverse applications and environments, facilitating collaboration and deployment in heterogeneous computing contexts .

Recommended approaches for learning Python include taking a class that teaches the basics, reading a programming book, understanding programs written by others, and consulting experts. These methods can help beginners, particularly those in genomic data science, to effectively grasp programming concepts and apply them in their field .

Key features that enhance Python's power include its simple and readable syntax, interactive nature that enables direct execution and testing from a terminal, a large standard library offering numerous pre-written programs, portability across various platforms, and extensibility for embedding in other applications. These characteristics make Python suitable for both small and large-scale projects .

Python's large standard library plays a crucial role in its efficiency by providing a wide range of ready-to-use modules and functions, which reduces the amount of code developers need to write from scratch. This library supports diverse programming tasks, including string handling, file manipulation, network programming, and scientific computations, allowing rapid application development .

You might also like