I'm a complete Cocoa newbie and I'm writing a simple program that parses a text file containing multiple DNA sequences. So far, the program parses the file such that the DNA sequences and sequence names are stored in 2 NSMutableArrays (I realise that NSDictionary might be more appropriate with the sequence name as the key, but I haven't got round to that yet).
So far so good. However, I'm now wanting to have an instance of my new Sequence class to encapsulate the sequence and sequence name so that I can easily query the object for, say, various subsections of the sequence or the sequence length. Does this make sense? If the file contains 10 sequences, I'll have 10 sequence objects with methods like - (int)length and - (NSString)reversecomplement (for retrieving the other DNA strand).
So, I've made my file parsing code allocate and initialise a sequence object for each sequence it finds in the file. But my question is this: after the objects are initialised, what is the standard way of keeping track of them? Do I use an NSDictionary, an NSArray or is there a standard way of doing this that I'm missing? Basically if I have a sequence object whose sequenceName is Foo, how do I find it again after it's been created?
I've searched these forums and Google for an answer to this, but with little success... Any help is appreciated!
So far so good. However, I'm now wanting to have an instance of my new Sequence class to encapsulate the sequence and sequence name so that I can easily query the object for, say, various subsections of the sequence or the sequence length. Does this make sense? If the file contains 10 sequences, I'll have 10 sequence objects with methods like - (int)length and - (NSString)reversecomplement (for retrieving the other DNA strand).
So, I've made my file parsing code allocate and initialise a sequence object for each sequence it finds in the file. But my question is this: after the objects are initialised, what is the standard way of keeping track of them? Do I use an NSDictionary, an NSArray or is there a standard way of doing this that I'm missing? Basically if I have a sequence object whose sequenceName is Foo, how do I find it again after it's been created?
I've searched these forums and Google for an answer to this, but with little success... Any help is appreciated!