void InitializeDesignablePositions() { List <int> designablePositions = new List <int>(); // Identify new contacts created between ranges (atomic contact or vector contact, i.e. potentially contacting), but not including the fusion region // Identify any clashes involving the fusion region { for (int i = 0; i < IdentityRanges.Length - 1; i++) { List <int> newContactPositions = Clash.GetContactIndices(Peptide, new Range[] { IdentityRanges[i], IdentityRanges[i + 1] }, Clash.ContactType.VectorCACB | Clash.ContactType.Atomic); Range spliceRange = new Range(IdentityRanges[i].End + 1, IdentityRanges[i + 1].Start - 1); List <int> clashes = Clash.GetContactIndices(Peptide, new Range[] { IdentityRanges[i], IdentityRanges[i + 1], spliceRange }, Clash.ContactType.AtomicClash); designablePositions.AddRange(newContactPositions); designablePositions.AddRange(clashes); designablePositions.AddRange(Enumerable.Range(spliceRange.Start, spliceRange.Length + 1)); } } // Identify broken contacts, i.e. those from within the identity region that interact with something // past the splice region. { for (int i = 0; i < OriginalRanges.Length; i++) { List <Range> rangesForChain = new List <Range>(); Range rangeIncludingSplice = OriginalRanges[i]; if (i > 0) { rangeIncludingSplice.Start -= (IdentityRanges[i].Start - IdentityRanges[i - 1].End - 1); } if (i < OriginalRanges.Length - 1) { rangeIncludingSplice.End += (IdentityRanges[i + 1].Start - IdentityRanges[i].End - 1); } rangesForChain.Add(rangeIncludingSplice); if (rangeIncludingSplice.Start > 0) { rangesForChain.Add(new Range(0, rangeIncludingSplice.Start - 1)); } if (rangeIncludingSplice.End < OriginalChains[i].Count - 1) { rangesForChain.Add(new Range(rangeIncludingSplice.End + 1, OriginalChains[i].Count - 1)); } List <int> brokenContacts = Clash.GetContactIndices(OriginalChains[i], rangesForChain.ToArray(), Clash.ContactType.SidechainSidechain | Clash.ContactType.IgnoreInvalidCoordinates); foreach (int contactIndex in brokenContacts) { if (OriginalRanges[i].Contains(contactIndex)) { int remappedIndex = contactIndex + IdentityRanges[i].Start - OriginalRanges[i].Start; designablePositions.Add(remappedIndex); Debug.Assert(0 <= remappedIndex && remappedIndex < Peptide.Count); } } } } designablePositions.Sort(); designablePositions_ = designablePositions.Distinct().ToArray(); }
public static List <int> GetInterChainContactIndices(IStructure assembly, int chainIndex) { IChain a = assembly[chainIndex]; IChain[] others = assembly.Where(chain => chain != a).ToArray(); List <int> contacts = Clash.GetContactIndices(a, others); return(contacts); }
public static List <int> GetCnInterAsuContactIndices(IStructure cnAsymmetricUnit, int chainIndex, int multiplicity, Vector3 axis) { Trace.Assert(0 <= chainIndex && chainIndex < cnAsymmetricUnit.Count); AxisPattern <IStructure> pattern = new AxisPattern <IStructure>(axis, multiplicity, cnAsymmetricUnit); IStructure[] others = pattern[1, multiplicity - 1].ToArray();// CxUtilities.Pattern(cnAsymmetricUnit, axis, multiplicity, new int[] { 0 }, true); List <int> interAsuContacts = Clash.GetContactIndices(cnAsymmetricUnit[chainIndex], others.SelectMany(str => str).ToArray()); return(interAsuContacts); }
public static List <int> GetCnInterAsuContactIndices(IChain monomer, int multiplicity, Vector3 axis) { IChain[] oligomer = new IChain[multiplicity - 1]; for (int i = 0; i < multiplicity - 1; i++) { oligomer[i] = new Chain(monomer); oligomer[i].RotateRadians(Vector3.Zero, Vector3.UnitZ, (float)((i + 1) * 2 * Math.PI / multiplicity)); } List <int> contacts = Clash.GetContactIndices(monomer, oligomer); return(contacts); }