Now that you have mastered Learning Python, wetted your feet with Biopython with DNA sequence manipulations, let's start doing some useful stuff with BioPython.

In Class exercises:

Exercise 1.
Write a python script that blasts the NCBI database for sequences in 'm_cold.fasta' file and returns the set of blast output sequence information in a file called my_blast.out. You can use it later for parsing.
(Hint: Use the Fasta, Blast and NCBIWWW modules and see biopython section 3.1.1)

Question 2.
Write python code that uses the file 'opuntia.fasta', which has a lot of sequences in the fasta format, aligns them and prints alignment to test.aln file. Next it use the alinment to print description, sequence, alignmentand length.
(Hint: use clustal, MultipleAlignCL and AlignInfo modules, see biopython section 3.5.1)

Question 3.
Write python code that asks the user for the search-term, prints the list of seq ids and prints only the records that have your favorite authors. Print the following information on the first five records.

Title: Differential recognition of the polypyrimidine-tract by the general splicing factor U2AF65 and the splicing repressor sex-lethal.
Authors: ['Singh R', 'Banerjee H', 'Green MR']
Source: RNA 2000 Jun;6(6):901-11.

Try searching for U2AF and print the current local time and only those records authored by Singh( just for reference, you can choose whatever you want).
(Hint: use Medline and Pubmed modules, see biopython section 3.3).

##################################################################################################################################################################
Since I'm not sure if all of it works on MacIntosh, it is a good time to start wetting your feet and hands with UNIX.
How to log onto beagle (a UNIX box):
Find the telnet program (Nice thing is you can do it from anywhere).
From file menu, select Open connection.
In the window that pops up (shown below), type beagle.colorado.edu
click Connect button

This much of really hard work will open a terminal window (shown below).
Type in your user name and password and you are in your home sweet home (no need to pay martgage here). This window also contain a few commands that will let you list items of a director (ls), make a new dir (mkdir), change to a dir (cd), give the path (a paved road from start, usually root (aka / ) to where you are) of that directory (pwd), [which you should highlight and copy with your mouse], remember subdirectories are separated by a slash (/) and directories are Folders on MacIntosh. Now change to rsingh/students directory (cd ~rsingh/students), list what's in there (ls), copy two fasta files (cp) to the directory you made in your unix account (the blue highlighted stuff called path you copied earlier), and change back to your desired directory (cd). Remember that cd followed by return is an express train to take you to your home directory from whereever you happen to be. Now list to see if those two file magically appeared into your directory (ls). Bingo. The figure below is exactly what I did from start to end, except that your user name and directory paths will appear different. Good luck.


 

Now you can either use pico, vi or the bbedit text editors and save the file name.py in this directory. You can run this code by typing
(beagle)[6:07pm]my_python>> python name.py ##The bold face is the unix commandline prompt., which is there, you just type python name.py and hit return. Hitting return is required after any command. [Warning: don't go to the python interpretor by typing python alone. Stay outside of the python interpretor).

When you write your python code, you need to bring it to this directory. One way is to use fetch, which is a program that opens a window (shown below). Make sure you have selected the appropriate directory. Now you can drag from your desktop and drop onto the fetch. Now if you go back to your telnet terminal on beagle, this file shows up in that directory.

            

If you are not already confused, let me try one more thing. On MacIntosh, BBEdit is a nice editor and in the file menu there is an option to save (shift+apple+s keys for short-cut) your script directly to your appropriate directory onto server (beagle.colorado.edu).  You will need your beagle password and it remembers the password for each session as you edit, re-save. (Now you can go back to telnet terminal and run the saved script). Also you can open  the file from server, using from the file menu or the short-cut for open (shift+apple+o keys). If you decide to go this path you can live without using the vi/pico/emacs editors of unix, but other than the demo version of BBEdit, it costs.