Пример #1
0
        private static ExitCodes ProgramExecution()
        {
            var(entrezGeneIdToSymbol, ensemblGeneIdToSymbol) = GeneUtilities.ParseUniversalGeneArchive(null, _universalGeneArchivePath);

            string outputPrefix      = GetOutputPrefix(_inputFile);
            string ngaFilePath       = Path.Combine(_outputDirectory, outputPrefix + SaCommon.NgaFileSuffix);
            string ngaSchemaFilePath = ngaFilePath + SaCommon.JsonSchemaSuffix;

            using (var parser = GeneAnnotationsParser.Create(GZipUtilities.GetAppropriateStreamReader(_inputFile), entrezGeneIdToSymbol, ensemblGeneIdToSymbol))
                using (var ngaStream = FileUtilities.GetCreateStream(ngaFilePath))
                    using (var ngaWriter = CaUtilities.GetNgaWriter(ngaStream, parser, CaUtilities.GetInputFileName(_inputFile)))
                        using (var saJsonSchemaStream = FileUtilities.GetCreateStream(ngaSchemaFilePath))
                            using (var schemaWriter = new StreamWriter(saJsonSchemaStream))
                            {
                                ngaWriter.Write(parser.GetItems());
                                schemaWriter.Write(parser.JsonSchema);
                            }

            return(ExitCodes.Success);
        }
Пример #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(entrezGeneIdToSymbol, ensemblGeneIdToSymbol) = GeneUtilities.ParseUniversalGeneArchive(_inputReferencePath, _universalGeneArchivePath);
            var geneSymbolUpdater = new GeneSymbolUpdater(entrezGeneIdToSymbol, ensemblGeneIdToSymbol);

            using (var omimQuery = new OmimQuery(_apiKey, _outputDirectory))
            {
                omimQuery.GenerateMimToGeneSymbolFile(geneSymbolUpdater);
                omimQuery.GenerateJsonResponse();
            }
            OmimVersion.WriteToFile(OmimQuery.JsonResponseFile, _outputDirectory);

            geneSymbolUpdater.DisplayStatistics();
            return(ExitCodes.Success);
        }
Пример #3
0
        private static ExitCodes ProgramExecution()
        {
            var(entrezGeneIdToSymbol, ensemblGeneIdToSymbol) = GeneUtilities.ParseUniversalGeneArchive(null, _universalGeneArchivePath);

            string outputPrefix      = GetOutputPrefix(_inputFile);
            string ngaFilePath       = Path.Combine(_outputDirectory, outputPrefix + SaCommon.GeneFileSuffix);
            string ngaSchemaFilePath = ngaFilePath + SaCommon.JsonSchemaSuffix;

            using (var parser = GeneAnnotationsParser.Create(GZipUtilities.GetAppropriateStreamReader(_inputFile), entrezGeneIdToSymbol, ensemblGeneIdToSymbol))
                using (var ngaStream = FileUtilities.GetCreateStream(ngaFilePath))
                    using (var ngaWriter = CaUtilities.GetNgaWriter(ngaStream, parser, CaUtilities.GetInputFileName(_inputFile)))
                        using (var saJsonSchemaStream = FileUtilities.GetCreateStream(ngaSchemaFilePath))
                            using (var schemaWriter = new StreamWriter(saJsonSchemaStream))
                            {
                                ngaWriter.Write(parser.GetItems());
                                if (parser.GetUnknownGenes().Count > 0)
                                {
                                    throw new UserErrorException($"The following gene IDs were not recognized in Nirvana: {string.Join(',',parser.GetUnknownGenes())}.");
                                }
                                schemaWriter.Write(parser.JsonSchema);
                            }

            return(ExitCodes.Success);
        }
Пример #4
0
 private static GeneAnnotationsParser GetGeneAnnotationsParserFromCustomTsvStream(PersistentStream customTsvStream)
 {
     var(entrezGeneIdToSymbol, ensemblGeneIdToSymbol) = GeneUtilities.ParseUniversalGeneArchive(null, LambdaUrlHelper.GetUgaUrl());
     return(GeneAnnotationsParser.Create(new StreamReader(GZipUtilities.GetAppropriateStream(customTsvStream)), entrezGeneIdToSymbol, ensemblGeneIdToSymbol));
 }