Introduction to python ii
Download
1 / 25

Introduction to Python II - PowerPoint PPT Presentation


  • 163 Views
  • Updated On :

Introduction to Python II. BCHB524 2009 Lecture 2 . Outline. DNA as a string Extracting codons in DNA Counting in-frame codons in DNA Reverse Complement User Input Using the Python IDE (IDLE) Command-line arguments Using the Command-Line. DNA as a string. DNA as a string.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Introduction to Python II' - aldis


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Introduction to python ii l.jpg

Introduction to Python II

BCHB5242009Lecture 2

BCHB524 - 2009 - Edwards


Outline l.jpg
Outline

  • DNA as a string

    • Extracting codons in DNA

    • Counting in-frame codons in DNA

    • Reverse Complement

  • User Input

    • Using the Python IDE (IDLE)

    • Command-line arguments

  • Using the Command-Line

BCHB524 - 2009 - Edwards


Dna as a string l.jpg
DNA as a string

BCHB524 - 2009 - Edwards


Dna as a string4 l.jpg
DNA as a string

  • What about upper and lower case?

    • ATG vs atg?

  • Differences between DNA and RNA sequence?

    • Substitute U for each T?

  • How about ambiguous nucleotide symbols?

    • What should we do with ‘N’ and other ambiguity codes (R, Y, W, S, M, K, H, B, V, D)?

  • Strings don’t know any biology!

BCHB524 - 2009 - Edwards


Dna as a string5 l.jpg
DNA as a string

BCHB524 - 2009 - Edwards


Dna as a string6 l.jpg
DNA as a string

BCHB524 - 2009 - Edwards


Dna as a string7 l.jpg
DNA as a string

BCHB524 - 2009 - Edwards


Creating and running python scripts l.jpg
Creating and Running Python Scripts

  • Creating new scripts:

    • File >> New Window

    • Write script as desired

    • Save in My Documents >> BCHB524

  • In IDLE:

    • File >> Open (browse to script.py)

    • Run >> Run Module (or just hit F5)

    • Results are in command window

  • From Command-Line:

    • python script.py

  • *Double-click on script.py

BCHB524 - 2009 - Edwards


Creating reusable programs l.jpg
Creating reusable programs

  • Need to get input data and options from the user

    • …often us, but sometimes others, or us later.

  • Sometimes, want completely new inputs

    • …but often, want the same or similar input.

  • Sometimes, typing the input is OK

    • …but often, want to use data in a file.

  • Sometimes, output to the screen is OK

    • …but often, want the result to go into a file.

BCHB524 - 2009 - Edwards


Program i o options l.jpg
Program I/O Options

  • Use IDLE

    • Good for testing, quick easy, inflexible

    • Input is “hard-coded” into script.

    • Use IDLE to change input data in script.

  • Use IDLE, with raw_input

    • Program input from the keyboard (or copy-and-paste)

  • Command-line

    • Quickly repeat or change program inputs

    • Easily do input/output from keyboard/screen or files

    • Copy-and-paste in a pinch

    • Best integration with other tools

    • Similar facilities available in most other operating systems

BCHB524 - 2009 - Edwards


Use idle l.jpg
Use IDLE

BCHB524 - 2009 - Edwards


Use idle and raw input l.jpg
Use IDLE and raw_input

BCHB524 - 2009 - Edwards


Command line l.jpg
Command-Line

BCHB524 - 2009 - Edwards


Command line14 l.jpg
Command-Line

BCHB524 - 2009 - Edwards


Command line15 l.jpg
Command-Line

BCHB524 - 2009 - Edwards


Command line16 l.jpg
Command-Line

BCHB524 - 2009 - Edwards


Command line17 l.jpg
Command-Line

  • Up-Arrow and Down-Arrow for command history

  • Can easily capture output to a file

  • Can easily specify filenames as input

    • Get filename completion using TAB

BCHB524 - 2009 - Edwards


Capture output using the command line l.jpg
Capture output using the Command-Line

  • Capture program output using “>”

  • Errors are still printed to the console

BCHB524 - 2009 - Edwards


Read sequence from file l.jpg
Read sequence from file

  • Filenames as command-line arguments.

  • MAGIC to read sequence from the file.

BCHB524 - 2009 - Edwards


Complete program l.jpg
Complete Program

BCHB524 - 2009 - Edwards


Complete program usage l.jpg
Complete Program Usage

BCHB524 - 2009 - Edwards


Complete program ii l.jpg
Complete Program II

BCHB524 - 2009 - Edwards


Complete program ii23 l.jpg
Complete Program II

BCHB524 - 2009 - Edwards


Lab exercises l.jpg
Lab Exercises

  • Try each of the examples shown in these slides & make sure you understand them!

  • Use UniSTS (“google UniSTS”) to look up PCR markers for your favorite gene

    • For each forward and reverse primer, compute the reverse complement sequence

BCHB524 - 2009 - Edwards


Lab exercises25 l.jpg
Lab Exercises

  • Write a program to test whether a PCR primer is a reverse complement palindrome.

    • Such a primer might fold and self-hybridize!

    • Test your program on the following primers:

      • TTGAGTAGACGCGTCTACTCAA

      • TTGAGTAGACGTCGTCTACTCAA

      • ATATATATATATATAT

      • ATCTATATATATGTAT

BCHB524 - 2009 - Edwards