Exemple #1
0
        private static ExitCodes ProgramExecution()
        {
            var omimSchema = OmimSchema.Get();

            var    omimParser  = new OmimParser(_mimToGeneFile, _omimJsonFile, omimSchema);
            var    version     = omimParser.GetVersion();
            string outFileName = $"{version.Name}_{version.Version}";

            using (var nsaStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.GeneFileSuffix)))
                using (var ngaWriter = new NgaWriter(nsaStream, version, SaCommon.OmimTag, SaCommon.SchemaVersion, true))
                    using (var saJsonSchemaStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.GeneFileSuffix + SaCommon.JsonSchemaSuffix)))
                        using (var schemaWriter = new StreamWriter(saJsonSchemaStream))
                        {
                            var omimItems   = omimParser.GetItems();
                            var geneToItems = OmimUtilities.GetGeneToOmimEntriesAndSchema(omimItems);
                            ngaWriter.Write(geneToItems);
                            schemaWriter.Write(omimSchema);
                        }

            return(ExitCodes.Success);
        }
Exemple #2
0
        private static ExitCodes ProgramExecution()
        {
            _apiKey = GetEnvironmentVariable(OmimApiKeyEnvironmentVariableName);
            if (_apiKey == null)
            {
                throw new InvalidDataException("Please set the OMIM API key as the environment variable \"OmimApiKey\".");
            }

            var    version      = OmimVersion.GetVersion();
            string outFileName  = $"{version.Name}_{version.Version}";
            string dumpFilePath = Path.Combine(_outputDirectory, OmimDumpFileBaseName + version.Version + OmimDumpFileSuffix);

            var(entrezGeneIdToSymbol, ensemblGeneIdToSymbol) = OmimUtilities.ParseUniversalGeneArchive(_inputReferencePath, _universalGeneArchivePath);
            var geneSymbolUpdater = new GeneSymbolUpdater(entrezGeneIdToSymbol, ensemblGeneIdToSymbol);

            var omimSchema = OmimSchema.Get();

            using (var omimParser = new OmimParser(geneSymbolUpdater, omimSchema, _apiKey, dumpFilePath))
                using (var nsaStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.NgaFileSuffix)))
                    using (var ngaWriter = new NgaWriter(nsaStream, version, SaCommon.OmimTag, SaCommon.SchemaVersion, true))
                        using (var saJsonSchemaStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.NgaFileSuffix + SaCommon.JsonSchemaSuffix)))
                            using (var schemaWriter = new StreamWriter(saJsonSchemaStream))
                            {
                                var omimItems   = omimParser.GetItems();
                                var geneToItems = OmimUtilities.GetGeneToOmimEntriesAndSchema(omimItems);
                                ngaWriter.Write(geneToItems);
                                schemaWriter.Write(omimSchema);
                            }

            geneSymbolUpdater.DisplayStatistics();
            using (var writer = new StreamWriter(FileUtilities.GetCreateStream("UpdatedGeneSymbols.txt")))
            {
                geneSymbolUpdater.WriteUpdatedGeneSymbols(writer);
            }

            return(ExitCodes.Success);
        }