Exemple #1
0
        /// <summary>
        /// Extracts a splice AI item from the specified VCF line.
        /// </summary>
        /// <param name="vcfLine"></param>
        /// <returns></returns>
        private SpliceAiItem ExtractItem(string vcfLine)
        {
            var splitLine = vcfLine.Split('\t');

            if (splitLine.Length < VcfCommon.InfoIndex + 1)
            {
                return(null);
            }

            var chromosomeName = splitLine[VcfCommon.ChromIndex];

            if (!_sequenceProvider.RefNameToChromosome.ContainsKey(chromosomeName))
            {
                return(null);
            }

            var chromosome = _sequenceProvider.RefNameToChromosome[chromosomeName];
            var position   = int.Parse(splitLine[VcfCommon.PosIndex]);
            var refAllele  = splitLine[VcfCommon.RefIndex];
            var altAllele  = splitLine[VcfCommon.AltIndex];

            if (altAllele.Contains(','))
            {
                throw new DataException($"multiple alt allele present for {chromosome}-{position}");
            }

            var start = position;

            //skipping insertions/deletions that were shifted
            if (VariantUtils.IsLeftShiftPossible(refAllele, altAllele))
            {
                return(null);
            }
            (start, refAllele, altAllele) = BiDirectionalTrimmer.Trim(start, refAllele, altAllele);

            var end = start + refAllele.Length - 1;
            var isSpliceAdjacent = _spliceIntervals[chromosome.Index].OverlapsAny(start, end);

            ParseInfoField(splitLine[VcfCommon.InfoIndex]);

            if (!HasSignificantScore() && !isSpliceAdjacent)
            {
                return(null);
            }

            Count++;
            return(new SpliceAiItem(chromosome, start, refAllele, altAllele, _geneSymbol,
                                    _acceptorGainScore, _acceptorLossScore, _donorGainScore, _donorLossScore,
                                    _acceptorGainPosition, _acceptorLossPosition, _donorGainPosition, _donorLossPosition, isSpliceAdjacent));
        }
 public void CanNotLeftRotate(string refAllele, string altAllele, bool result)
 {
     Assert.Equal(result, VariantUtils.IsLeftShiftPossible(refAllele, altAllele));
 }