Example #1
0
        private static IEnumerable <ISupplementaryDataItem> GetItems(IEnumerable <string> filePaths,
                                                                     ISequenceProvider referenceProvider)
        {
            IEnumerable <ISupplementaryDataItem> items = null;

            foreach (string filePath in filePaths)
            {
                var fileStreamReader = GZipUtilities.GetAppropriateStreamReader(filePath);
                var reader           = new GnomadReader(fileStreamReader, referenceProvider);
                items = items == null?reader.GetItems() : items.Concat(reader.GetItems());
            }

            return(items);
        }
Example #2
0
        private static void CreateNsa(string[] exomeFiles, string genomeFile, DataSourceVersion version)
        {
            Console.WriteLine($"Processing file: {genomeFile}");
            var outName = Path.GetFileNameWithoutExtension(genomeFile);

            using (var exomeReader = GetExomeReader(exomeFiles, genomeFile))
                using (var referenceProvider = new ReferenceSequenceProvider(FileUtilities.GetReadStream(_compressedReference)))
                    using (var nsaStream = FileUtilities.GetCreateStream(Path.Combine(_tempDirectory, outName + SaCommon.SaFileSuffix)))
                        using (var indexStream = FileUtilities.GetCreateStream(Path.Combine(_tempDirectory, outName + SaCommon.SaFileSuffix + SaCommon.IndexSufix)))
                            using (var nsaWriter = new NsaWriter(nsaStream, indexStream, version, referenceProvider, SaCommon.GnomadTag, true, false, SaCommon.SchemaVersion, false))
                                using (var reader = GZipUtilities.GetAppropriateStreamReader(genomeFile))
                                {
                                    var gnomadReader = new GnomadReader(reader, exomeReader, referenceProvider);
                                    var count        = nsaWriter.Write(gnomadReader.GetCombinedItems());
                                    Console.WriteLine($"Wrote {count} items to NSA file.");
                                }
        }