DAY 3. ADVANCED PYTHON PRACTICE SANGREA SHIM TAEYOUNG LEE.

Slides:



Advertisements
Similar presentations
Course A201: Introduction to Programming 10/28/2010.
Advertisements

For loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas.
Chapter 6 Lists and Dictionaries CSC1310 Fall 2009.
Pasewark & Pasewark 1 Word Lesson 7 Working with Documents Microsoft Office 2007: Introductory.
Word Lesson 7 Working with Documents
An Introduction to Python – Part III Dr. Nancy Warter-Perez.
An Introduction to Python – Part II Dr. Nancy Warter-Perez.
An Introduction to Python – Part III Dr. Nancy Warter-Perez May 1, 2007.
1 Python Chapter 3 Reading strings and printing. © Samuel Marateck.
An introduction to Python and its use in Bioinformatics Csc 487/687 Computing for Bioinformatics Fall 2005.
Files in Python Caution about readlines vs. read and split.
Files in Python Input techniques. Input from a file The type of data you will get from a file is always string or a list of strings. There are two ways.
An Introduction to Python – Part III Dr. Nancy Warter-Perez.
Computer Programming for Biologists Class 2 Oct 31 st, 2014 Karsten Hokamp
Python programs How can I run a program? Input and output.
The if statement and files. The if statement Do a code block only when something is True if test: print "The expression is true"
Data Structures in Python By: Christopher Todd. Lists in Python A list is a group of comma-separated values between square brackets. A list is a group.
Python for Informatics: Exploring Information
If statements while loop for loop
Built-in Data Structures in Python An Introduction.
An Introduction to Python – Part II Dr. Nancy Warter-Perez.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 8 Lists and Tuples.
Dictionaries.   Review on for loops – nested for loops  Dictionaries (p.79 Learning Python)  Sys Module for system arguments  Reverse complementing.
5 1 Data Files CGI/Perl Programming By Diane Zak.
9/28/2015BCHB Edwards Basic Python Review BCHB Lecture 8.
1 CSC 221: Introduction to Programming Fall 2011 Lists  lists as sequences  list operations +, *, len, indexing, slicing, for-in, in  example: dice.
Guide to Programming with Python Chapter Seven Files and Exceptions: The Trivia Challenge Game.
GE3M25: Computer Programming for Biologists Python, Class 5
1 CSC 221: Introduction to Programming Fall 2012 Lists  lists as sequences  list operations +, *, len, indexing, slicing, for-in, in  example: dice.
Perl Variables: Array Web Programming1. Review: Perl Variables Scalar ► e.g. $var1 = “Mary”; $var2= 1; ► holds number, character, string Array ► e.g.
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python, Class 2 Karsten Hokamp, PhD Genetics TCD, 17/11/2015.
LISTS and TUPLES. Topics Sequences Introduction to Lists List Slicing Finding Items in Lists with the in Operator List Methods and Useful Built-in Functions.
Chapter 17 How to read a table of codons. These are two forms in which you might see a table of codons.
Week 7 : String and photo processing. Today’s Tasks  Practice list and string  Convert Decimal to any radix base number  Between Binary and Hexadecimal.
EECS 110: Lec 13: Dictionaries Aleksandar Kuzmanovic Northwestern University
Dept. of Animal Breeding and Genetics Programming basics & introduction to PERL Mats Pettersson.
Lakshit Dhanda. Output Formatting Python has ways to convert any value to a string. 2 Methods repr() – meant to generate representations of values read.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 this week – last section on Friday. Assignment 4 is posted. Data mining: –Designing functions.
Lists/Dictionaries. What we are covering Data structure basics Lists Dictionaries Json.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
DAY 2. GETTING FAMILIAR WITH NGS SANGREA SHIM. INDEX  Day 2  Get familiar with NGS  Understanding of NGS raw read file  Quality issue  Alignment/Mapping.
ENGINEERING 1D04 Tutorial 2. What we’re doing today More on Strings String input Strings as lists String indexing Slice Concatenation and Repetition len()
Advanced Python Data Structures
Lesson 4 - Challenges.
CSc 120 Introduction to Computer Programing II
Python’s input and output
Advanced Python Data Structures
Python I/O.
Perl Variables: Array Web Programming.
Topics Introduction to File Input and Output
Creation, Traversal, Insertion and Removal
File IO and Strings CIS 40 – Introduction to Programming in Python
Basic Python Review BCHB524 Lecture 8 BCHB524 - Edwards.
Python - Strings.
CISC101 Reminders Quiz 2 graded. Assn 2 sample solution is posted.
Lists in Python Creating lists.
Chapter 5: Lists and Dictionaries
Text Analyzer BIS1523 – Lecture 14.
Topics Sequences Introduction to Lists List Slicing
Files Handling In today’s lesson we will look at:
Python Lists and Sequences
LING 408/508: Computational Techniques for Linguists
Advanced Python Data Structures
Topics Introduction to File Input and Output
Basic Python Review BCHB524 Lecture 8 BCHB524 - Edwards.
Introduction to Computer Science
Topics Sequences Introduction to Lists List Slicing
string functions isspace() – used to check the string is space x= “ "
Topics Introduction to File Input and Output
Introduction to Computer Science
Presentation transcript:

DAY 3. ADVANCED PYTHON PRACTICE SANGREA SHIM TAEYOUNG LEE

.split()  Divide string by delimiter  Usage) FUNCTION FOR STRING

.strip()  Remove both side gap of string .rstrip() – right strip .lstrip() – left strip  Usage) FUNCTION FOR STRING

.replace(‘a’,’b’)  Replace ‘a’ to ‘b’  Usage) FUNCTION FOR STRING

.zfill()  Filling 0  Ex) 001, 0035  Usage) FUNCTION FOR STRING

.append()  Add elements to end of list  Usage) FUNCTION FOR LIST

.insert()  Add elements to specific location  Usage) FUNCTION FOR LIST

.remove()  Remove element  Usage) FUNCTION FOR LIST

.pop()  Retrieve and remove element  Usage) FUNCTION FOR LIST

.join()  Join elements of list as string  Usage) FUNCTION FOR LIST

 set() & list()  Remove redundancy  Usage) FUNCTION FOR LIST

.keys() &.values()  Retrieve keys and values of dictionary as lists  Usage) FUNCTION FOR DICTIONARY

 open()  Usage)  open(file_path, ‘w’) for writing  open(file_path, ‘r’) for reading  Reading file .read() .readline() .readlines() FILE INPUT & OUTPUT

.read() – read entire file FILE INPUT & OUTPUT

.readline() – read one line for each command FILE INPUT & OUTPUT

.readlines() – read all line as list FILE INPUT & OUTPUT

 Use.readlines() with for loop FILE INPUT & OUTPUT

 File write FILE INPUT & OUTPUT

1. Make a file, “title.txt”, which contains “This is a sequence file” 2. Open the “title.txt” and print first row. Ex) “The first line is : ~” 3. Open /data2/python_study/ap2.fa and print it using whileHint) you can use.readline() 4. Same with problem 3, but, do not print, save as a file, “seq2.txt” 5. Same with problem 4, but, print second word. Ex) “The second word is : “ 6. Same with problem 3, but, you should set a variable ‘title’ save the first line of file and from the second line to the end should be saved into variable seq without newline character. Then, print title and seq variables 7. Get the codon and amino acid pairs repeatedly by standard input and loop (infinitely and if you entered ‘XXX’, the program is terminated). Then get the codon by standard input again as a key and print the value of that key 8. Using variable seq in problem 6, translate all the nucleotide sequences to amino acid sequence 9. Get a number by standard input and using variable seq in problem 6 or result of problem 8, print the next three amino acid from the number you enteredEx) if you has PheMetGlyGlnLysTrp and you enter 3, you have to get this result “The next three amino acids are Gln, Lys, Trp” 10. Enter amino acid and print the position of that amino acidEx) if you has PheMetGlyGlnLysTrpPhe and you enter ‘Phe’, you have to get this result “The amino acid is found at 1, 7” PRACTICE

CONVERTING multi-VCF to JoinMap LOC  Based on the python course  Make converting script

THAT’S IT FOR TODAY  Q & A