Example: stock market

Python course in Bioinformatics - ece.uprm.edu

Python course in Bioinformaticsby Katja Schuerer and Catherine LetondalPython course in Bioinformaticsby Katja Schuerer and Catherine LetondalCopyright 2004 Pasteur Institute [ ]Introduction to Python [ ] and Biopython [ ] with picture above represents the 3D structure of the Human Ferroxidase [ +4SU6q1 IomZ3+-e+[SWALL: CERU_HUMAN ]] protein, that we use in some of the exercisesin this course is designed for biologists who already have some programming knowledge, in other languagessuch as perl or C. For this reason, while presenting a substantial introduction to the Python language,it does not constitute an introduction to programming itself (as [Tis2001] or our course in informaticsfor biology [ ], with an online programming course [ ] in Python ).

Table of Contents 1. General introduction ..... 1 1.1. Running Python ..... 1

Tags:

  Python, Bioinformatics

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Python course in Bioinformatics - ece.uprm.edu

1 Python course in Bioinformaticsby Katja Schuerer and Catherine LetondalPython course in Bioinformaticsby Katja Schuerer and Catherine LetondalCopyright 2004 Pasteur Institute [ ]Introduction to Python [ ] and Biopython [ ] with picture above represents the 3D structure of the Human Ferroxidase [ +4SU6q1 IomZ3+-e+[SWALL: CERU_HUMAN ]] protein, that we use in some of the exercisesin this course is designed for biologists who already have some programming knowledge, in other languagessuch as perl or C. For this reason, while presenting a substantial introduction to the Python language,it does not constitute an introduction to programming itself (as [Tis2001] or our course in informaticsfor biology [ ], with an online programming course [ ] in Python ).

2 What distinguishes this course from general Pythonintroductory courses, is however the important focus on biological examples that are used throughout the course ,as well as the suggested exercises drawn from the field of biology. The second half of the course describes theBiopython ( ) set of modules. This course can be considered a complement to theBiopython tutorial, and what s more often refers to it, by bringing practical exercises using these : are version of this course [ ]Table of Contents1. General Running General Getting Making Working Introduction to basic types in Sequence types: Lists and Xrange Strings and Unicode Type The print Syntax Line Block Special Variables and Multiple Assignments, references and copies of Accessing Control More about Some Order of Object.

3 (dot) String Defining Passing arguments to Reference Passing arguments by Default values of Variable number of Functional programming or more about General Python built-in Raising Defining Modules and Where are the modules?.. Classes: Using Creating Getting information on a Biopython: and Using Seq Sequences reading and Bio classes for and Reading Regular expressions in Reading Running Blast and Running other Bioinformatics programs under Classes: Defining a new Basic class Defining operators for Classes Biopython, Exercises: building parsing classes for Exercises: building parsing classes for Enzyme (cont).. Using the parsers Building parsing classes for phylogenetic Practical: studying disulfid bonds in Human Ferroxidase 3D structure and Working with Study of disulfid Graphics in Summary of examples and exercises with some graphics in this Introduction to basic types in Control Modules and Biopython: and Biopython, Building parsing classes for phylogenetic of Diagram of some built-in Assignment by Reference Referencing Exceptions class Loading specific Overview of the Biopython Seq, SeqRecord and SeqFeatures modules and classes SeqRecord links to other Parsers class Plotting codons Cys conserved Biopython Alphabet class of Built-in sequence Sequence types.

4 Operators and Operations on mutable sequence List Dictionary methods and Number built-in Type conversion File File Order of operator evaluation (highest to lowest).. String formatting: Conversion String formatting: of Introduction to Find Introduction of Functions returning a Generate all possible digests with two Distance of two points in Introduction to Protein 3-Letter-Code to Calculation with complex Reading Print None and Local variable Global Assignment by Copy composed Independent Function execution Test the character of a DNA More complex Find all occurrences of a restriction Remove whitespace characters from a Find a unique occurrence of a restriction Find all possible start codons in a Differences between functions and Defining Remove enzymes with ambiguous restriction Passing arguments by Default values of Variable number of Optional arguments as Filename Raising an exception in case of a wrong DNA Raising your own exception

5 In case of a wrong DNA Exceptions defined in A Loading a module s Using the Building Seq sequences from Reading a FASTA sequence with the Reading a FASTA sequence with the Plotting codon Fetching a SwissProt entry from a Searching for the occurrence of PS00079 and PS00080 Prosite patterns in the Human Using a GenBank Iterator Loading a Clustalw Get the consensus sequence of an Running the EMBOSS cusp A sequence Seq biopython FastaAlignment Exceptions class class Using and of GC DNA Restriction site occurrences as a Restriction Get the codon list from a DNA Reverse Complement of String Translate a DNA Write a sequence in fasta Header Count ambiguous Check DNA DNA complement Variable number of Loading and using Creating a module for DNA Locating Locating components in Using a class from a Import from Length of a Seq GC content of a Seq Write a sequence in FASTA Code reading: Random mutation of a Random mutation of a sequence: count codons Random mutation of a sequence: plot codons Code reading.

6 Connecting with ExPASy and parsing SwissProt SwissProt to Fetch an entry from a local SwissProt Enzymes referenced in a SwissProt Print the pattern of a Prosite Display the Prosite references of a SwissProt Search for occurrences of a protein PROSITE patterns in the Extracting the complete CDS from a GenBank Local Blast, run and display Remote Blast, run and save Remote Blast, parse Local Search Prosite patterns with Running Doing a Clustalw Align Blast Get the PSSM from an Plotting Cys conserved A class to store PDB A class to store PDB residues (cont).. A class to store PDB residues (cont).. Code reading: Biopython Alphabet class A class to store PDB residues (cont ).. EnzymeConsumer, reading one entry from a EnzymeConsumer, reading n entries from a Code reading: EnzymeIterator with EnzymeParsing Fetching enzymes referenced in a SwissProt entry and display related Fetch a PDB entry from the RCSB Web Define a PDBS tructure Define a PDBC onsumer Compute disulfid bonds in Compare 3D disulfid bonds with Cys positions in the alignment (take #1).

7 Compare 3D disulfid bonds with Cys positions in the alignment (take #2).. Code reading: Drawing by 1. General introductionChapter 1. General Running PythonThere are several ways to run Python the interpreter:>>> dna = gcatgacgttattacgactctgtcacgccgcggtgcgact gaggcgtggcgtctgctggg >>> dna gcatgacgttattacgactctgtcacgccgcggtgcgact gaggcgtggcgtctgctggg a file:If :#! /local/bin/pythondna = gcatgacgttattacgactctgtcacgccgcggtgcgact gaggcgtggcgtctgctggg print dnait can be executed from the command line:caroline:~> Python using the#!notation:caroline:~> . is also possible to execute files during an interactive interpreter session:caroline:~> pythonPython (#1, Mar 27 2002, 13:20:02)[GCC (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information.>>> execfile( )gcatgacgttattacgactctgtcacgccgcggtgcgac tgaggcgtggcgtctgctgggor to load a file from the command line before entering Python in interactive mode (-i):1 Chapter 1.

8 General introductioncaroline:~> Python -i >>>this is very convenient when your Python file contains definitions (functions, classes,..) that you want to other programs embedding the Python interpreter:#include < >int main(int argc, char** argv) {Py_Initialize();PyRun_SimpleString("dna = atgagag + tagagga ");PyRun_SimpleString("print Dna is: , dna");return 0;} General informationsGeneral informations about Python and BioPython can be found: on the Python [ ] home page in the Python tutorial [ ] written by Guido van Rossum, the authorof the Python language. in The Python - Essential Reference book ([Beaz2001]) - a compact but understandable reference guide on the BioPython [ ] home page in the BioPython tutorial (PDF [ ], HTML[ ])2 Chapter 1. General Getting informationThere are several ways to obtain documentation within the Python environment: from the command line using thepydoccommand by thehelp()function during an interactive interpreter sessionThepydoccommand and thehelp()function provided with a string argument search thePYTHONPATHfor anobject of this name.

9 But thehelp()function can also be applied directly on an object.>>> def ambiguous_dna_alphabet():.. " returns a string containing all ambiguous dna bases ".. return "bdhkmnrsuvwxy"..>>> help( ambiguous_dna_alphabet ) no Python documentation found for ambiguous_dna_alphabet >>> help(ambiguous_dna_alphabet)Help on function ambiguous_dna_alphabet in module __main__:ambiguous_dna_alphabet()returns a string containing all ambiguous dna bases ambiguous_dna_alphabetis not defined in a module on thePYTHONPATH. by the functiondir(obj)which displays the names defined in the local namespace (see Section ) ofthe objectobj. If no argument is specifieddirshows the definitions of the current module.>>> dir()[ __builtins__ , __doc__ , __name__ ]>>> dna = atgacgatagacataga >>> dir(dna)[ __add__ , __class__ , __contains__ , __delattr__ , __eq__ , __ge__ , __getattribute__ , __getitem__ , __getslice__ , __gt__ , __hash__ , __init__ , __le__ , __len__ , __lt__ , __mul__ , __ne__ , __new__ , __reduce__ , __repr__ , __rmul__ , __setattr__ , __str__ , capitalize , center , count , decode , encode , endswith , expandtabs , find , index , isalnum , isalpha , isdigit , islower , isspace , istitle , isupper , join , ljust , lower , lstrip , replace , rfind , rindex , rjust , rstrip , split , splitlines , startswith , strip , swapcase , title , translate , upper ]3 Chapter 1.

10 General introduction>>> dir()[ __builtins__ , __doc__ , __name__ , dna ] Making documentationIf the first statement of a module, class or function is a string, it is used as the documentation which can beaccessed by the__doc__attribute of the object. The__doc__attribute contains the raw documentation stringwhereas thehelp()function prints it in a human readable format.>>> returns a string containing all ambiguous dna bases >>> help(ambiguous_dna_alphabet)Help on function ambiguous_dna_alphabet in module __main__:ambiguous_dna_alphabet()returns a string containing all ambiguous dna basesIf a string is enclosed by triple quotes or triple double-quotes it can span several lines and the line-feed charactersare retained in the Working EmacsPython provides an editing mode for emacs, which will be automatically loaded if the following lines are presentin (autoload Python -mode " Python -mode" " Python editing mode.)


Related search queries