Click or drag to resize
SparseSequence Class
SparseSequence can hold discontinuous sequence. Use this class for storing the sequence items with their known position from a long continuous sequence. This class uses SortedDictionary to store the sequence items with their position. Position is zero based indexes at which a sequence items are present in the original continues sequence. For example: To store sequence items at position 10, 101, 200, 1501 this class can be used as shown in the below code. // Create a SparseSequence by specifying the Alphabet. SparseSequence mySparseSequence= new SparseSequence(Alphabets.DNA); // By default count will be set to zero. To insert a sequence item at a position greater than zero, // Count has to be set to a value greater than the maximum position value. // If try to insert a sequence item at a position greater than the count an exception will occur. // You can limit the SparseSequence length by setting the count to desired value. In this example it will be 1502 as the maximum index is 1501. mySparseSequence.Count = 1502; // To access the value in a SparseSequence use Indexer or an Enumerator like below. // Accessing SparsesSequence using Indexer. byte seqItem1 = mySparseSequence [10] ; // this will return sequence item A. byte seqItem2 = mySparseSequence [1501] ; // this will return sequence item G. byte seqItem3 = mySparseSequence [102] ; // this will return null as there is no sequence item at this position. // Accessing SparsesSequence using Enumerator. foreach(byte seqItem in mySparseSequence) {…}
Inheritance Hierarchy
SystemObject
  BioSparseSequence

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

The SparseSequence type exposes the following members.

Constructors
  NameDescription
Public methodSparseSequence(IAlphabet)
Creates a SparseSequence with no sequence data. Count property of SparseSequence instance created by using this constructor will be set to zero. For working with sequences that never have sequence data, but are only used for metadata storage (like keeping an ID or various features but no direct sequence data) consider using the VirtualSequence class instead.
Public methodSparseSequence(ISequence)
Creates a sparse sequence based on the new passed sequence.
Public methodSparseSequence(IAlphabet, Int32)
Creates a SparseSequence with no sequence data. Count property of SparseSequence instance created by using this constructor will be set a value specified by size parameter. For working with sequences that never have sequence data, but are only used for metadata storage (like keeping an ID or various features but no direct sequence data) consider using the VirtualSequence class instead.
Public methodSparseSequence(IAlphabet, Int32, Byte)
Creates a sparse sequence based on the specified parameters. The item parameter must contain an alphabet as specified in the alphabet parameter, else an exception will occur. The index parameter value must be a non negative value. Count property of an instance created by this constructor will be set to value of index + 1.
Public methodSparseSequence(IAlphabet, Int32, IEnumerableByte)
Creates a sparse sequence based on the specified parameters. The sequenceItems parameter must contain sequence items known by the specified alphabet, else an exception will occur. The index parameter value must be a non negative.
Top
Properties
  NameDescription
Public propertyAlphabet
The alphabet to which string representations of the sequence should conform.
Public propertyCount
The number of sequence items contained in the Sequence.
Public propertyID
An identification provided to distinguish the sequence to others being worked with.
Public propertyItem
Allows the sequence to function like an array, gets the sequence item at the specified index. Note that the index value starts its count at 0.
Public propertyMetadata
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;
Public propertyStatistics
Keeps track of the number of occurrences of each symbol within a sequence.
Top
Methods
  NameDescription
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.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetComplementedSequence
Return a 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 methodGetKnownSequenceItems
Returns known sequence items with their position as ReadOnlyCollection of IndexedSequenceItem.
Public methodGetReverseComplementedSequence
Return a sequence representing the reverse complement of this sequence.
Public methodGetReversedSequence
Return a 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 character.
Public methodIndexOfNonGap(Int64)
Returns the position of the first item from startPos that does not have a Gap character.
Public methodLastIndexOfNonGap
Gets the index of last non gap character.
Public methodLastIndexOfNonGap(Int64)
Gets the index of last non gap character within the specified end position.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
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