예제 #1
0
        public static int?AnyIndelCoveredInMate(IEnumerable <IndelSite> readIndelPositions,
                                                BamAlignment readWithoutIndels, BamAlignment readWithIndels, int anchorSize = 0)
        {
            if (readIndelPositions == null || !readIndelPositions.Any())
            {
                return(null);
            }

            if (readWithIndels.IsReverseStrand())
            {
                readIndelPositions = readIndelPositions.Reverse();
            }

            foreach (var indelPosition in readIndelPositions)
            {
                var coveredInR1 =
                    readWithoutIndels.ContainsPosition(indelPosition.PreviousMappedPosition - anchorSize, readWithIndels.RefID) &&
                    readWithoutIndels.ContainsPosition(indelPosition.NextMappedPosition + anchorSize, readWithIndels.RefID);
                if (coveredInR1)
                {
                    return(indelPosition.PreviousMappedPosition);
                }
            }

            return(null);
        }
예제 #2
0
        private bool AnchoredRegionContainsUnanchoredEnds(BamAlignment read1, BamAlignment read2)
        {
            var read1UnanchoredStart = read1.Position - (read1.CigarData.GetPrefixClip());
            var read1UnanchoredEnd   = read1.GetLastBasePosition() + (read1.CigarData.GetSuffixClip());

            return(read2.ContainsPosition(read1UnanchoredStart, read1.RefID) ||
                   read2.ContainsPosition(read1UnanchoredEnd, read1.RefID));
        }