Пример #1
0
 static string GetAxesOptionsString(string symmetry)
 {
     string[] units = SymmetryBuilderFactory.GetSymmetryUnitIds(symmetry);
     if (units.Length == 1)
     {
         return(units[0]);
     }
     return(units.Aggregate((a, b) => a + ", " + b));
 }
Пример #2
0
        public override bool ParseArgs(string[] args)
        {
            if (args.FirstOrDefault() != InstanceBaseFlag)
            {
                return(false);
            }

            if (!base.ParseArgs(args))
            {
                return(false);
            }

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i] == "-arch")
                {
                    Architecture = args[i + 1];
                    if (!SymmetryBuilderFactory.GetKnownSymmetryNames().Contains(Architecture))
                    {
                        Console.WriteLine("Unknown '-arch' value - allowed values are:");
                        Console.Write(SymmetryBuilderFactory.GetKnownSymmetryNames().Aggregate("", (a, b) => a + "\n\t" + b));
                        Console.WriteLine();
                        return(false);
                    }
                    i++;
                    continue;
                }

                if (args[i] == "-regex_oligomer1")
                {
                    OligomerRegex1 = args[i + 1];
                    i++;
                    continue;
                }

                if (args[i] == "-regex_oligomer2")
                {
                    OligomerRegex2 = args[i + 1];
                    i++;
                    continue;
                }
                if (args[i] == "-axis1")
                {
                    UnitId1 = args[i + 1];
                    i++;
                    continue;
                }
                if (args[i] == "-axis2")
                {
                    UnitId2 = args[i + 1];
                    i++;
                    continue;
                }
            }

            if (Architecture == null || !SymmetryBuilderFactory.GetKnownSymmetryNames().Contains(Architecture))
            {
                Console.WriteLine("Mandatory '-arch' flag missing or invalid - allowed values are:");
                Console.Write(SymmetryBuilderFactory.GetKnownSymmetryNames().Aggregate("", (a, b) => a + "\n\t" + b));
                Console.WriteLine();
                return(false);
            }
            if (UnitId1 == null || !SymmetryBuilderFactory.GetSymmetryUnitIds(Architecture).Contains(UnitId1))
            {
                Console.WriteLine("Mandatory '-axis1' flag is missing or invalid - allowed values are:");
                Console.Write(SymmetryBuilderFactory.GetSymmetryUnitIds(Architecture).Aggregate("", (a, b) => a + "\n\t" + b));
                return(false);
            }
            if (UnitId2 == null || !SymmetryBuilderFactory.GetSymmetryUnitIds(Architecture).Contains(UnitId2))
            {
                Console.WriteLine("Mandatory '-axis1' flag is missing or invalid - allowed values are:");
                Console.Write(SymmetryBuilderFactory.GetSymmetryUnitIds(Architecture).Aggregate("", (a, b) => a + "\n\t" + b));
                return(false);
            }
            return(true);
        }