Search This Blog

Monday, July 5, 2010

What happens when you open a Stockholm File?

Alot of things, and a journey through how Jalview works. I wrote out part of this before in my notebook, but I hadn't connected it to the Stockholm file parser before. I haven't described the different types of objects yet, but here is the data flow:


jalview.gui.Desktop calls file loading functions, Stockholm parse is called, and then a new window with the alignment is displayed.

In jalview.gui package
-Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport) is called
--->calls FileLoader.LoadFile() in jalview.io package
-------this starts a new thread, which calls FileLoader.run() (use start() method to do this)
-----------Checks file format
-----------Alignment object = FormatAdapter().readFromFile(source,format) in jalview.io package
-------------->calls AppletFormatAdapter.readFromFile
------------------>Calls StockholmFile()

In StockholmFile in jalview.io
-StockholmFile extends AlignFile which extends FileParse
--->Fileparse() resolves type, checks if valid file type, position in file
--->AlignFile() calls parse(), which is in StockholmFile()
------->StockholmFile.parse() called
-----------checks if file has Stockholm file features, e.g. starts with #STOCKHOLM \d.\d
-----------use regular expressions to figure out line type
--------------if not an annotation line, process sequence line and store in hashtable
--------------else, figure out annotation type
------------------>if GC annotation, call parseAnnotationRow() to parse secondary structure

StockholmFile.parseAnnotationRow(annotations member of AlignFile, ID, sequence)
-make Annotation array else
-for each position in sequence
---->make Annotation obj ann
-------->component secondary structure determined by getDssp3State (jalview.schemes.ResidueProperties)

(Basically this is creating an annotation for each position)

-create AlignmentAnnotation object annots
--->calls validateRangeAndDisplay()
------>calls labelsSecondaryStructure()

-returns annots


Finally, back in the Desktop instance, the viewport is changed and you see the alignment visualization.
--if viewport exists, update using firePropertyChange()
--else new AlignFrame object is created
-----new AlignViewport object is created and initialized

No comments:

Post a Comment