---------- PYTHON II Good book can help but: Un-recommendation: Zelle python book Scripts -- if you start with examples in the scripts folder, you won't be able to make a new one and edit it, so we will eventually rename the examples as 1,2,3 Exponents: ** not ^ .strip() -- if you specify \n, your program might not work cross platform if you know there won't be empty fields, you can use .strip() or you can do both .strip{"\n").strip("\r") List indexing -- why [::-1] reverses a string or list Computer friendly data files: ** Example Nanodrop file .ndj in examples folder Reading lines in python: to get the whole file in a list at once (needs memory), you can use for Line in InFile.readlines(): but usually more efficient to just do it line by line... for Line in InFile: ========== Exercise: read fasta file into a list (create in scripts folder, run from examples folder) use FPexcerpt.fta as the input. Outline: 1. Get name of file from user input (extra credit, make it do multiple files). To start: get it to print the file name. 2. Use sys.stderr.write() to give feedback (Won't be captured by >) 3. Print help if the user doesn't enter a file name 4. open file, read in lines: (extra credit: skip blank, header, and comment lines) 5. if it is a sequence name, save it in a list, increment the sequence number. set up a blank sequence to go along with it 6. if it is a portion of a sequence, strip out [spaces, \n, dashes] and append to existing sequence 7. when done, use a new for loop to go through and print out a table of size, pct composition AGCT ========== Potential class projects: • Nanodrop data to XYYY (see ndj in examples folder) skip blanks • Extract fasta alignment from specified contig in specified .ace file format: CO is the contig, RD are the reads that went into it. see ace_output.fta and ace_example.ace, alongn with VM1 • Print formatted output using HTML with
TEXT
see color.html