Math 15 Introduction to Scientific Data Analysis Lecture 10 Python Programming – Part 4 University of California, Merced Today – We have A Quiz!

Slides:



Advertisements
Similar presentations
Introduction to perl programming: the minimum to know! Bioinformatic and Comparative Genome Analysis Course HKU-Pasteur Research Centre - Hong Kong, China.
Advertisements

The genetic code.
Center for Biological Sequence Analysis Prokaryotic gene finding Marie Skovgaard Ph.D. student
Protein Synthesis (making proteins)
 -GLOBIN MUTATIONS AND SICKLE CELL DISORDER (SCD) - RESTRICTION FRAGMENT LENGTH POLYMORPHISMS (RFLP)
ATG GAG GAA GAA GAT GAA GAG ATC TTA TCG TCT TCC GAT TGC GAC GAT TCC AGC GAT AGT TAC AAG GAT GAT TCT CAA GAT TCT GAA GGA GAA AAC GAT AAC CCT GAG TGC GAA.
Supplementary Fig.1: oligonucleotide primer sequences.
Gene Mutations Worksheet
Crick’s early Hypothesis Revisited. Or The Existence of a Universal Coding Frame Axel Bernal UPenn Center for Bioinformatics Jean-Louis Lassez Coastal.
1 Essential Computing for Bioinformatics Bienvenido Vélez UPR Mayaguez Lecture 5 High-level Programming with Python Part II: Container Objects Reference:
In vitro expression of BVDV capsid protein Corpus Christi College, University of Oxford Glycobiology Institute, Department of Biochemistry KOR SHU CHAN.
Today… Genome 351, 8 April 2013, Lecture 3 The information in DNA is converted to protein through an RNA intermediate (transcription) The information in.
Dictionaries.
GENE MUTATIONS aka point mutations. DNA sequence ↓ mRNA sequence ↓ Polypeptide Gene mutations which affect only one gene Transcription Translation © 2010.
IGEM Arsenic Bioremediation Possibly finished biobrick for ArsR by adding a RBS and terminator. Will send for sequencing today or Monday.
 The following material is the result of a curriculum development effort to provide a set of courses to support bioinformatics efforts involving students.
Nature and Action of the Gene
Biological Dynamics Group Central Dogma: DNA->RNA->Protein.
1 Perl: subroutines (for sorting). 2 Good Programming Strategies for Subroutines #!/usr/bin/perl # example why globals are bad $one = ; $two = ; $max.
Introduction to Python for Biologists Lecture 2 This Lecture Stuart Brown Associate Professor NYU School of Medicine.
More on translation. How DNA codes proteins The primary structure of each protein (the sequence of amino acids in the polypeptide chains that make up.
Undifferentiated Differentiated (4 d) Supplemental Figure S1.
Supplemental Table S1 For Site Directed Mutagenesis and cloning of constructs P9GF:5’ GAC GCT ACT TCA CTA TAG ATA GGA AGT TCA TTT C 3’ P9GR:5’ GAA ATG.
Lecture 10, CS5671 Neural Network Applications Problems Input transformation Network Architectures Assessing Performance.
Fig. S1 siControl E2 G1: 45.7% S: 26.9% G2-M: 27.4% siER  E2 G1: 70.9% S: 9.9% G2-M: 19.2% G1: 57.1% S: 12.0% G2-M: 30.9% siRNF31 E2 A B siRNF31 siControl.
PART 1 - DNA REPLICATION PART 2 - TRANSCRIPTION AND TRANSLATION.
TRANSLATION: information transfer from RNA to protein the nucleotide sequence of the mRNA strand is translated into an amino acid sequence. This is accomplished.
Today… Genome 351, 8 April 2013, Lecture 3 The information in DNA is converted to protein through an RNA intermediate (transcription) The information in.
 The following material is the result of a curriculum development effort to provide a set of courses to support bioinformatics efforts involving students.
Math 15 Introduction to Scientific Data Analysis Lecture 8 Python Programming – Part 2 University of California, Merced.
Math 15 Introduction to Scientific Data Analysis Lecture 9 Python Programming – #3 University of California, Merced.
NSCI 314 LIFE IN THE COSMOS 4 - The Biochemistry of Life on Earth Dr. Karen Kolehmainen Department of Physics CSUSB
Prodigiosin Production in E. Coli Brian Hovey and Stephanie Vondrak.
Passing Genetic Notes in Class CC106 / Discussion D by John R. Finnerty.
Supplementary materials
Dictionaries. A “Good morning” dictionary English: Good morning Spanish: Buenas días Swedish: God morgon German: Guten morgen Venda: Ndi matscheloni Afrikaans:
The 3 rd Research on Theorem Proving MEC Meeting Hanyang University Proteome Research Lab Hanyang University Proteome Research Lab Park, Ji-Yoon.
Suppl. Figure 1 APP23 + X Terc +/- Terc +/-, APP23 + X Terc +/- G1Terc -/-, APP23 + X G1Terc -/- G2Terc -/-, APP23 + X G2Terc -/- G3Terc -/-, APP23 + and.
Structure and Function of DNA DNA Replication and Protein Synthesis.
RA(4kb)- Atggagtccgaaatgctgcaatcgcctcttctgggcctgggggaggaagatgaggc……………………………………………….. ……………………………………………. ……………………….,……. …tactacatctccgtgtactcggtggagaagcgtgtcagatag.
Example 1 DNA Triplet mRNA Codon tRNA anticodon A U A T A U G C G
Topic: Replication of DNA Standard: Explain the role of DNA in storing and transmitting cellular information.
Name of presentation Month 2009 SPARQ-ed PROJECT Mutations in the tumor suppressor gene p53 Pulari Thangavelu (PhD student) April Chromosome Instability.
DNA, RNA and Protein.
Ji-Yoon Park Nanoparticle-Based Theorem Proving.
The response of amino acid frequencies to directional mutation pressure in mitochondrial genomes is related to the physical properties of the amino acids.
Ms. Hatch, What are we doing today?
Ms. Hatch, What are we doing today?
Nanoparticle-based Theorem Proving
PERMUTATIONS AND COMBINATIONS
Modelling Proteomes.
Supplementary information Table-S1 (Xiao)
Sequence – 5’ to 3’ Tm ˚C Genome Position HV68 TMER7 Δ mt. Forward
Python.
Supplemental Table 3. Oligonucleotides for qPCR
GENE MUTATIONS aka point mutations © 2016 Paul Billiet ODWS.
Supplementary Figure 1 – cDNA analysis reveals that three splice site alterations generate multiple RNA isoforms. (A) c.430-1G>C (IVS 6) results in 3.
Huntington Disease (HD)
DNA By: Mr. Kauffman.
DNA and RNA.
Gene architecture and sequence annotation
PROTEIN SYNTHESIS RELAY
More on translation.
Molecular engineering of photoresponsive three-dimensional DNA
Fundamentals of Protein Structure
Python.
Station 2 Protein Synethsis.
6.096 Algorithms for Computational Biology Lecture 2 BLAST & Database Search Manolis Piotr Indyk.
Shailaja Gantla, Conny T. M. Bakker, Bishram Deocharan, Narsing R
Presentation transcript:

Math 15 Introduction to Scientific Data Analysis Lecture 10 Python Programming – Part 4 University of California, Merced Today – We have A Quiz!

UC Merced2 Schedule December pm Quiz #6 But, there will be a lab! Masa will be in Reno next week!

UC Merced3 Math 15 Now till the end of Fall semester  Four more Labs  One more Assignment ( HW #6 due November 18) Total of 6 assignments  Two more Quizzes (Today-20pts and Nov pts) Total of 6 quizzes  Project #2 (due December 7) – November 19 th  Final Exam – December 17 th

UC Merced4 Grading for Math 15 ActivityPoints% Final Grade Assignments10020% In-Class Quizzes10020% Computer Labs6012% Project #17014% Project #27014% Final Exam10020% Total500100% ActivityPoints Assignments110 In-Class Quizzes130 Computer Labs60 Project #170 Project #270 Final project100 Total540 Projected points GradeTotal points achieved AOver 425 BOver 375 COver 325 DOver 275

UC Merced5 Bonus or Extra Points  So far Lab/homework/project – 15 points Seminar Report – 50 points (Done) Halloween Bonus – 10 points (Done)  Near future Maybe …

UC Merced6  Any Questions?

UC Merced7  After Three weeks of Python Programming experience, what did you think? python

UC Merced8 Don’t make Python bother you. Don’t be scared! Python is just a Tool!

UC Merced9 This Week  More Programming Review New materials for Next Week’s Lab  Dictionaries  Input from a file / Output to a file  Defining function Homework #6 is due November 18 th ! Next Week ’ s Lab (#9) is available at the UCMCROPS.

UC Merced10 Quick Reminder – Part 1  List UC = [“UCLA”, “UC Davis”, “UC Merced”, “UC Berkeley”, “UCSF”, “UCI”] # of elements in UC = 6 >>> print UC[1] UC Davis >>> print UC[6] Error! Python – Index of List starts at 0

UC Merced11 Quick Reminder – Part 2  range() function range(n) : a list of integers from 0 to up to n, but not including n.  Concept of “ Counter ” >>> range(10) [0,1,2,3,4,5,6,7,8,9] N = 15 icount = 0 # Initializing a variable for var in range(1,N,2): icount = icount + 1 print var, icount >>>

UC Merced12 Dictionary  Mutable (or changeable) table of object references, accessed by keys.  Is like an address-book where you can find the address or contact details of a person by knowing only his/her name i.e. we associate keys (name) with corresponding values (details).  Note that the key must be unique to have associated values. just like you cannot find the correct information if you have two persons with the exact same name.

UC Merced13 Dictionary – cont.  In python, dictionary entries are enclosed in braces {}. Here is the general syntax: Name_of_dictionary = { key1 : value1, key2 : value2 } UC = { 'Bruins' : ‘UCLA', ‘Bobcats' : ‘UC Merced', 'Highlanders' : ‘UC Riverside', ‘Anteaters' : ‘UCI' ‘Banana Slugs’: ‘UC Santa Cruz’} >>> UC[‘Highlanders’] UC Riverside

UC Merced14 Example: DNA Sequence Analysis  Objectives:  Convert a DNA sequence to a protein sequence by using the translation table.  Then, use the resulting sequence to identify your protein and its function. ATGAGGAAAATGCTGACCGCTGTGCTGTCTCACGTATTTTCGGGAATGGTCCAAAAGCCAGCTCTCAGAG GACTGCTGTCATCTCTGAAGTTCTCCAACGACGCCACCTGTGACATTAAGAAATGTGACCTGTACCGGCT GGAGGAGGGCCCACCGACCTCCACCGTGCTCACCCGAGCCGAGGCCCTCAAGTACTACCGGACCATGCAG GTAATTCGGCGCATGGAGTTGAAGGCCGACCAGCTGTATAAGCAGAAATTCATCCGTGGTTTCTGTCACC TGTGTGATGGGCAGGAAGCCTGCTGCGTGGGGCTGGAGGCAGGGATAAATCCCACGGATCACGTCATCAC GTCCTACCGGGCTCATGGCTTCTGCTACACGCGAGGACTGTCCGTGAAGTCCATTCTCGCCGAGCTGACT GGACGCAAAGGAGGCTGTGCTAAAGGCAAGGGAGGCTCCATGCACATGTACGGCAAGAACTTCTACGGTG GCAATGGCATTGTTGGGGCCCAGGTACCCCTGGGAGCTGGTGTGGCTTTTGCCTGTAAATACCTGAAGAA TGGTCAGGTCTGCTTGGCTTTGTACGGCGATGGTGCGGCTAACCAAGGGCAGGTATTCGAAGCATACAAT ATGTCAGCCTTGTGGAAATTACCCTGTGTTTTCATCTGTGAGAATAACCTCTATGGAATGGGAACCTCCA ACGAGAGATCAGCAGCCAGTACTGATTACCACAAGAAAGGTTTTATTATCCCCGGACTGAGGGTGAATGG GATGGATATTCTCTGTGTTCGGGAGGCAACCAAGTTTGCAGCTGATCACTGCAGATCTGGAAAGGGGCCC ATTGTGATGGAGCTGCAGACCTACCGTTATCATGGACACAGTATGAGCGACCCAGGGATCAGTTATCGTT CACGAGAAGAAGTTCATAACGTGAGAAGTAAGAGTGATCCTATAATGCTGCTCCGAGAGAGAATTATCAG CAACAACCTCAGCAATATTGAAGAATTGAAAGAAATTGATGCAGATGTGAAGAAAGAGGTGGAGGACGCA GCTCAGTTTGCTACGACTGATCCAGAACCAGCTGTGGAAGATATAGCCAATTACCTCTACCACCAAGATC CACCTTTTGAAGTCCGTGGTGCACATAAGTGGCTCAAGTATAAGTCCCACAGTTAG

UC Merced15 How to convert? The modern genetic code uses triplets of letters to form the words or codons of the genetic language.

UC Merced16 Create the simple Python program to do the job!  First: Convert a codon table into Python ’ s dictionary Code = {'TTT': 'F', 'TCT': 'S', 'TAT': 'Y', 'TGT': 'C', 'TTC': 'F', 'TCC': 'S', 'TAC': 'Y', 'TGC': 'C', 'TTA': 'L', 'TCA': 'S', 'TAA': '*', 'TGA': 'W', 'TTG': 'L', 'TCG': 'S', 'TAG': '*', 'TGG': 'W', 'CTT': 'L', 'CCT': 'P', 'CAT': 'H', 'CGT': 'R', 'CTC': 'L', 'CCC': 'P', 'CAC': 'H', 'CGC': 'R', 'CTA': 'L', 'CCA': 'P', 'CAA': 'Q', 'CGA': 'R', 'CTG': 'L', 'CCG': 'P', 'CAG': 'Q', 'CGG': 'R', 'ATT': 'I', 'ACT': 'T', 'AAT': 'N', 'AGT': 'S', 'ATC': 'I', 'ACC': 'T', 'AAC': 'N', 'AGC': 'S', 'ATA': 'M', 'ACA': 'T', 'AAA': 'K', 'AGA': 'R', 'ATG': 'M', 'ACG': 'T', 'AAG': 'K', 'AGG': 'R', 'GTT': 'V', 'GCT': 'A', 'GAT': 'D', 'GGT': 'G', 'GTC': 'V', 'GCC': 'A', 'GAC': 'D', 'GGC': 'G', 'GTA': 'V', 'GCA': 'A', 'GAA': 'E', 'GGA': 'G', 'GTG': 'V', 'GCG': 'A', 'GAG': 'E', 'GGG': 'G'}

UC Merced17 Functions  Functions are reusable pieces of programs. i.e. range(5), math.sqrt(9), pow(5,2) etc. Using that function any number of times and anywhere in your program.  This is known as calling the function.

UC Merced18 Defining Functions  Functions are defined using the def keyword. This is followed by an identifier name for the function followed by a pair of parentheses which may enclose some names of variables and the line ends with a colon. This is followed by a block of statements that form the body of the function. Syntax def function_name(arguments): “function_documentaion_string” function_body_suite

UC Merced19 Defining Functions - cont  Example # python Program # def say_hello(): print 'Hello World!' # body of the function say_hello() # calling the function say_hello() Hello World!

UC Merced20 Defining Functions – cont.  Another Example # Python Program # Min & Max # def print_max(x, y): if x > y: print x, 'is maximum' else: print y, 'is maximum' print_max(3, 4) # directly give literal constants as arguments a = 5 b = 7 print_max(a, b) # pass in variables as arguments 4 is maximum 7 is maximum

UC Merced21 Defining Functions  Yet Another Example The return statement is used to return from a function (i.e. break out from a function). We can optionally return a value from the function as well. # python No. 3 def maximum(x, y): if x > y: return x else: return y print maximum(2, 3) 3

UC Merced22 Calculation of n! and (n!/r!)  One way: n = input ("What is n? ") icount = 1 for i in range(1,n+1): icount = icount * i nfact = icount pnint n,"! =", nfact r = input("What is r? ") icount = 1 for i in range(1,r+1): icount = icount * i rfact = icount print r,"! = ", rfact print float(nfact)/(rfact) n! r!  Another way: #================================== def fact(x): icount = 1 for i in range(1,x+1): icount = icount * i fact = icount print n,"! = ", fact return fact #================================== n = input("What is n? ") r = input("What is r? ") a = fact(n) b = fact(r) print float(a)/(b) Reusing the function

UC Merced23 Files and Input/Output  Working with files is a lot like working with notebooks. To use a notebook, you have to open it. When you're done, you have to close it.  With Python, it ’ s easy to read strings from plain text files and write to plain text files.

UC Merced24 Open a file for reading data!  This time for reading, and read the contents into a string. This time, the mode argument is "r" for reading: >>> shrimp = open("test.dat","r") If we try to open a file that doesn't exist, we get an error.  The readline method reads all the characters up to and including the next newline character: >>> shrimp = open("test.dat","r") >>> print shrimp.readline() Now is the time to close the file  The read method reads data from the file. With no arguments, it reads the entire contents of the file: >>> text = shrimp.read() >>> print text Now is the time to close the file

UC Merced25 Open a file for writing!  Opening a file creates a file object. In this example, the variable bobcat refers to the new file object. >>> bobcat = open("test.dat","w") The open function takes two arguments.  The first is the name of the file, and  the second is the mode. Mode "w" means that we are opening the file for writing. If there is no file named test.dat, it will be created. If there already is one, it will be replaced by the file we are writing.  To put data in the file we invoke the write method on the file object: >>> bobcat.write("Now is the time") >>> bobcat.write("to close the file")  Closing the file tells the system that we are done writing and makes the file available for reading: >>> bobcat.close()

UC Merced26 Example – No.1: # # Program to read and print a file # file = open(“I_hate_Python.txt","r") text = file.readlines() file.close() for line in text: print line, file_out = open(“I_Love_Python.txt","w") file_out.writelines(text) file_out.close()

UC Merced27 Example- No. 2:  Raw_data.txt - 3.0,4.0,5.0,6.0  Incorrect way to do this: infile = open("raw_data.txt","r") icount = 0 for line in infile: # Loop through each line of the file icount = icount + line print line, icount  Correct way to do this infile = open("raw_data.txt","r") icount = 0 for line in infile: icount = icount + float(line) print line, icount

UC Merced28 Type Conversion  Type conversion functions are useful. Especially, a time when you need to read data sets from the file.  Python reads data sets as strings. You need to convert to numerical types in order to conduct some mathematical operations. Function Description int(x ) converts x to an integer float(x) converts x to a floating-point number (or real number) str(x) converts x to a string representation list(s) converts a sequence to a list chr(x) converts an integer to a character

UC Merced29 Let’s start programming Again! The best way to learn a programming is To Practice! python