<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>BCSymbolSet done</title></head><body>
<div>I commited an updated version of BCSymbolSet, which is now
immutable, can return an array of symbols, etc and other
goodies.</div>
<div>Here is the header below, so you don't have to necessarily update
your project right now.</div>
<div><br></div>
<div>Comments and questions welcome!</div>
<div><br></div>
<div>charles</div>
<div><br></div>
<div>NB: next on my agenda is BCAbstractSequence et al... Also, my
full agenda is in the TODO file in the project, if you are curious
:-)</div>
<div><br></div>
<div><br></div>
<div><tt><font size="+1" color="#236E25">//</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">//
BCSymbolSet.h</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">// BioCocoa</font><font
size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">//</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">// Created by Alexander
Griekspoor on Fri Sep 10 2004.</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">// Copyright (c) 2004 The
BioCocoa Project. All rights reserved.</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">//</font><font size="+1"
color="#000000"><br>
<br>
</font><font size="+1" color="#683821">#import
<Foundation/Foundation.h></font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#683821">#import
"BCFoundationDefines.h"</font><font size="+1"
color="#000000"><br>
<br>
</font><font size="+1" color="#760F50">@class</font><font size="+1"
color="#000000"> BCSymbol;<br>
<br>
</font><font size="+1" color="#236E25">/*!<br>
@class BCSymbolSet<br>
@abstract A collection of BCSymbols of the same type<br>
@discussion BCSymbolSet objects provide a lot of flexibility for the
user<br>
* of the framework when creating and manipulating sequence
objects.<br>
* They can be thought of as filters, by restricting a sequence
object<br>
* to a certain set of symbols. For instance, a dna sequence could
be<br>
* created that will only accept the non-ambiguous bases A, T, G, C<br>
* but not the compound symbols like P and Y.<br>
*<br>
* BCSymbolSet objects are immutable. The class object provides a
number<br>
* of factory methods for prebuilt symbol sets such as<br>
* '+ (BCSymbolSet *)dnaSymbolSet' and '+ (BCSymbolSet
*)dnaStrictSymbolSet'.<br>
* It is recommanded to use these methods when creating a symbol
set<br>
* supported by the class. For other cases, a new BCSymbolSet can
easily<br>
* be created from an array of symbols, or by combining existing symbol
sets.<br>
* Because BCSymbolSet are immutable, new objects have to be created
to<br>
* modify existing symbol sets.<br>
*/</font><font size="+1" color="#000000"><br>
<br>
<br>
</font><font size="+1" color="#760F50">@interface</font><font
size="+1" color="#000000"> BCSymbolSet : NSObject
<NSCopying><br>
{<br>
<x-tab>
</x-tab>NSSet<x-tab> </x-tab>*symbolSet;<br>
<x-tab> </x-tab>BCSequenceType<x-tab>
</x-tab>sequenceType;<br>
}<br>
<x-tab> </x-tab><br>
</font><font size="+1"
color="#236E25"
>////////////////////////////////////////////////////////////////////<span
></span>////////</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">// OBJECT METHODS START
HERE</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">//</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#683821">#pragma mark ’</font><font
size="+1" color="#000000"><br>
</font><font size="+1" color="#683821">#pragma mark ’INITIALIZATION
METHODS</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">//</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">//
INITIALIZATION</font><font size="+1" color="#000000"><br>
</font><font size="+1"
color="#236E25"
>////////////////////////////////////////////////////////////////////<span
></span>////////</font><font size="+1" color="#000000"><br>
<br>
</font><font size="+1" color="#236E25">//designated
initializer</font><font size="+1" color="#000000"><br>
- (</font><font size="+1" color="#760F50">id</font><font size="+1"
color="#000000">)initWithArray:(NSArray *)symbols
sequenceType:(BCSequenceType)type;<br>
<br>
</font><font size="+1" color="#236E25">//decide the sequence type
based on the first symbol in the passed array</font><font size="+1"
color="#000000"><br>
- (</font><font size="+1" color="#760F50">id</font><font size="+1"
color="#000000">)initWithArray:(NSArray *)symbols;<br>
<br>
</font><font size="+1" color="#236E25">//initializes the symbol sets
using a string, by scanning the characters</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">//and generating symbols of the
right sequence type</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">// e.g. A --> Adenosine if
sequence type is DNA, Alanine if protein</font><font size="+1"
color="#000000"><br>
- (</font><font size="+1" color="#760F50">id</font><font size="+1"
color="#000000">)initWithString:(NSString *)stringOfCharacters
sequenceType:(BCSequenceType)type;<br>
<br>
</font><font size="+1" color="#236E25">//factory methods - return an
autoreleased object</font><font size="+1" color="#000000"><br>
+ (BCSymbolSet *)symbolSetWithArray:(NSArray *)symbols;<br>
+ (BCSymbolSet *)symbolSetWithArray:(NSArray *)symbols
sequenceType:(BCSequenceType)type;<br>
+ (BCSymbolSet *)symbolSetWithString:(NSString *)aString
sequenceType:(BCSequenceType)type;<br>
<br>
</font><font size="+1" color="#236E25">//pre-built symbol
sets</font><font size="+1" color="#000000"><br>
+ (BCSymbolSet *)dnaSymbolSet;<br>
+ (BCSymbolSet *)dnaStrictSymbolSet;<br>
+ (BCSymbolSet *)rnaSymbolSet;<br>
+ (BCSymbolSet *)rnaStrictSymbolSet;<br>
+ (BCSymbolSet *)proteinSymbolSet;<br>
+ (BCSymbolSet *)proteinStrictSymbolSet;<br>
+ (BCSymbolSet *)unknownSymbolSet;<br>
+ (BCSymbolSet *)unknownAndGapSymbolSet;<br>
<br>
<br>
</font><font size="+1"
color="#236E25"
>////////////////////////////////////////////////////////////////////<span
></span>////////</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">//</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#683821">#pragma mark ’</font><font
size="+1" color="#000000"><br>
</font><font size="+1" color="#683821">#pragma mark ’GENERAL
METHODS</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">//</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">// GENERAL
METHODS</font><font size="+1" color="#000000"><br>
</font><font size="+1"
color="#236E25"
>////////////////////////////////////////////////////////////////////<span
></span>////////</font><font size="+1" color="#000000"><br>
<br>
- (NSSet *)symbolSet;<br>
- (NSArray *)allSymbols;<br>
- (NSCharacterSet *)characterSetRepresentation;<br>
- (BCSequenceType)sequenceType;<br>
<br>
- (</font><font size="+1" color="#760F50">BOOL</font><font size="+1"
color="#000000">)containsSymbol:(BCSymbol
*)aSymbol;<x-tab> </x-tab></font><font size="+1"
color="#236E25">// aSymbol=W and contains A --> no</font><font
size="+1" color="#000000"><br>
- (</font><font size="+1" color="#760F50">BOOL</font><font size="+1"
color="#000000">)containsSymbolRepresentedBy:(BCSymbol
*)aSymbol;</font><font size="+1" color="#236E25"> // aSymbol=W and
contains A --> yes</font><font size="+1" color="#000000"><br>
- (</font><font size="+1" color="#760F50">BOOL</font><font size="+1"
color="#000000">)containsAllSymbolsRepresentedBy:(BCSymbol
*)aSymbol;</font><font size="+1" color="#236E25"> // aSymbol=W and
contains A,T --> yes</font><font size="+1" color="#000000"><br>
- (</font><font size="+1" color="#760F50">BOOL</font><font size="+1"
color="#000000">)containsSymbolRepresenting:(BCSymbol
*)aSymbol;</font><font size="+1" color="#236E25"> // aSymbol=A and
contains W --> yes</font><font size="+1" color="#000000"><br>
<br>
</font><font size="+1" color="#236E25">//creating new symbol sets from
existing ones</font><font size="+1" color="#000000"><br>
- (BCSymbolSet *)symbolSetByFormingUnionWithSymbolSet:(BCSymbolSet
*)otherSet;<br>
- (BCSymbolSet
*)symbolSetByFormingIntersectionWithSymbolSet:(BCSymbolSet
*)otherSet;</font></tt></div>
<div><tt><font size="+1" color="#236E25">/* TO DO (or not to do?)<br>
- (BCSymbolSet *)complementSet;<br>
- (BCSymbolSet *)expandedSet; // ambigous symbols expanded<br>
*/</font><font size="+1" color="#000000"><br>
<br>
- (</font><font size="+1" color="#760F50">BOOL</font><font size="+1"
color="#000000">)isSupersetOfSet:(BCSymbolSet *)theOtherSet;<br>
<br>
<br>
</font><font size="+1" color="#236E25">//NSCopying formal
protocol</font><font size="+1" color="#000000"><br>
- (</font><font size="+1" color="#760F50">id</font><font size="+1"
color="#000000">)copyWithZone:(NSZone *)zone;<br>
<br>
<br>
</font><font size="+1" color="#236E25">//BCSymbolSet is
immutable</font><font size="+1" color="#000000"><br>
</font><font size="+1" color="#236E25">//Keep this for a future
BCMutableSymbolSet, if ever needed</font><font size="+1"
color="#000000"><br>
</font><font size="+1" color="#236E25">/*<br>
/////////////////////////////////////////////////////////////////////<span
></span>///////<br>
//<br>
#pragma mark ’<br>
#pragma mark ’MUTABILITY METHODS<br>
//<br>
// MUTABILITY METHODS<br>
/////////////////////////////////////////////////////////////////////<span
></span>///////<br>
<br>
- (void)addSymbol:(BCSymbol *)symbol;<br>
- (void)addSymbols:(NSArray *)symbols;<br>
- (void)addSymbolsInString:(NSString *)aString;<br>
- (void)removeSymbol:(BCSymbol *)symbol;<br>
- (void)removeSymbols:(NSArray *)symbols;<br>
- (void)removeSymbolsInString:(NSString *)aString;<br>
<br>
- (void)formUnionWithSymbolSet:(BCSymbolSet *)otherSet;<br>
- (void)formIntersectionWithSymbolSet:(BCSymbolSet *)otherSet;<br>
- (void)makeComplementary;<br>
*/</font><font size="+1" color="#000000"><br>
<br>
</font><font size="+1" color="#760F50">@end</font><font size="+1"
color="#000000"><br>
</font></tt></div>
<x-sigsep><pre>--
</pre></x-sigsep>
<div>Help science go fast forward:<br>
http://cmgm.stanford.edu/~cparnot/xgrid-stanford/<br>
<br>
Charles Parnot<br>
charles.parnot@stanford.edu<br>
<br>
Room B157 in Beckman Center<br>
279, Campus Drive<br>
Stanford University<br>
Stanford, CA 94305 (USA)<br>
<br>
Tel +1 650 725 7754<br>
Fax +1 650 725 8021</div>
</body>
</html>