/// <summary> /// Creates a new BasicSequenceInfo that is a copy of the current BasicSequenceInfo. /// </summary> /// <returns>A new BasicSequenceInfo that is a copy of this BasicSequenceInfo.</returns> public BasicSequenceInfo Clone() { BasicSequenceInfo cloneObject = new BasicSequenceInfo(); cloneObject.id = id; cloneObject.displayID = displayID; cloneObject._moleculeType = _moleculeType; cloneObject.alphabet = alphabet; foreach (KeyValuePair <string, object> metadataKeyValue in metadata) { object value = metadataKeyValue.Value; // If the object in the medata is ICloneable then get the clone copy. ICloneable cloneValue = value as ICloneable; if (cloneValue != null) { value = cloneValue.Clone(); } cloneObject.metadata.Add(metadataKeyValue.Key, value); } return(cloneObject); }
/// <summary> /// Creates a VirtualSequence instance. /// </summary> /// <param name="alphabet"> /// The alphabet the sequence uses (eg. Alphabets.DNA or Alphabets.RNA or Alphabets.Protein) /// </param> public VirtualSequence(IAlphabet alphabet) { if (alphabet == null) { throw new ArgumentNullException(Properties.Resource.ParameterNameAlphabet); } _seqInfo = new BasicSequenceInfo(); Alphabet = alphabet; }
/// <summary> /// Constructor for deserialization. /// </summary> /// <param name="info">Serialization Info.</param> /// <param name="context">Streaming context.</param> protected VirtualSequence(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } _seqInfo = (BasicSequenceInfo)info.GetValue("VirtualSequence:seqInfo", typeof(BasicSequenceInfo)); Documentation = info.GetValue("VirtualSequence:Documentation", typeof(object)); MoleculeType = (MoleculeType)info.GetValue("VirtualSequence:MoleculeType", typeof(MoleculeType)); }
/// <summary> /// Gets the index of last non gap character within the specified end position. /// </summary> /// <param name="endPos">Index value below which to search for non-Gap character.</param> /// <returns>If found returns an zero based index of the last non gap character, otherwise returns -1.</returns> public int LastIndexOfNonGap(int endPos) { return(BasicSequenceInfo.LastIndexOfNonGap(this, endPos)); }
/// <summary> /// Returns the position of the first item from startPos that does not /// have a Gap character. /// </summary> /// <param name="startPos">Index value above which to search for non-Gap character.</param> /// <returns>If found returns an zero based index of the first non gap character, otherwise returns -1.</returns> public int IndexOfNonGap(int startPos) { return(BasicSequenceInfo.IndexOfNonGap(this, startPos)); }