ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/BioCocoa/BioCocoa/trunk/BCFoundation/BCSequenceIO/BCCachedSequenceFile.h
Revision: 350
Committed: Wed Aug 19 16:45:07 2015 UTC (4 years, 9 months ago) by schristley
File size: 3548 byte(s)
Log Message:
MPI timing
Line File contents
1 //
2 // BCCachedSequenceFile.h
3 // BioCocoa
4 //
5 // Created by Scott Christley on 9/10/07.
6 // Copyright (c) 2007-2010 The BioCocoa Project.
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions
11 // are met:
12 // 1. Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // 2. Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 // 3. The name of the author may not be used to endorse or promote products
18 // derived from this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 /*!
32 @header
33 @abstract Provides cached access to biological sequences stored in files.
34 */
35
36 #import <Foundation/Foundation.h>
37 #import "BCSequenceReader.h"
38
39 /*!
40 @class BCCachedSequenceFile
41 @abstract Class that holds a biological sequence (DNA, protein, etc.)
42 @discussion For handling very large sequence files,
43 we do not want to read in all of sequence data into memory; instead we parse the file
44 and pull out meta-data. Working with the sequence data is handled by a specific cached
45 sequence class which reads data from the file when needed.
46 */
47
48 @interface BCCachedSequenceFile : NSObject {
49 NSString *sequenceFile;
50 NSMutableDictionary *sequenceInfo;
51 NSMutableArray *sequenceList;
52
53 FILE *fileHandle;
54 int currentSequenceNumber;
55 NSDictionary *currentSequence;
56 }
57
58 /*!
59 @method readCachedFileUsingPath:
60 @abstract initializes a BCCachedSequenceFile object with sequence data in file.
61 */
62 + (id)readCachedFileUsingPath:(NSString *)filePath;
63
64 /*!
65 @method readCachedFileUsingPath:format:
66 @abstract initializes a BCCachedSequenceFile object with sequence data in file of specified format.
67 */
68 + (id)readCachedFileUsingPath:(NSString *)filePath format:(BCFileFormat)aFormat;
69
70 /*!
71 @method initWithContentsOfFile:
72 @abstract Overridden by subclasses to handle specific file formats.
73 */
74 - (id)initWithContentsOfFile:(NSString *)filePath;
75
76 - (NSMutableArray *)sequenceArray;
77 - (unsigned)numberOfSequences;
78 - (NSDictionary *)infoForSequence:(NSString *)seqID;
79 - (NSDictionary *)infoForSequenceNumber:(int)seqNum;
80
81 - (char)symbolAtPosition:(unsigned long long)aPos forSequence:(NSString *)seqID;
82 - (char)symbolAtPosition:(unsigned long long)aPos forSequenceNumber:(int)seqNum;
83
84 - (int)symbols:(char *)aBuffer atPosition:(unsigned long long)aPos ofLength:(unsigned)aLen forSequenceNumber:(int)seqNum;
85 - (int)symbols:(char *)aBuffer atPosition:(unsigned long long)aPos ofLength:(unsigned)aLen forSequence:(NSString *)seqID;
86
87 - (void)closeFileHandle;
88
89 @end