public void FillAlignedSequencesTest2() { // AACGCTAG // ATCCTAGG var sequence1 = new Sequence { Nucleotide.A, Nucleotide.A, Nucleotide.C, Nucleotide.G, Nucleotide.C, Nucleotide.T, Nucleotide.A, Nucleotide.G }; var sequence2 = new Sequence { Nucleotide.A, Nucleotide.T, Nucleotide.C, Nucleotide.C, Nucleotide.T, Nucleotide.A, Nucleotide.G, Nucleotide.G }; var pairAlignment = new PairAlignment(sequence1, sequence2); var algorithm = new PairAlignmentAlgorithm(new OperationDistanceEstimator(4, 2, 0, 1)); algorithm.FillAlignedSequences(pairAlignment); }
/// <summary> /// The distance. /// </summary> /// <param name="pair">The pair sequence.</param> /// <returns>The <see cref="int"/>.</returns> public override double Distance(PairAlignment pair) { return pair.DynamicTable[new Index(pair.First.Count, pair.Second.Count)].Distance; }
/// <summary> /// The dynamic table fill. /// </summary> /// <param name="sequences">The group alignment.</param> /// <returns>The dynamic table.</returns> public Dictionary<Index, PairAlignment> GeneratePairAlignmentsMap(IEnumerable<Sequence> sequences) { var map = new Dictionary<Index, PairAlignment>(); var list = sequences.ToList(); foreach (var sequence in list) { // except the diagonal elements and filled cells (the table is been filling for symmetrical elements in one step) foreach (var sequence2 in list.Where(a => a.Id != sequence.Id && !map.ContainsKey(new Index(sequence.Id.Value, a.Id.Value)))) { var p = new PairAlignment(sequence, sequence2); this.PairAlignmentAlgorithm.FillAlignedSequences(p); map[new Index(sequence.Id.Value, sequence2.Id.Value)] = p; map[new Index(sequence2.Id.Value, sequence.Id.Value)] = p; } } return map; }
/// <summary> /// Gets distance estimate for 2 sequences /// </summary> /// <param name="pair">The sequence pair.</param> /// <returns>Distance estimate</returns> public abstract double Distance(PairAlignment pair);