Download Lab 2 note File - The Huttenhower Lab

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Lab 2
2/7/2012
Fah Sathirapongsasuti <[email protected]> and Emily Kay <[email protected]>
print vs return (in a function)
Respect function prototype! Function as abstraction.
Python help (i.e. help(function) e.g. help(sorted))
Handling arrays
a. Append, extend, concatenate
b. Slicing notation (x[1:5], x[:10], x[1:2] = [1,2,3])
c. Last elements (x[-1])
d. Copy vs reference
5.
Handling strings
a. Str.strip()
b. Str.split()
c. “\t”.join()
6.
Loop routines
a. Looping over a list
b. Keeping track of something through the loop (e.g. sum, don’t reset at beginning of the
loop)
c. While loop vs for loop
d. Different ways to do for loop (for x in list, for i in
range(len(list)))
7.
Unix
a. Cat, head, less, grep, wc
b. Piping:
i. Cat file1 file2 | less
ii. Head file1 > file1.head
iii. Python printSomething.py > outfile.txt
c. Sys.stdin
i. Format fastq --> fasta
ii. Deal with BED file
8.
Two examples from Monday’s lecture note
9. if __name__ == “__main__”:
10. import csv
1.
2.
3.
4.
Related documents