Beispiel #1
0
 private VcfReader(StreamReader headerReader, StreamReader vcfLineReader, ISequenceProvider sequenceProvider,
                   IRefMinorProvider refMinorProvider, IVcfFilter vcfFilter, IVariantIdCreator vidCreator)
 {
     _headerReader        = headerReader;
     _reader              = vcfLineReader;
     _variantFactory      = new VariantFactory(sequenceProvider.Sequence, vidCreator);
     _sequenceProvider    = sequenceProvider;
     _refMinorProvider    = refMinorProvider;
     _vcfFilter           = vcfFilter;
     _refNameToChromosome = sequenceProvider.RefNameToChromosome;
 }
Beispiel #2
0
 private VcfReader(StreamReader headerReader, StreamReader vcfLineReader, ISequenceProvider sequenceProvider,
                   IRefMinorProvider refMinorProvider, IVcfFilter vcfFilter, IVariantIdCreator vidCreator, IMitoHeteroplasmyProvider mitoHeteroplasmyProvider, bool enableDq = false)
 {
     _headerReader             = headerReader;
     _reader                   = vcfLineReader;
     _variantFactory           = new VariantFactory(sequenceProvider.Sequence, vidCreator);
     _sequenceProvider         = sequenceProvider;
     _refMinorProvider         = refMinorProvider;
     _vcfFilter                = vcfFilter;
     _refNameToChromosome      = sequenceProvider.RefNameToChromosome;
     _mitoHeteroplasmyProvider = mitoHeteroplasmyProvider;
     EnableDq                  = enableDq;
 }
Beispiel #3
0
        public static IVariant[] Create(IVariantIdCreator vidCreator, ISequence sequence, IChromosome chromosome, int start, int end,
                                        string refAllele, string altAllele, string globalMajorAllele)
        {
            bool isRefMinor = end == start && globalMajorAllele != null;

            if (!isRefMinor)
            {
                return(null);
            }

            string vid = vidCreator.Create(sequence, VariantCategory.SmallVariant, null, chromosome, start, end, refAllele, altAllele, null);

            return(new[]
            {
                SmallVariantCreator.Create(chromosome, start, end, globalMajorAllele, refAllele, false, false, null, vid, true)
            });
        }
Beispiel #4
0
        public static VcfReader Create(StreamReader headerReader, StreamReader vcfLineReader, ISequenceProvider sequenceProvider,
                                       IRefMinorProvider refMinorProvider, IRecomposer recomposer, IVcfFilter vcfFilter, IVariantIdCreator vidCreator, IMitoHeteroplasmyProvider mitoHeteroplasmyProvider, bool enableDq = false)
        {
            var vcfReader = new VcfReader(headerReader, vcfLineReader, sequenceProvider, refMinorProvider, vcfFilter, vidCreator, mitoHeteroplasmyProvider, enableDq);

            vcfReader.ParseHeader();
            vcfReader.SetRecomposer(recomposer);
            return(vcfReader);
        }
Beispiel #5
0
 public VariantFactory(ISequence sequence, IVariantIdCreator vidCreator)
 {
     _sequence   = sequence;
     _vidCreator = vidCreator;
 }
Beispiel #6
0
 public VariantGenerator(ISequenceProvider sequenceProvider, IVariantIdCreator vidCreator)
 {
     _sequenceProvider = sequenceProvider;
     _vidCreator       = vidCreator;
 }
Beispiel #7
0
                         decomposedVids) GetPositionsAndRefAltAlleles(AlleleBlock alleleBlock, AlleleSet alleleSet,
                                                                      string totalRefSequence, int regionStart, List <ISimplePosition> simplePositions, ISequence sequence, IVariantIdCreator vidCreator)
        {
            int numPositions       = alleleBlock.AlleleIndexes.Length;
            int firstPositionIndex = alleleBlock.PositionIndex;
            int lastPositionIndex  = alleleBlock.PositionIndex + numPositions - 1;

            int    blockStart     = alleleSet.Starts[firstPositionIndex];
            int    blockEnd       = alleleSet.Starts[lastPositionIndex];
            string lastRefAllele  = alleleSet.VariantArrays[lastPositionIndex][0];
            int    blockRefLength = blockEnd - blockStart + lastRefAllele.Length;
            string refSequence    = totalRefSequence.Substring(blockStart - regionStart, blockRefLength);

            var refSequenceStart               = 0;
            var altSequenceSegments            = new LinkedList <string>();
            var variantPosIndexesInAlleleBlock = new List <int>();
            var vidListsNeedUpdate             = new List <List <string> >();
            var decomposedVids = new List <string>();

            if (FindConflictAllele(alleleBlock, alleleSet))
            {
                return(default);
Beispiel #8
0
        public static VcfReader Create(StreamReader headerReader, StreamReader vcfLineReader, ISequenceProvider sequenceProvider,
                                       IRefMinorProvider refMinorProvider, IRecomposer recomposer, IVcfFilter vcfFilter, IVariantIdCreator vidCreator)
        {
            var vcfReader = new VcfReader(headerReader, vcfLineReader, sequenceProvider, refMinorProvider, vcfFilter, vidCreator);

            vcfReader.ParseHeader();
            vcfReader.SetRecomposer(recomposer);
            return(vcfReader);
        }