예제 #1
0
        static public NEC GetInstance(string n, string e, string c)
        {
            NEC nec = new NEC();

            nec.N         = n;
            nec.E         = e;
            nec.C         = c;
            nec._asString = SpecialFunctions.CreateDelimitedString(",", n, e, c);
            return(nec);
        }
        private static ITask CreateTask(string externalRemoteDirectoryName, string internalRemoteDirectoryName, int pieceCount, string treeFileName, string predictorFileName, string targetFileName, string leafDistributionName, string nullDataGeneratorName, string keepTestName, string skipRowIndexFileNameOrNull, string niceName, RangeCollection nullIndexRangeCollection, string exeNewRelativeDirectoryName, int pieceIndex, string optimizerName)
        {
            /*                <Task MaximumNumberOfProcessors="1"
             * MinimumNumberOfProcessors="1"
             * Depend=""
             * Stdout="FILLIN.txt"
             * Stderr="FILLIN2.txt"
             * Name="FILL4"
             * CommandLine="FILLIN3"
             * IsCheckpointable="false"
             * IsExclusive="false"
             * IsRerunnable="false" Runtime="Infinite">
             * //    <EnvironmentVariables />
             * //</Task>
             */

            ITask task = new Task();

            task.WorkDirectory = internalRemoteDirectoryName;

            string taskCommandLine = SpecialFunctions.CreateDelimitedString(" ",
                                                                            string.Format("{0}\\PhyloD.exe", exeNewRelativeDirectoryName),
                                                                            string.Format("-keepTest {0}", keepTestName),
                                                                            (null == skipRowIndexFileNameOrNull) ? "" : string.Format("-skipRowIndexFile {0}", skipRowIndexFileNameOrNull),
                                                                            string.Format("-optimizer {0}", optimizerName),
                                                                            treeFileName, predictorFileName, targetFileName, leafDistributionName, nullDataGeneratorName, niceName,
                                                                            "raw",
                                                                            string.Format("{0}-{0}", pieceIndex),
                                                                            pieceCount, nullIndexRangeCollection); //!!!create a nicer way to make a space delimited list


            SpecialFunctions.CheckCondition(taskCommandLine.Length <= 480, "Command line length " + taskCommandLine.Length + " exceeds max of 480");
            task.CommandLine = taskCommandLine;

            task.Name        = SpecialFunctions.CreateDelimitedString(" ", niceName, pieceIndex, leafDistributionName, nullIndexRangeCollection);
            task.IsExclusive = false;
            task.Stderr      = string.Format(@"{0}\Stderr\{1}.{2}.{3}.txt", internalRemoteDirectoryName, niceName, leafDistributionName, pieceIndex);
            Directory.CreateDirectory(externalRemoteDirectoryName + @"\Stderr");
            task.Stdout = string.Format(@"{0}\Stdout\{1}.{2}.{3}.txt", internalRemoteDirectoryName, niceName, leafDistributionName, pieceIndex);
            Directory.CreateDirectory(externalRemoteDirectoryName + @"\Stdout");
            task.Runtime = "Infinite";
            return(task);
        }
        private static void FillQueueBySplitingPeptideList(
            int pieceCount, double?leakProbabilityOrNull, double pValue, string caseName, string hlaFactoryName,
            RangeCollection nullIndexRangeCollection,
            string internalRemoteDirectoryName,
            string externalRemoteDirectoryName,
            string inputDirectoryName,
            Queue <ITask> taskQueue)
        {
            string newExeDirectoryName;
            string exeNewRelativeDirectoryName;
            string internalRemoteInputDirectoryName;

            SetupDirectories(internalRemoteDirectoryName, externalRemoteDirectoryName, inputDirectoryName, caseName, out newExeDirectoryName, out exeNewRelativeDirectoryName, out internalRemoteInputDirectoryName);

            for (int pieceIndex = 0; pieceIndex < pieceCount; ++pieceIndex)
            {
                string taskCommandLine = SpecialFunctions.CreateDelimitedString(" ",
                                                                                //"HlaAssign.exe",
                                                                                string.Format("{0}\\HlaAssign.exe", exeNewRelativeDirectoryName),
                                                                                leakProbabilityOrNull, pValue, internalRemoteInputDirectoryName, caseName, hlaFactoryName,
                                                                                string.Format("{0}-{0}", pieceIndex),
                                                                                pieceCount, nullIndexRangeCollection); //!!!create a nicer way to make a space delimited list


                ITask task = new Task();

                task.WorkDirectory = internalRemoteDirectoryName;
                SpecialFunctions.CheckCondition(taskCommandLine.Length <= 480);
                task.CommandLine = taskCommandLine;

                task.Name        = SpecialFunctions.CreateDelimitedString(" ", caseName, pieceIndex, nullIndexRangeCollection);
                task.IsExclusive = false;
                task.Stderr      = string.Format(@"{0}\Stderr\{1}.{2}.txt", exeNewRelativeDirectoryName, caseName, pieceIndex);
                Directory.CreateDirectory(newExeDirectoryName + @"\Stderr");
                task.Stdout = string.Format(@"{0}\Stdout\{1}.{2}.txt", exeNewRelativeDirectoryName, caseName, pieceIndex);
                Directory.CreateDirectory(newExeDirectoryName + @"\Stdout");
                task.Runtime = "Infinite";

                taskQueue.Enqueue(task);
            }
        }
        private static void FillQueueBySplitingDirNameLists(
            int pieceCountX,
            double?leakProbabilityOrNull, double pValue, string hlaFactoryName,
            RangeCollection nullIndexRangeCollection,
            string specFileNameOrNull,
            Queue <ITask> taskQueue, ref string caseNameTotal)
        {
            SpecialFunctions.CheckCondition(pieceCountX == 0, "When a list of directories is given, pieceCount must be 0");
            List <string> caseNameCollection = new List <string>();
            List <Dictionary <string, string> > rowCollection = SpecialFunctions.TabFileTableAsList(specFileNameOrNull, "case\tinputDirectory\texternalRemoteDirectory\tinternalRemoteDirectory", false);

            int dirCount = rowCollection.Count;

            for (int dirIndex = 0; dirIndex < dirCount; ++dirIndex)
            {
                Dictionary <string, string> row = rowCollection[dirIndex];
                string caseName = row["case"];
                caseNameCollection.Add(caseName);
                string newExeDirectoryName;
                string exeNewRelativeDirectoryName;
                string internalRemoteInputDirectoryName;
                SetupDirectories(row["internalRemoteDirectory"], row["externalRemoteDirectory"], row["inputDirectory"], caseName, out newExeDirectoryName, out exeNewRelativeDirectoryName, out internalRemoteInputDirectoryName);


                string taskCommandLine = SpecialFunctions.CreateDelimitedString(" ",
                                                                                //"HlaAssign.exe",
                                                                                string.Format("{0}\\HlaAssign.exe", exeNewRelativeDirectoryName),
                                                                                leakProbabilityOrNull, pValue, internalRemoteInputDirectoryName, caseName, hlaFactoryName,
                                                                                string.Format("{0}-{0}", 0),
                                                                                1, nullIndexRangeCollection); //!!!create a nicer way to make a space delimited list


                ITask task = new Task();

                task.WorkDirectory = row["internalRemoteDirectory"];
                SpecialFunctions.CheckCondition(taskCommandLine.Length <= 480);
                task.CommandLine = taskCommandLine;

                task.Name        = SpecialFunctions.CreateDelimitedString(" ", caseName, 1, nullIndexRangeCollection);
                task.IsExclusive = false;
                task.Stderr      = string.Format(@"{0}\Stderr\{1}.txt", exeNewRelativeDirectoryName, caseName);
                Directory.CreateDirectory(newExeDirectoryName + @"\Stderr");
                task.Stdout = string.Format(@"{0}\Stdout\{1}.txt", exeNewRelativeDirectoryName, caseName);
                Directory.CreateDirectory(newExeDirectoryName + @"\Stdout");
                task.Runtime = "Infinite";

                taskQueue.Enqueue(task);
            }
            if (caseNameCollection.Count == 0)
            {
                caseNameTotal = "empty";
            }
            else if (caseNameCollection.Count == 1)
            {
                caseNameTotal = caseNameCollection[0];
            }
            else
            {
                caseNameTotal = caseNameCollection[0] + "..." + caseNameCollection[caseNameCollection.Count - 1];
            }
        }