コード例 #1
0
        public static int Main(string[] args)
        {
            if (args.Length % 2 != 0)
            {
                DisplayUsage("odd number of arguments");
                return(1);
            }

            string RegexFile    = "";
            string PssmFile     = "";
            string DatabaseFile = "";
            string VariantsFile = "";
            string OutputDir    = ".";
            bool   grouping     = false;

            for (int i = 0; i < args.Length; i += 2)
            {
                if (args[i][0] != '-' || args[i].Length != 2)
                {
                    DisplayUsage("incorrect argument specifier");
                    return(1);
                }
                switch (args[i][1])
                {
                case 'o': OutputDir = args[i + 1]; break;

                case 'd': DatabaseFile = args[i + 1]; break;

                case 'r': RegexFile = args[i + 1]; break;

                case 'p': PssmFile = args[i + 1]; break;

                case 'v': VariantsFile = args[i + 1]; break;

                case 'g': grouping = args[i + 1][0] != '0'; break;

                default: DisplayUsage("specifier '" + args[i] + "'not known"); return(1);
                }
            }
            if (DatabaseFile.Length == 0 || RegexFile.Length == 0)
            {
                DisplayUsage("missing mandatory parameters");
                return(1);
            }
            if (!DatabaseFile.Contains(".fasta") && !DatabaseFile.Contains(".xml.gz"))
            {
                DisplayUsage("database file format not recognized");
                return(1);
            }
            if (!DatabaseFile.Contains(".xml.gz") && VariantsFile.Length != 0)
            {
                DisplayUsage("variants are only supported with UniProt XML input file");
                return(1);
            }

            // Use '.' as decimal separator
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);

            WregexConsole app = new WregexConsole();

            app.Create(RegexFile, PssmFile, DatabaseFile, VariantsFile, OutputDir, grouping);
            //app.Dump();
            app.Run();

            return(0);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: akrogp/EhuBio
        public static int Main( string[] args )
        {
            if( args.Length % 2 != 0 ) {
            DisplayUsage( "odd number of arguments" );
            return 1;
            }

            string RegexFile="";
            string PssmFile="";
            string DatabaseFile="";
            string VariantsFile="";
            string OutputDir=".";
            bool grouping = false;
            for( int i = 0; i < args.Length; i += 2 ) {
            if( args[i][0] != '-' || args[i].Length != 2 ) {
                DisplayUsage( "incorrect argument specifier" );
                return 1;
            }
            switch( args[i][1] ) {
                case 'o': OutputDir = args[i+1]; break;
                case 'd': DatabaseFile = args[i+1]; break;
                case 'r': RegexFile = args[i+1]; break;
                case 'p': PssmFile = args[i+1]; break;
                case 'v': VariantsFile = args[i+1]; break;
                case 'g': grouping = args[i+1][0] != '0'; break;
                default: DisplayUsage( "specifier '" + args[i] + "'not known" ); return 1;
            }
            }
            if( DatabaseFile.Length == 0 || RegexFile.Length == 0 ) {
            DisplayUsage( "missing mandatory parameters" );
            return 1;
            }
            if( !DatabaseFile.Contains(".fasta") && !DatabaseFile.Contains(".xml.gz") ) {
            DisplayUsage( "database file format not recognized" );
            return 1;
            }
            if( !DatabaseFile.Contains(".xml.gz") && VariantsFile.Length != 0 ) {
            DisplayUsage( "variants are only supported with UniProt XML input file" );
            return 1;
            }

            // Use '.' as decimal separator
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo( "en-US", false );

            WregexConsole app = new WregexConsole();
            app.Create( RegexFile, PssmFile, DatabaseFile, VariantsFile, OutputDir, grouping );
            //app.Dump();
            app.Run();

            return 0;
        }