Click or drag to resize
Sequence Class
This is the standard implementation of the ISequence interface. It contains the raw data that defines the contents of a sequence. Since Sequence uses enumerable of bytes that can be accessed as follows: Sequence mySequence = new Sequence(Alphabets.DNA, "GATTC"); foreach (Nucleotide nucleotide in mySequence) { ... } The results will be based on the Alphabet associated with the sequence. Common alphabets include those for DNA, RNA, and Amino Acids. For users who wish to get at the underlying data directly, Sequence provides a means to do this as well. This may be useful for those writing algorithms against the sequence where performance is especially important. For these advanced users access is provided to the encoding classes associated with the sequence.
Inheritance Hierarchy
SystemObject
  BioSequence

Namespace: Bio
Assembly: Bio.Core (in Bio.Core.dll) Version: 2.0.0.1 (2.0.0.1)
Syntax
public sealed class Sequence : ISequence, 
	IEnumerable<byte>, IEnumerable

The Sequence type exposes the following members.

Constructors
  NameDescription
Public methodSequence(ISequence)
Initializes a new instance of the Sequence class with passed new Sequence. Creates a copy of the sequence.
Public methodSequence(IAlphabet, Byte)
Initializes a new instance of the Sequence class with specified alphabet and bytes. Bytes representing Symbols in the values are validated with the specified alphabet.
Public methodSequence(IAlphabet, String)
Initializes a new instance of the Sequence class with specified alphabet and string sequence. Symbols in the sequence are validated with the specified alphabet.
Public methodSequence(IAlphabet, Byte, Boolean)
Initializes a new instance of the Sequence class with specified alphabet and bytes.
Public methodSequence(IAlphabet, String, Boolean)
Initializes a new instance of the Sequence class with specified alphabet and string sequence.
Top
Properties
  NameDescription
Public propertyAlphabet
Gets or sets the alphabet to which symbols in this sequence belongs to.
Public propertyCount
Gets the number of bytes contained in the Sequence.
Public propertyID
Gets or sets an identifier for this instance of sequence class.
Public propertyItem
Returns the byte found at the specified index if within bounds. Note that the index value starts at 0.
Public propertyMetadata
Gets or sets the Metadata of this instance. Many sequence representations when saved to file also contain information about that sequence. Unfortunately there is no standard around what that data may be from format to format. This property allows a place to put structured metadata that can be accessed by a particular key.

For example, if species information is stored in a particular Species class, you could add it to the dictionary by:

mySequence.Metadata["SpeciesInfo"] = mySpeciesInfo;

To fetch the data you would use:

Species mySpeciesInfo = mySequence.Metadata["SpeciesInfo"];

Particular formats may create their own data model class for information unique to their format as well. Such as:

GenBankMetadata genBankData = new GenBankMetadata(); // ... add population code mySequence.MetaData["GenBank"] = genBankData;.

Top
Methods
  NameDescription
Public methodConvertToString
Converts part of the sequence to a string.
Public methodCopyTo
Copies all items from the sequence to a pre allocated array.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetComplementedSequence
Return a new sequence representing the complement of this sequence.
Public methodGetEnumerator
Gets an enumerator to the bytes present in this sequence.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetReverseComplementedSequence
Return a new sequence representing the reverse complement of this sequence.
Public methodGetReversedSequence
Return a new sequence representing this sequence with the orientation reversed.
Public methodGetSubSequence
Return a new sequence representing a range (subsequence) of this sequence.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOfNonGap
Gets the index of first non-gap symbol.
Public methodIndexOfNonGap(Int64)
Returns the position of the first symbol beyond startPos that does not have a Gap symbol.
Public methodLastIndexOfNonGap
Gets the index of last non-gap symbol.
Public methodLastIndexOfNonGap(Int64)
Returns the index of last non-gap symbol before the specified end position.
Public methodToString
Returns a string representation of the sequence data. This representation will come from the symbols in the alphabet defined for the sequence. Thus a Sequence whose Alphabet is Alphabets.DNA may return a value like 'GATTCCA'
(Overrides ObjectToString.)
Top
Extension Methods
  NameDescription
Public Extension MethodAppendByte(Byte)Overloaded.
Yield an Enumeration of the list with the item appended to the end
(Defined by IEnumerableExtensions.)
Public Extension MethodAppendByte(IEnumerableByte)Overloaded.
Yield a concatenation of the two Enumerable lists
(Defined by IEnumerableExtensions.)
Public Extension MethodConvertToString
Converts the sequence to a string.
(Defined by SequenceExtensions.)
Public Extension MethodElementAtByte
Returns the element at a specified index in a sequence.
(Defined by IEnumerableExtensions.)
Public Extension MethodForEachByte(ActionByte)Overloaded.
Calls an action on each element of a sequence. The action takes one argument: an element. It has no return value.
(Defined by IEnumerableExtensions.)
Public Extension MethodForEachByte(ActionByte, Int32)Overloaded.
Calls an action on each element of a sequence. The action takes two arguments: an element and the index of the element. It has no return value.
(Defined by IEnumerableExtensions.)
Public Extension MethodIsMarkedAsReverseComplement
This checks for a sequence marker to determine if the given ISequence was generated from a reverse complement.
(Defined by SequenceExtensions.)
Public Extension MethodMarkAsReverseComplement
This adds a key to the Metadata to indicate this is a reversed sequence
(Defined by SequenceExtensions.)
Public Extension MethodShuffleByte
Shuffles the elements of a sequence.
(Defined by IEnumerableExtensions.)
Public Extension MethodStringJoinOverloaded.
Creates a string from a sequence of elements. No delimiter is used.
(Defined by IEnumerableExtensions.)
Public Extension MethodStringJoin(String)Overloaded.
Creates a delimited string from a sequence of elements.
(Defined by IEnumerableExtensions.)
Public Extension MethodStringJoin(String, Int32, String)Overloaded.
Creates a delimited string from a sequence of elements. At most maxLength elements will be used and "..." shows that more elements were in the list.
(Defined by IEnumerableExtensions.)
Public Extension MethodSubSequenceByte
Take the items from a sequence starting with item # start (index 0) and contining for count items.
(Defined by IEnumerableExtensions.)
Public Extension MethodToHashSetByteOverloaded.
Creates a HashSet from a sequence. If the sequence is already a HashSet, a new HashSet is still created.
(Defined by IEnumerableExtensions.)
Public Extension MethodToHashSetByte(IEqualityComparerByte)Overloaded.
Creates a HashSet from a sequence. If the sequence is already a HashSet, a new HashSet is still created.
(Defined by IEnumerableExtensions.)
Public Extension MethodToQueueByte
Creates a Queue from a sequence. If the sequence is already a Queue, a new Queue is still created.
(Defined by IEnumerableExtensions.)
Top
See Also

Reference