Example #1
0
        public void IdentifyConflictingItems()
        {
            var sequence = new SimpleSequence(new string('A', VariantUtils.MaxUpstreamLength) + "TAAGCCAGCCAGCCAGCCAAGCTGGCCAAGCCAGACAGGCAGCCAAGCCAACCAAGACACCCAGGCAGCCAAGCCAGC", 16558315 - VariantUtils.MaxUpstreamLength);

            var refNameToChrom = new Dictionary <string, IChromosome> {
                { "22", Chrom22 }
            };

            var sequenceProvider = new SimpleSequenceProvider(GenomeAssembly.GRCh38, sequence, refNameToChrom);

            var gnomadReader = new GnomadReader(new StreamReader(GetConflictingItemsStream()), sequenceProvider);

            var items = new List <ISupplementaryDataItem>();

            foreach (GnomadItem item in gnomadReader.GetItems())
            {
                //item.Trim();
                if (item.Position == 16558315)
                {
                    items.Add(item);
                }
            }

            items = SuppDataUtilities.RemoveConflictingAlleles(items, false);

            //two if the items were removed as conflicting items
            Assert.Equal(3, items.Count);
        }
Example #2
0
        private static IEnumerable <ISupplementaryDataItem> GetConflictingGnomadItems()
        {
            var sequence         = new SimpleSequence(new string('T', VariantUtils.MaxUpstreamLength) + "AAAGAAAGAAAG", 17467787 - 1 - VariantUtils.MaxUpstreamLength);
            var sequenceProvider = new SimpleSequenceProvider(GenomeAssembly.GRCh38, sequence, ChromosomeUtilities.RefNameToChromosome);

            var gnomadReader = new GnomadReader(new StreamReader(GetChr22_17467787_17467799_genome()), null, sequenceProvider);

            return(gnomadReader.GetCombinedItems());
        }
Example #3
0
        public void GetItems_test()
        {
            var sequence = new SimpleSequence(new string('A', VariantUtils.MaxUpstreamLength) + "TGTGTTGTTATTCTGTGTGCAT", 10114 - VariantUtils.MaxUpstreamLength);

            var refNameToChrom = new Dictionary <string, IChromosome> {
                { "1", Chrom1 }
            };

            var sequenceProvider = new SimpleSequenceProvider(GenomeAssembly.GRCh38, sequence, refNameToChrom);

            var gnomadReader = new GnomadReader(new StreamReader(GetGnomadStream()), sequenceProvider);

            var items = gnomadReader.GetItems().ToList();

            Assert.Equal(2, items.Count);
            Assert.Equal("\"coverage\":218,\"failedFilter\":true,\"allAf\":0,\"allAn\":8734,\"allAc\":0,\"allHc\":0,\"afrAf\":0,\"afrAn\":2168,\"afrAc\":0,\"afrHc\":0,\"amrAf\":0,\"amrAn\":324,\"amrAc\":0,\"amrHc\":0,\"easAf\":0,\"easAn\":438,\"easAc\":0,\"easHc\":0,\"finAf\":0,\"finAn\":1296,\"finAc\":0,\"finHc\":0,\"nfeAf\":0,\"nfeAn\":4054,\"nfeAc\":0,\"nfeHc\":0,\"asjAf\":0,\"asjAn\":100,\"asjAc\":0,\"asjHc\":0,\"othAf\":0,\"othAn\":354,\"othAc\":0,\"othHc\":0", items[0].GetJsonString());
        }
Example #4
0
        public void LeftShiftingItems()
        {
            var sequence = new SimpleSequence(new string('A', VariantUtils.MaxUpstreamLength) + "GCGCGC", 157100394 - 1 - VariantUtils.MaxUpstreamLength);

            var refNameToChrom = new Dictionary <string, IChromosome> {
                { "6", new Chromosome("chr6", "6", 6) }
            };

            var sequenceProvider = new SimpleSequenceProvider(GenomeAssembly.GRCh38, sequence, refNameToChrom);

            var gnomadReader = new GnomadReader(new StreamReader(GetShiftingItemsStream()), sequenceProvider);

            var items = gnomadReader.GetItems().ToList();

            Assert.Equal(3, items.Count);
            Assert.Equal(157100397, items[0].Position);
            Assert.Equal(157100397, items[1].Position);
            Assert.Equal(157100397, items[2].Position);
        }
Example #5
0
        public void CreateTsvs()
        {
            var benchMark = new Benchmark();

            using (var writer = new GnomadTsvWriter(_version, _outputDirectory, _refProvider.GenomeAssembly, _refProvider, _sequencingDataType))
            {
                var count = 0;

                foreach (var fileStreamReader in _streamReaders)
                {
                    var reader = new GnomadReader(fileStreamReader, _refProvider.RefNameToChromosome);
                    TsvWriterUtilities.WriteSortedItems(reader.GetGnomadItems(), writer);
                    Console.WriteLine($"ingested {count++} file in " + benchMark.GetElapsedTime());
                }
            }

            var timeSpan = Benchmark.ToHumanReadable(benchMark.GetElapsedTime());

            TsvWriterUtilities.WriteCompleteInfo("gnomAD", _version.Version, timeSpan);
        }