using System; using System.Collections.Generic; using System.Text; namespace UniqueMatches { class Program { static void Main(string[] args) { Dictionary existing_seqs = new Dictionary(); existing_seqs["A"] = "ACTGTGTGCTGGTCGTGACGAC"; existing_seqs["Gene1 transcr1"] = "ACTGTGTGGATCGATCGATGGCCACAAATCA"; existing_seqs["Gene2 transcr1"] = "AGGTCTGTGCCTGGGAAGCGCGTCGATCGATGCA"; existing_seqs["Gene2 transcr2"] = "GCGCAGGTCTGTGCGCGGCCTGGGAATCGATCGATGCA"; existing_seqs["Gene2 transcr2"] = "GCGCGGAACGTCGCGTCCCCGATCGATGCA"; string target = "ACTGTGTGCTGGTCGTGACGACATGATCA"; // splice variant to detect bool found_a_probe = false; for (int L = 1; L < target.Length && !found_a_probe; L++) { for (int position = 0; position < target.Length - L && !found_a_probe; position++) { string subseq = target.Substring(position, L); // potential probe Console.WriteLine("Will test potential probe " + subseq); bool reject_seq = false; foreach (KeyValuePair current_pair in existing_seqs) { string existing_gene = current_pair.Key; string matching_against_seq = current_pair.Value; int matches_at_position = matching_against_seq.IndexOf(subseq); if (matches_at_position >= 0) { reject_seq = true; Console.WriteLine("Rejected seq " + subseq + " because of " + matching_against_seq); break; } } if (!reject_seq) { Console.WriteLine("Subsequence " + subseq + " is a possible probe"); found_a_probe = true; } } if (!found_a_probe) { Console.WriteLine("Could not find any subsequence that did not occur in any of the existing sequences"); } } Console.ReadLine(); } } }