Example #1
0
        private List <MitoMapSvItem> ExtractSvItemFromDeletionsSingle(List <string> info)
        {
            var junctions = info[0].OptimizedSplit(':').Select(int.Parse).ToList();
            var start     = junctions[0] + 1;
            var end       = junctions[1] - 1;

            if (end < start)
            {
                throw new ArgumentOutOfRangeException($"Deletions with end position smaller than start position: start: {start}, end: {end}");
            }
            var calculatedSize = end - start + 1;
            var size           = int.Parse(info[1].Substring(1));

            if (size <= MitomapParsingParameters.LargeDeletionCutoff)
            {
                return(new List <MitoMapSvItem>());
            }
            if (calculatedSize != size)
            {
                Console.WriteLine($"Incorrect size of deleted region: size of {start}-{end} should be {calculatedSize}, provided size is {size}. Provided size is used.");
            }
            var refSequence = _sequenceProvider.Sequence.Substring(start - 1, size);
            var newStart    = _variantAligner.LeftAlign(start, refSequence, "").Item1;

            if (start != newStart)
            {
                Console.WriteLine($"Deletion of {size} bps. Original start start position: {start}; new position after left-alignment {newStart}.");
            }
            var mitoMapSvItem = new MitoMapSvItem(_chromosome, newStart, newStart + size - 1, VariantType.deletion);

            return(new List <MitoMapSvItem> {
                mitoMapSvItem
            });
        }
Example #2
0
        // extract large insertions from this file
        private List <MitoMapSvItem> ExtractSvItemFromSimpleInsertions(IReadOnlyList <string> info)
        {
            var mitoMapSvItems = new List <MitoMapSvItem>();
            var altAlleleInfo  = info[2];
            var dLoopPattern   = new Regex(@"(?<start>^\d+)-(?<end>(\d+)) D-Loop region");
            var dLoopMatch     = dLoopPattern.Match(altAlleleInfo);

            // not a large insertion
            if (!dLoopMatch.Success)
            {
                return(mitoMapSvItems);
            }
            var genomeStart = MitoDLoop.Start + int.Parse(dLoopMatch.Groups["start"].Value) - 1;
            var genomeEnd   = MitoDLoop.Start + int.Parse(dLoopMatch.Groups["end"].Value) - 1;

            if (genomeEnd < genomeStart)
            {
                throw new ArgumentOutOfRangeException($"Duplication with end position smaller than start position: start: {genomeStart}, end: {genomeEnd}");
            }
            var size             = genomeEnd - genomeStart + 1;
            var refSequence      = _sequenceProvider.Sequence.Substring(genomeStart - 1, size);
            var leftAlignResults = _variantAligner.LeftAlign(genomeStart, refSequence, refSequence + refSequence); // duplication
            var newStart         = leftAlignResults.Item1;

            if (genomeStart != newStart)
            {
                Console.WriteLine($"Duplication of {size} bps. Original start start position: {genomeStart}; new position after left-alignment {newStart}.");
            }
            var mitoMapSvItem = new MitoMapSvItem(_chromosome, newStart, newStart + size - 1, VariantType.duplication);

            mitoMapSvItems.Add(mitoMapSvItem);
            return(mitoMapSvItems);
        }