1 / 25

Introduction to Python II

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.

aldis
Download Presentation

Introduction to Python II

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Python II BCHB5242009Lecture 2 BCHB524 - 2009 - Edwards

  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 BCHB524 - 2009 - Edwards

  3. DNA as a string BCHB524 - 2009 - Edwards

  4. 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

  5. DNA as a string BCHB524 - 2009 - Edwards

  6. DNA as a string BCHB524 - 2009 - Edwards

  7. DNA as a string BCHB524 - 2009 - Edwards

  8. 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

  9. 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

  10. 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

  11. Use IDLE BCHB524 - 2009 - Edwards

  12. Use IDLE and raw_input BCHB524 - 2009 - Edwards

  13. Command-Line BCHB524 - 2009 - Edwards

  14. Command-Line BCHB524 - 2009 - Edwards

  15. Command-Line BCHB524 - 2009 - Edwards

  16. Command-Line BCHB524 - 2009 - Edwards

  17. 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

  18. Capture output using the Command-Line • Capture program output using “>” • Errors are still printed to the console BCHB524 - 2009 - Edwards

  19. Read sequence from file • Filenames as command-line arguments. • MAGIC to read sequence from the file. BCHB524 - 2009 - Edwards

  20. Complete Program BCHB524 - 2009 - Edwards

  21. Complete Program Usage BCHB524 - 2009 - Edwards

  22. Complete Program II BCHB524 - 2009 - Edwards

  23. Complete Program II BCHB524 - 2009 - Edwards

  24. 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

  25. 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

More Related