Thursday, February 16, 2012

Exploring interactively a BLAST XML alignment

Suppose you want to explore interactively the result of a BLAST alignment. If you have exported the XML format from the NCBI site, you may load it in BioSmalltalk into a BioNCBIBlastReader object, and open an explorer window to send messages to this object.
| blastReader |
blastReader :=
BioNCBIBlastReader
newFromXML: 'Data\BLASTs\YT817301R-Alignment.xml'.
The usual way smalltalkers evaluate the source code, implies selecting the code and opening the contextual menu to select the "Explore" item. Here is a screenshot of how an Explorer window looks like:



The next step is to find which messages we could send to that object, so you need to browse the object class. This is done by bringing the contextual menu over that object and selecting Browse.

Now as you may select any of the browse items, the "browse hierarchy" is the best option when you don't remember all the class behaviors, because will open a Hierarchy Browser enabling to view the whole BioNCBIBlastReader hierarchy.










The picture describes the basic architecture of a Class Hierarchy Browser. Generally when exploring an object behavior, the most important is the "Method List" (the 3rd one) which lists all the messages you may send to an object. The so-called "Method Pane" or "Code Pane" (the 4th pane) is the region where you may edit the source code, and is where you look at when you try to understand method usage, or modify the implementation.

These message are sent in the bottom pane in the Explorer window (so the "self" is the blast reader), and shown results to some message sends to the blast reader object:


self blastDbName " -> 'nr' "
self blastQueryLength " -> '923'"
self hitAccessionsAsString first: 3 " -> an OrderedCollection('JN382560.1' 'JQ070349.1' 'EU281529.1')"
self hitAccessionsAsTokens first: 3 " -> an OrderedCollection(#('JN382560' '1') #('JQ070349' '1') #('EU281529' '1') "
self hspHSeqs first: 2 " -> an OrderedCollection('AACTATTCCCTGAACACTATTAATATAGTTCCATAAATACAAAGAGCCTTATCAGTATTAAATTTATCAAAAATCCCAATAACTCAACACAGAATTTGCACCCTAACCAAATATTACAAACACCACTAGCTAACATAACACGCCCATACACAGACCACAGAATGAATTACCTACGCAAGGGGTAATGTACATAACATTAATGTAATAAAGACATAATATGTATATAGTACATTAAATTATATGCCCCATGCATATAAGCAAGTACATGACCTCTATAGCAGTACATAATACATATAATTATTGACTGTACATAGTACATTATGTCAAATTCATTCTTGATAGTATATCTATTATATATTCCTTACCATTAGATCACGAGCTTAATTACCATGCCGCGTGAAACCAGCAACCCGCTAGGCAAGGATCCCTCTTCTCGCTCCGGGCCCATAAATCGTGGGGGTCGCTATCCAATGAATTTTACCAGGCATCTGGTTCTTTCTTCAGGGCCATCTCATCTAAAACGGTCCATTCTTTCCTCTTAAATAAGACATCTCGATGGACTAATGGCTAATCAGCCCATGCTCACACATAACTGTGCTGTCATACATTTGGTATTTTTTTATTTTGGGGGATGCTTGGACTCAGCTATGGCCGTCAAAGGCCCTGACCCGGAGCATCTATTGTAGCTGGACTTAACTGCATCTTGAGCACCAGCATAATGATAAGCGTGGACATTACAGTCAATGGTCACAGGACATAAATTATATTATATATCCCCCCTTCATAAAAATTTCCCCCTTAAATATCTACCACCACTTTTAACAGACTTTTCCCTAGATACTTATTTAAATTTTTCACGCTTTCAATACTCAATTTAGCACTCCAAACAAAGTCAATATATAAACGCAGGCCCCCCCCCCCCG' 'AACTATTCCCTGAACACTATTAATATAGTTCCATAAATACAAAGAGCCTTATCAGTATTAAATTTATCAAAAATCCCAATAACTCAACACAGAATTTGCACCCTAACCAAATATTACAAACACCACTAGCTAACATAACACGCCCATACACAGACCACAGAATGAATTACCTACGCAAGGGGTAATGTACATAACATTAATGTAATAAAGACATAATATGTATATAGTACATTAAATTATATGCCCCATGCATATAAGCAAGTACATGACCTCTATAGCAGTACATAATACATATAATTATTGACTGTACATAGTACATTATGTCAAATTCATTCTTGATAGTATATCTATTATATATTCCTTACCATTAGATCACGAGCTTAATTACCATGCCGCGTGAAACCAGCAACCCGCTAGGCAGGGATCCCTCTTCTCGCTCCGGGCCCATAAACCGTGGGGGTCGCTATCCAATGAATTTTACCAGGCATCTGGTTCTTTCTTCAGGGCCATCTCATCTAAAACGGTCCATTCTTTCCTCTTAAATAAGACATCTCGATGGACTAATGGCTAATCAGCCCATGCTCACACATAACTGTGCTGTCATACATTTGGTATTTTTTTATTTTGGGGGATGCTTGGACTCAGCTATGGCCGTCAAAGGCCCTGACCCGGAGCATCTATTGTAGCTGGACTTAACTGCATCTTGAGCACCAGCATAATGATAAGCGTGGACATTACAGTCAATGGTCACAGGACATAAATTATATTATATATCCCCCCTTCATAAAAATTTCCCCCTTAAATATCTACCACCACTTTTAACAGACTTTTCCCTAGATACTTATTTAAATTTTTCACGCTTTCAATACTCAATTTAGCACTCCAAACAAAGTCAATATATAAACGCAGGCCCCCCCCCCCCG') "

Nothing prevents you from opening another Explorer with the results of sending #hitIdentifiers and writing more messages to the resulting collection, as depicted in the following screenshot:


That's a little introduction of how to work in the Smalltalk environment with Bio objects. Basically remember all the time you have real objects, even the window buttons are objects, and almost all the environment is easily accessible by the very basic tools which exists for more than 30 years!. Following posts will include more tools and more interesting messages for working with BioSmalltalk.

0 comments:

Post a Comment