示例#1
0
        private static ExitCodes ProgramExecution()
        {
            if (_createIndex)
            {
                using (var indexCreator = new IndexCreator(_inputJson))
                {
                    indexCreator.CreateIndex();
                }

                return(ExitCodes.Success);
            }

            string indexFileName = _inputJson + JasixCommons.FileExt;

            ValidateIndexFile(indexFileName);
            var writer = string.IsNullOrEmpty(_outputFile)
                ? null : GZipUtilities.GetStreamWriter(_outputFile);

            using (var queryProcessor = new QueryProcessor(GZipUtilities.GetAppropriateStreamReader(_inputJson),
                                                           FileUtilities.GetReadStream(indexFileName), writer))
            {
                if (_list)
                {
                    queryProcessor.ListChromosomesAndSections();
                    return(ExitCodes.Success);
                }

                if (_printHeaderOnly)
                {
                    queryProcessor.PrintHeaderOnly();
                    return(ExitCodes.Success);
                }

                if (!string.IsNullOrEmpty(_section))
                {
                    queryProcessor.PrintSection(_section);
                    return(ExitCodes.Success);
                }

                if (Queries == null)
                {
                    Console.WriteLine("Please specify query region(s)");
                    return(ExitCodes.BadArguments);
                }

                queryProcessor.ProcessQuery(Queries, _printHeader);
            }
            return(ExitCodes.Success);
        }
示例#2
0
        private static ExitCodes ProgramExecution()
        {
            if (ConfigurationSettings.CreateIndex)
            {
                using (var indexCreator = new IndexCreator(ConfigurationSettings.InputJson))
                {
                    indexCreator.CreateIndex();
                }

                return(ExitCodes.Success);
            }

            var indexFileName = ConfigurationSettings.InputJson + JasixCommons.FileExt;

            ValidateIndexFile(indexFileName);
            var writer = string.IsNullOrEmpty(ConfigurationSettings.OutputFile)
                ? null : GZipUtilities.GetStreamWriter(ConfigurationSettings.OutputFile);

            using (var queryProcessor = new QueryProcessor(GZipUtilities.GetAppropriateStreamReader(ConfigurationSettings.InputJson),
                                                           FileUtilities.GetReadStream(indexFileName), writer))
            {
                if (ConfigurationSettings.ListChromosomeName)
                {
                    queryProcessor.PrintChromosomeList();
                    return(ExitCodes.Success);
                }

                if (ConfigurationSettings.PrintHeaderOnly)
                {
                    queryProcessor.PrintHeader();
                    return(ExitCodes.Success);
                }

                if (ConfigurationSettings.Queries == null)
                {
                    Console.WriteLine("Plese specify query region");
                    return(ExitCodes.BadArguments);
                }

                queryProcessor.ProcessQuery(ConfigurationSettings.Queries, ConfigurationSettings.PrintHeader);
            }
            return(ExitCodes.Success);
        }