1 // 2 // BCNucleotideRNA.h 3 // BioCocoa 4 // 5 // Created by John Timmer on 8/11/04. 6 // Copyright (c) 2003-2009 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 in-memory representations of RNA bases. 34 */ 35 36 #import <Foundation/Foundation.h> 37 #import "BCNucleotide.h" 38 39 @class BCNucleotideDNA; 40 41 /*! 42 @class BCNucleotideRNA 43 @abstract All RNA bases are handled through this single class 44 @discussion This class provides in-memory representations of RNA bases. 45 * Through class methods and static variables, single application wide representations 46 * of each individual base and the ambiguous base representations are provided to all 47 * BioCocoa applications. Access to an individual base is provided by methods such as: 48 * [BCNucleotideRNA adenine]; 49 * [BCNucleotideRNA purine]; 50 * Repesentations of a non-base and gap characters (for alignments) are also available. 51 * Typically, bases are not handled directly, but rather through their container objects, 52 * BCSequence subclasses. 53 * 54 * Why not use strings? 55 * Unicode characters are 16bit, while pointers on MacOS-X are (currently) 32 bit. In 56 * the overall picture, memory differences are not significant. In return, each base provides 57 * detailed information about complements, ambiguity, etc. which would otherwise need to be coded 58 * by hand. 59 * 60 * Initialization of base data 61 * Details of base information and relationships are read from the "base template.plist" file 62 * within the Framework bundle. Loss or alteration of this file will cause all RNA-based programs 63 * to fail. References to other bases (ie - the complement) are retained as string-formatted selectors 64 * until they are needed, at which point they are used to generate pointers to the other bases. 65 * Custom bases can be generated using this file as an example - they remain stored in an NSDictionary. 66 * 67 * Individual bases are obtained using their named class method, or by sending an appropriate symbol to the 68 * "symbolForChar:" class method. 69 */ 70 71 @interface BCNucleotideRNA : BCNucleotide 72 { 73 } 74 75 76 #if 0 77 #pragma mark == CLASS METHODS == 78 #endif 79 80 81 /*! 82 @method initBases 83 @abstract Used internaly to generate the full set of base objects. 84 */ 85 + (void) initBases; 86 87 88 /*! 89 @method symbolForChar: 90 @abstract Returns a BCNucleotideRNA item representing the base submitted 91 */ 92 + (id) symbolForChar: (unsigned char)symbol; 93 94 95 /*! 96 @method objectForSavedRepresentation: 97 @abstract Returns a BCNucleotideRNA object representing the base submitted 98 @discussion all BC classes should implement a "savableRepresentation" and an 99 * "objectForSavedRepresentation" method to allow archiving/uncarchiving in 100 * .plist formatted files. 101 */ 102 + (id) objectForSavedRepresentation: (NSString *)aSymbol; 103 104 105 /*! 106 @method adenosine 107 @abstract Obtains a reference to the single adenosine representation 108 */ 109 + (BCNucleotideRNA *) adenosine; 110 111 /*! 112 @method uridine 113 @abstract Obtains a reference to the single thymidine representation 114 */ 115 + (BCNucleotideRNA *) uridine; 116 117 118 /*! 119 @method cytidine 120 @abstract Obtains a reference to the single cytidine representation 121 */ 122 + (BCNucleotideRNA *) cytidine; 123 124 125 /*! 126 @method guanidine 127 @abstract Obtains a reference to the single guanidine representation 128 */ 129 + (BCNucleotideRNA *) guanidine; 130 131 132 /*! 133 @method anyBase 134 @abstract Obtains a reference to the single N representation 135 */ 136 + (BCNucleotideRNA *) anyBase; 137 138 /*! 139 @method purine 140 @abstract Obtains a reference to the single purine representation 141 */ 142 + (BCNucleotideRNA *) purine; 143 144 /*! 145 @method pyrimidine 146 @abstract Obtains a reference to the single pyrimidine representation 147 */ 148 + (BCNucleotideRNA *) pyrimidine; 149 150 /*! 151 @method strong 152 @abstract Obtains a reference to the single strong-bond representation 153 */ 154 + (BCNucleotideRNA *) strong; 155 156 /*! 157 @method weak 158 @abstract Obtains a reference to the single weak-bond representation 159 */ 160 + (BCNucleotideRNA *) weak; 161 162 /*! 163 @method M 164 @abstract Obtains a reference to the single M (A, C) representation 165 */ 166 + (BCNucleotideRNA *) amino; 167 168 /*! 169 @method K 170 @abstract Obtains a reference to the single K (G, U) representation 171 */ 172 + (BCNucleotideRNA *) keto; 173 174 /*! 175 @method H 176 @abstract Obtains a reference to the single H (A, C, U) representation 177 */ 178 + (BCNucleotideRNA *) H; 179 180 /*! 181 @method V 182 @abstract Obtains a reference to the single V (A, C, G) representation 183 */ 184 + (BCNucleotideRNA *) V; 185 186 /*! 187 @method D 188 @abstract Obtains a reference to the single D (A, G, U) representation 189 */ 190 + (BCNucleotideRNA *) D; 191 192 /*! 193 @method B 194 @abstract Obtains a reference to the single D (C, G, U) representation 195 */ 196 + (BCNucleotideRNA *) B; 197 198 /*! 199 @method gap 200 @abstract Obtains a reference to the single representation of a gap, for alignments 201 */ 202 + (BCNucleotideRNA *) gap; 203 204 /*! 205 @method undefined 206 @abstract Obtains a reference to the single representation of any non-base character 207 */ 208 + (BCNucleotideRNA *) undefined; 209 210 211 /*! 212 @method customBase: 213 @abstract Obtains a reference to a user-defined base 214 */ 215 + (BCNucleotideRNA *) customBase: (NSString *)baseName; 216 217 #if 0 218 #pragma mark == OBJECT METHODS == 219 #endif 220 221 #if 0 222 #pragma mark == INITIALIZATION METHODS == 223 #endif 224 225 226 /*! 227 @method initWithSymbolChar: 228 @abstract designated initialization method 229 @discussion Given a symbol, this method generates the appropriate Nucleotide representation using 230 * information in the bundle's "base template.plist" file. 231 */ 232 - (id)initWithSymbolChar:(unsigned char)aChar; 233 234 #if 0 235 #pragma mark == BASE INFORMATION METHODS == 236 #endif 237 238 /*! 239 @method isBase 240 @abstract Returns NO if the receiver is a gap or undefined 241 */ 242 - (BOOL) isBase; 243 244 #if 0 245 #pragma mark == BASE RELATIONSHIP METHODS == 246 #endif 247 248 - (BCNucleotideDNA *) DNABaseEquivalent; 249 250 @end 251