Example #1
0
        public void BamAlignmentFlag_Setter_Tests()
        {
            var alignment = new BamAlignment();

            //Set Failed QC
            alignment.SetIsFailedQC(true);
            Assert.Equal((uint)512, alignment.AlignmentFlag);
            alignment.SetIsFailedQC(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Mate Unmapped
            alignment.SetIsMateUnmapped(true);
            Assert.Equal((uint)8, alignment.AlignmentFlag);
            alignment.SetIsMateUnmapped(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Mate Reverse Strand
            alignment.SetIsMateReverseStrand(true);
            Assert.Equal((uint)32, alignment.AlignmentFlag);
            alignment.SetIsMateReverseStrand(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Is Paired
            alignment.SetIsPaired(true);
            Assert.Equal((uint)1, alignment.AlignmentFlag);
            alignment.SetIsPaired(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Duplicate
            alignment.SetIsDuplicate(true);
            Assert.Equal((uint)1024, alignment.AlignmentFlag);
            alignment.SetIsDuplicate(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set First Mate
            alignment.SetIsFirstMate(true);
            Assert.Equal((uint)64, alignment.AlignmentFlag);
            alignment.SetIsFirstMate(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Proper Pair
            alignment.SetIsProperPair(true);
            Assert.Equal((uint)2, alignment.AlignmentFlag);
            alignment.SetIsProperPair(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Reverse Strand
            alignment.SetIsReverseStrand(true);
            Assert.Equal((uint)16, alignment.AlignmentFlag);
            alignment.SetIsReverseStrand(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Secondary Alignment
            alignment.SetIsSecondaryAlignment(true);
            Assert.Equal((uint)256, alignment.AlignmentFlag);
            alignment.SetIsSecondaryAlignment(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Second Mate
            alignment.SetIsSecondMate(true);
            Assert.Equal((uint)128, alignment.AlignmentFlag);
            alignment.SetIsSecondMate(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);

            //Set Unmapped
            alignment.SetIsUnmapped(true);
            Assert.Equal((uint)4, alignment.AlignmentFlag);
            alignment.SetIsUnmapped(false);
            Assert.Equal((uint)0, alignment.AlignmentFlag);
        }