[Biococoa-dev] Even more on sequence formats
Koen van der Drift
kvddrift at earthlink.net
Sat Apr 15 10:34:57 EDT 2006
On Apr 11, 2006, at 6:46 AM, Alexander Griekspoor wrote:
> - (NSDictionary *)readFile:(NSString *)textFile
> {
> NSMutableDictionary *theContents;
> NSString *lineBreak;
>
> // BINARY
> // Strider?
> if([NSHFSTypeOfFile(textFile) isEqualToString: @"'xDNA'"]){
>
> theContents = (NSMutableDictionary*) [self
> readStriderFile:textFile];
>
> // GCK?
> }else if([NSHFSTypeOfFile(textFile) isEqualToString: @"'GCKc'"] ||
> [NSHFSTypeOfFile(textFile) isEqualToString: @"'GCKs'"]){
>
> theContents = (NSMutableDictionary*) [self readGCKFile:textFile];
>
> // TEXT
> }else {
> NSMutableString *sequenceFile;
>
> // EXDNA
> if([[textFile pathExtension]isEqualToString:@"exdna"])
> sequenceFile = [NSMutableString stringWithContentsOfFile:
> [textFile stringByAppendingPathComponent: @"sequence.txt"]];
> else
> sequenceFile = [NSMutableString stringWithContentsOfFile:textFile];
>
>
With these new great additions, I was wondering if we should slightly
rethink the methods in BCSequenceReader. Right now we have
- (BCSequenceArray *)readFileUsingPath:(NSString *)filePath
{
return nil; // TODO
}
- (BCSequenceArray *)readFileUsingData:(NSData *)dataFile
{
NSString *entryString = [[NSString alloc] initWithData: dataFile
encoding:NSASCIIStringEncoding];
return [self readFileUsingText: [entryString autorelease]];
}
and
- (BCSequenceArray *)readFileUsingText:(NSString *)entryString
{
...
}
The last one contains all the actual code. So maybe we should factor
out the code with NSHFSTypeOfFile and the exdna part to
readFileUsingPath, and let that method call in turn
readFileUsingText, which actually deals with a contentstring. This
will allow users to either pass a path, or the contents of a file or
a data object.
What do you guys think?
cheeers,
- Koen.
More information about the Biococoa-dev
mailing list