public override string ToString() { string result = ""; for (int i = 0; i < (Content.Length - 1); i += 2) { result += DnaChar.BitsToChar(Content[i], Content[i + 1]); } return(result); }
public string ReverseComplement(string pattern) { var sb = new StringBuilder(pattern); for (int i = 0; i < sb.Length; i++) { sb[i] = DnaChar.Flip(sb[i]); } char[] arr = sb.ToString().ToArray(); Array.Reverse(arr); return(new string(arr)); }
internal DnaString GetReverseComplement() { var result = new DnaString(Length); for (int i = 0; i < (Content.Length - 1); i += 2) { bool[] b = DnaChar.Flip(Content[result.Content.Length - i - 2], Content[result.Content.Length - i - 1]); result.Content[i] = b[0]; result.Content[i + 1] = b[1]; } return(result); }
public DnaString(string s) { var bits = new bool[s.Length * 2]; for (int i = 0; i < s.Length; ++i) { char c = s[i]; bool[] b = DnaChar.CharToBits(c); bits[i * 2] = b[0]; bits[i * 2 + 1] = b[1]; } Content = new BitArray(bits); }