static void RunJobAngleCXRCX(object obj) { JobStartParamsCXRCX start = (JobStartParamsCXRCX)obj; int count = 0; // Get a bunch of fusions with the h**o-oligomer axes positioned such that after transformation by the symmetry definition's first coordinate system transformation, // the axes overlap the first and second repeating unit axes SymmetryBuilder builder = start.Symmetry; CoordinateSystem coordinateSystem1 = builder.GetPrincipalCoordinateSystem(start.UnitId1); CoordinateSystem coordinateSystem2 = builder.GetPrincipalCoordinateSystem(start.UnitId2); Structure cnAsymmetricUnit1 = new Structure(start.Cx1); Structure cnAsymmetricUnit2 = new Structure(start.Cx2); Structure spacer = new Structure(start.Repeat); Line principalAxis1 = Line.CreateFromPointAndDirection(coordinateSystem1.Translation, coordinateSystem1.UnitX); // The rosetta symdefs axes are along X of each transformed coordinate system, but something not requiring foreknowledge would be nice. Line principalAxis2 = Line.CreateFromPointAndDirection(coordinateSystem2.Translation, coordinateSystem2.UnitX); // The rosetta symdefs axes are along X of each transformed coordinate system, but something not requiring foreknowledge would be nice. //Quaternion premultiply = Quaternion.Inverse(coordinateSystem1.Transform.Rotation); //principalAxis1.Direction = Vector3.Transform(principalAxis1.Direction, premultiply); //principalAxis2.Direction = Vector3.Transform(principalAxis2.Direction, premultiply); //principalAxis1.Point = Vector3.Transform(principalAxis1.Point, premultiply); //principalAxis2.Point = Vector3.Transform(principalAxis2.Point, premultiply); //AxisRealignment axisAlignmentUtility = AxisRealignment.Create((float) start.AngleDegrees, principalAxis1, principalAxis2); TwoAxisRealignment axisAlignmentUtility = AxisRealignmentFactory.Create(builder.GetArchitecture(), start.UnitId1, start.UnitId2); for (int chainIndexCn1 = 0; chainIndexCn1 < cnAsymmetricUnit1.Count; chainIndexCn1++) { for (int chainIndexCn2 = 0; chainIndexCn2 < cnAsymmetricUnit2.Count; chainIndexCn2++) { for (int chainIndexSpacer = 0; chainIndexSpacer < spacer.Count; chainIndexSpacer++) { List <Model> outputs = Fuse.SymmetricFusionGenerator.CnSnCn( (IStructure)cnAsymmetricUnit1.DeepCopy(), (IStructure)cnAsymmetricUnit2.DeepCopy(), new IStructure[] { (IStructure)spacer.DeepCopy() }, new int[] { chainIndexCn1 }, new int[] { chainIndexCn2 }, new int[][] { new int[] { chainIndexSpacer } }, builder, start.UnitId1, start.UnitId2); int writtenOutCount = 0; foreach (Model output in outputs) { // Output files lock (lockFileIO) { string prefixFullStructure = String.Format("CXRCX_{0}_{1}_{2}_{3}_{4}", start.OutputPrefix, start.PdbCodeBundle1, start.PdbCodeRepeat, start.PdbCodeBundle2, count++); string prefixAsymmetricUnit = "ASU_" + prefixFullStructure; PdbQuick.Save(prefixFullStructure + ".pdb", output.Structure); PdbQuick.Save(prefixAsymmetricUnit + ".pdb", output.AsymmetricUnit); // Determine which residues should be designable: include residues whose contacts have been removed and // those with new contacts between previously separate substructures, but not existing interface residues Selection designable = new Selection(output.Selections[SymmetricFusionGenerator.AaSelectionAsuDesignable]); // Save a resfile identifying the designable residues Resfile resfileDesignable = new Resfile(); resfileDesignable.SetDesignOperation(output.AsymmetricUnit, designable, ResfileDesignOperation.NOTAA, new char[] { 'W', 'M', 'P', 'C' }); File.AppendAllLines(prefixAsymmetricUnit + ".resfile", resfileDesignable.GetFileText()); } writtenOutCount++; } } } } start.Counter.IncrementComplete(); Console.WriteLine("Completed triplet [Bundle {0}]:[Repeat {1}]:[Bundle {2}], {3:F2} degrees, {4:F2}% ({5}/{6})", start.PdbCodeBundle1, start.PdbCodeRepeat, start.PdbCodeBundle2, start.AngleDegrees, start.Counter.PercentComplete, start.Counter.Complete, start.Counter.Total); _threadCountSemaphore.Release(); }
static void Main(string[] args) { string[] skip = new string[] { // questionable C2 scaffolds, IMO - don't use them "ZC", "4pwwfrxC2", "bex2C2G2", "Di13", // questionable C3 scaffolds IMO or lacking free termini - don't use them "2L6HC3", "C3-1BH", "EXTN8", "1na0C3int2-xtal", "C3V" }; foreach (string symmetry in new string[] { "T" }) { string basedir = Directory.GetCurrentDirectory(); foreach (string fileNameOligomer1 in Directory.EnumerateFiles(Path.Combine(basedir, @"Database\Scaffolds\Denovo\C3"))) { if (skip.Any(str => fileNameOligomer1.Contains(str))) { continue; } IStructure oligomer1 = PdbQuick.AssemblyFromFileOrCode(fileNameOligomer1); foreach (string fileNameOligomer2 in Directory.EnumerateFiles(Path.Combine(basedir, @"Database\Scaffolds\Denovo\C2"))) { if (skip.Any(str => fileNameOligomer2.Contains(str))) { continue; } IStructure oligomer2 = PdbQuick.AssemblyFromFileOrCode(fileNameOligomer2); foreach (string fileNameStrut in Directory.EnumerateFiles(Path.Combine(basedir, @"Database\Scaffolds\Denovo\repeats\saxs_and_crystal"))) { IStructure strut = PdbQuick.AssemblyFromFileOrCode(fileNameStrut); string basenameC3 = (new FileInfo(fileNameOligomer1)).Name; string basenameC2 = (new FileInfo(fileNameOligomer2)).Name; string basenameStrut = (new FileInfo(fileNameStrut)).Name; string outputBase = String.Format("{0}32_{1}_{2}_{3}", symmetry, basenameC3, basenameStrut, basenameC2).Replace(".pdb", ""); Console.WriteLine("Trying {0} + {1} + {2}", basenameC3, basenameC2, basenameStrut); SymmetryBuilder builder = SymmetryBuilderFactory.CreateFromSymmetryName(symmetry); List <Model> models = SymmetricFusionGenerator.CnSnCn(oligomer1, oligomer2, new IStructure[] { strut }, new int[] { 0 }, new int[] { 0 }, new int[][] { new int[] { 0 } }, builder, "C3X", "C2", 5, 5, 5, 20); for (int i = 0; i < models.Count; i++) { Model model = models[i]; string outputName = outputBase + "_" + i; PdbQuick.Save(outputName + ".pdb", model.Structure); foreach (KeyValuePair <string, Selection> kvp in model.Selections) { string selectionName = kvp.Key; Selection selection = kvp.Value; if (model.AsymmetricUnit != null) { Resfile resfile = new Resfile(); resfile.SetDesignOperation(model.AsymmetricUnit, selection, ResfileDesignOperation.NOTAA, new char[] { 'W', 'M', 'P', 'C' }); if (resfile.DesignOperationsCount > 0) { string[] lines = resfile.GetFileText(); string resfileName = String.Format("{0}_{1}_asu.resfile", outputName, selectionName); File.WriteAllLines(resfileName, lines); } } } } } } } } }