Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Bio.Variant.IndelVariant"/> class.
 /// </summary>
 /// <param name="position">Position.</param>
 /// <param name="length">Length.</param>
 /// <param name="bases">Bases.</param>
 /// <param name="insertionOrDeletion">Insertion or deletion.</param>
 /// <param name="hpBase">Hp base.</param>
 /// <param name="hpLengthInReference">Hp length in reference.</param>
 /// <param name="atAlignmentEnd">If set to <c>true</c> at alignment end.</param>
 public IndelVariant(int position, int length, string bases, IndelType insertionOrDeletion, char hpBase, int hpLengthInReference, bool atAlignmentEnd = false)
     : base(position, atAlignmentEnd)
 {
     Type = VariantType.INDEL;
     InsertionOrDeletion = insertionOrDeletion;
     Length = length;
     InsertedOrDeletedBases       = bases;
     HomopolymerBase              = hpBase;
     HomopolymerLengthInReference = hpLengthInReference;
 }
Ejemplo n.º 2
0
        public static void TestLeftAlignmentStep()
        {
            var refseq   = "ACAATAAAAGCGCGCGCGCGTTACGTATAT--ATGGATAT";
            var queryseq = "ACAATAA-AGC--GCGC--GTTACGTATATATATGGATAT";

            var r   = new Sequence(DnaAlphabet.Instance, refseq);
            var q   = new Sequence(DnaAlphabet.Instance, queryseq);
            var aln = new PairwiseSequenceAlignment(r, q);
            var pas = new PairwiseAlignedSequence();

            pas.FirstSequence  = r;
            pas.SecondSequence = q;
            aln.Add(pas);
            var tpl = VariantCaller.LeftAlignIndelsAndCallVariants(aln, true);

            // Check the left alignment
            aln = tpl.Item1 as PairwiseSequenceAlignment;
            var lar         = aln.PairwiseAlignedSequences [0].FirstSequence.ConvertToString();
            var laq         = aln.PairwiseAlignedSequences [0].SecondSequence.ConvertToString();
            var exprefseq   = "ACAATAAAAGCGCGCGCGCGTTACG--TATATATGGATAT";
            var expqueryseq = "ACAAT-AAA----GCGCGCGTTACGTATATATATGGATAT";

            Assert.AreEqual(exprefseq, lar);
            Assert.AreEqual(expqueryseq, laq);

            // And it's hard, so we might as well check the variants
            var variants = tpl.Item2;

            Assert.AreEqual(3, variants.Count);
            string[]    bases   = new string[] { "A", "GCGC", "TA" };
            char[]      hpbases = new char[] { 'A', 'G', 'T' };
            bool[]      inHp    = new bool[] { true, false, false };
            int[]       lengths = new int[] { 1, 4, 2 };
            int[]       starts  = new int[] { 4, 8, 24 };
            IndelType[] types   = new IndelType[] { IndelType.Deletion, IndelType.Deletion, IndelType.Insertion };
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(VariantType.INDEL, variants [i].Type);
                var vi = variants [i] as IndelVariant;
                Assert.AreEqual(hpbases[i], vi.HomopolymerBase);
                Assert.AreEqual(starts [i], vi.StartPosition);
                Assert.AreEqual(lengths [i], vi.Length);
                Assert.AreEqual(bases [i], vi.InsertedOrDeletedBases);
                Assert.AreEqual(inHp [i], vi.InHomopolymer);
                Assert.AreEqual(types [i], vi.InsertionOrDeletion);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Bio.Variant.IndelVariant"/> class.
 /// </summary>
 /// <param name="position">Position.</param>
 /// <param name="length">Length.</param>
 /// <param name="bases">Bases.</param>
 /// <param name="insertionOrDeletion">Insertion or deletion.</param>
 /// <param name="hpBase">Hp base.</param>
 /// <param name="hpLengthInReference">Hp length in reference.</param>
 /// <param name="atAlignmentEnd">If set to <c>true</c> at alignment end.</param>
 public IndelVariant(int position, int length, string bases, IndelType insertionOrDeletion, char hpBase, int hpLengthInReference, bool atAlignmentEnd = false) 
     : base (position, atAlignmentEnd)
 {
     Type = VariantType.INDEL;
     InsertionOrDeletion = insertionOrDeletion;
     Length = length;
     InsertedOrDeletedBases = bases;
     HomopolymerBase = hpBase;
     HomopolymerLengthInReference = hpLengthInReference;
 }
Ejemplo n.º 4
0
        public static void TestLeftAlignmentStep() {
            var refseq =   "ACAATAAAAGCGCGCGCGCGTTACGTATAT--ATGGATAT";
            var queryseq = "ACAATAA-AGC--GCGC--GTTACGTATATATATGGATAT";

            var r = new Sequence (DnaAlphabet.Instance, refseq);
            var q = new Sequence (DnaAlphabet.Instance, queryseq);
            var aln = new PairwiseSequenceAlignment (r, q);
            var pas = new PairwiseAlignedSequence ();
            pas.FirstSequence = r;
            pas.SecondSequence = q;
            aln.Add (pas);
            var tpl = VariantCaller.LeftAlignIndelsAndCallVariants (aln, true);

            // Check the left alignment
            aln = tpl.Item1 as PairwiseSequenceAlignment;
            var lar = aln.PairwiseAlignedSequences [0].FirstSequence.ConvertToString();
            var laq = aln.PairwiseAlignedSequences [0].SecondSequence.ConvertToString();
            var exprefseq =   "ACAATAAAAGCGCGCGCGCGTTACG--TATATATGGATAT";
            var expqueryseq = "ACAAT-AAA----GCGCGCGTTACGTATATATATGGATAT";
            Assert.AreEqual (exprefseq, lar);
            Assert.AreEqual (expqueryseq, laq);

            // And it's hard, so we might as well check the variants
            var variants = tpl.Item2;
            Assert.AreEqual (3, variants.Count);
            string[] bases = new string[] { "A", "GCGC", "TA" };
            char[] hpbases = new char[] { 'A', 'G', 'T' };
            bool[] inHp = new bool[] { true, false, false };
            int[] lengths = new int[] { 1, 4, 2 };
            int[] starts = new int[] { 4, 8, 24 };
            IndelType[] types = new IndelType[] { IndelType.Deletion, IndelType.Deletion, IndelType.Insertion };
            for (int i = 0; i < 3; i++) {
                Assert.AreEqual (VariantType.INDEL, variants [i].Type);
                var vi = variants [i] as IndelVariant;
                Assert.AreEqual (hpbases[i], vi.HomopolymerBase);
                Assert.AreEqual (starts [i], vi.StartPosition);
                Assert.AreEqual (lengths [i], vi.Length);
                Assert.AreEqual (bases [i], vi.InsertedOrDeletedBases);
                Assert.AreEqual (inHp [i], vi.InHomopolymer);
                Assert.AreEqual (types [i], vi.InsertionOrDeletion);

            }
        
        }