static void StartJobsAsymmetricPair(AsymmetricFusionFlags options) { List <string> files1 = GetPdbFiles("./", options.PeptideRegex1).ToList(); List <string> files2 = GetPdbFiles("./", options.PeptideRegex2).ToList(); ThreadSafeJobCounter sharedCounter = new ThreadSafeJobCounter(); sharedCounter.Total = files1.Count * files2.Count; Console.WriteLine("\nUsing the following files for unit 1:"); files1.ForEach(file => Console.WriteLine(file)); Console.WriteLine("\nUsing the following files for unit 2:"); files2.ForEach(file => Console.WriteLine(file)); // Parse n-peptide and offset it to positive Z foreach (string file1 in files1) { string pdbCode1 = PdbQuick.CodeFromFilePath(file1); IChain peptide1 = PdbQuick.ChainFromFileOrCode(file1); peptide1.Translate(-Rmsd.GetBackboneCentroid(peptide1)); // Parse c-peptide and offset it to positive Z foreach (string file2 in files2) { string pdbCode2 = PdbQuick.CodeFromFilePath(file2); IChain peptide2 = PdbQuick.ChainFromFileOrCode(file2); peptide2.Translate(-Rmsd.GetBackboneCentroid(peptide2)); if (peptide1 == null || peptide2 == null) { Console.WriteLine("Pdb parsing failed for one of [{0}, {1}]", file1, file2); continue; } JobStartParamsAsymmetricPair startParams = new JobStartParamsAsymmetricPair(); startParams.OutputPrefix = "PAIR"; startParams.PdbCodeN = pdbCode1; startParams.PdbCodeC = pdbCode2; startParams.PeptideN = peptide1; startParams.PeptideC = peptide2; startParams.RangeN = options.Range1 != null ? (Range)options.Range1 : new Range(0, peptide1.Count - 1); startParams.RangeC = options.Range2 != null ? (Range)options.Range2 : new Range(0, peptide2.Count - 1); startParams.TopX = options.TopX; startParams.Counter = sharedCounter; // Shared counter across queued jobs Debug.Assert(startParams.Validate(), "JobStartParamsAsymmetricPair validation failure"); _threadCountSemaphore.WaitOne(); sharedCounter.IncrementQueued(); Console.WriteLine("Queuing triplet [Bundle {0}]:[Bundle {1}], {2:F2} % ({3}/{4})", pdbCode1, pdbCode2, startParams.Counter.PercentQueued, startParams.Counter.Queued, startParams.Counter.Total); Thread thread = new Thread(new ParameterizedThreadStart(RunJobAsymmetricPair)); thread.Start(startParams); } } }
public static bool Run(string[] args) { switch (args.FirstOrDefault()) { case CxrcxFusionFlags.BaseFlag: { CxrcxFusionFlags options = new CxrcxFusionFlags(); if (options.ParseArgs(args)) { StartJobsAngleCXRCX(options); } else { return(false); } } break; case CxcxFusionFlags.BaseFlag: { CxcxFusionFlags options = new CxcxFusionFlags(); if (options.ParseArgs(args)) { StartJobsAngleCXCX(options); } else { return(false); } } break; case AsymmetricFusionFlags.BaseFlag: { AsymmetricFusionFlags options = new AsymmetricFusionFlags(); if (options.ParseArgs(args)) { StartJobsAsymmetricPair(options); } else { return(false); } } break; default: return(false); } return(true); }