[Biococoa-dev] New class: BCEntrezController
Koen van der Drift
koenvanderdrift at gmail.com
Mon Oct 3 15:13:46 EDT 2011
I have committed a new class BCEntrezController to the trunk. This class is are heavily based on Alexander's EntrezController class that he committed a few years ago to BioCocoa and is used in Mekentosj's program EnzymeX. I choose not to update his class in svn, but to create a new one, so his original entry will still be available for reference. His original class is tied to the Entrez.nib file, and I left that connection intact as well. Interestingly, this class does not use any of the BC classes at all :)
The main update is that the code now uses the native NSXMLParser instead of an older/outdated third party framework. I don't know if using NSXMLParser is the most efficient, I read about other parsers such as libxml, but for me it works. The second major change with the original code is that the data are now stored in an NSSDictionary, instead of in an EntrezResult object. The main advantage I think is that by using an NSDictionary, parsing becomes more flexible, and the user can add any info from the search results in their data model. For instance, I have added the url of the sequence as an example. But anything can be added if that info is available and needed: authors, annotations, mutations, references, etc. Finally, multiple records can be fetched at once, and are send to the delegate as an NSArray.
Obviously, there are other improvements possible: choosing a different database, choosing whether to search for proteins or nucleotides, etc. But I will leave that up to the reader. The parser code could also be factored out for more flexibility.
I will also add a demo application soon that demonstrates the use of this class.
More information about the Biococoa-dev