Beispiel #1
0
        public static Selection GetCnInterAsuContacts(IStructure cnAsymmetricUnit, int multiplicity, Vector3 axis)
        {
            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);
            Selection    selection = Clash.GetContactSelectionInFocusSet(new IStructure[] { cnAsymmetricUnit }, others);

            return(selection);
        }
Beispiel #2
0
        public static Selection GetCnInterAsuContacts(IStructure cnAsymmetricUnit, int multiplicity, Line axis, Clash.ContactType contactType = Clash.ContactType.Atomic)
        {
            IStructure mirror = cnAsymmetricUnit.GetMirroredElement(true, null);
            AxisPattern <IStructure> pattern = new AxisPattern <IStructure>(axis.Point, axis.Direction, multiplicity, mirror, new int[] { 0 });

            IStructure[] others    = pattern.ToArray();//[1, multiplicity - 1].ToArray(); // CxUtilities.Pattern(cnAsymmetricUnit, axis, multiplicity, new int[] { 0 }, true);
            Selection    selection = Clash.GetContactSelectionInFocusSet(new IStructure[] { cnAsymmetricUnit }, others, contactType);

            return(selection);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public static bool[][] GetCnInterAsuContactBools(IStructure asu, int multiplicity, Vector3 axis)
        {
            asu = (IStructure)asu.DeepCopy();
            IStructure mirror = asu.GetMirroredElement(true, null);
            AxisPattern <IStructure> pattern = new AxisPattern <IStructure>(axis, multiplicity, mirror, new int[] { 0 });

            IStructure[] neighbors = pattern.ToArray();

            //IStructure[] neighbors = CxUtilities.Pattern(asu, axis, multiplicity, new int[] { 0 }, true);

            Selection contactAas = Clash.GetContactSelectionInFocusSet(new IStructure[] { asu }, neighbors, Clash.ContactType.Atomic);

            bool[][] contacts = asu.Select(chain => chain.Select(aa => contactAas.Aas.Contains(aa)).ToArray()).ToArray();
            return(contacts);
        }
Beispiel #5
0
        /// <summary>
        /// Tests whether either N fused to C or C fused to N has a valid combination. If both are being tested, the function
        /// returns whether either has a valid combination
        /// </summary>
        /// <param name="multiplicity"></param>
        /// <param name="cn"></param>
        /// <param name="other"></param>
        /// <param name="alignment"></param>
        /// <param name="ntermCnTest"></param>
        /// <param name="ctermCnTest"></param>
        /// <param name="minSubstructureLength"></param>
        /// <returns></returns>
        public static bool TestClashCn(int multiplicity, IStructure cn, IStructure other, TransformSequenceAlignment alignment, bool ntermCnTest = true, bool ctermCnTest = true, int minSubstructureLength = 0)
        {
            Trace.Assert(minSubstructureLength >= 0);

            IChain cnChain    = cn[alignment.ChainIndex1];
            IChain otherChain = other[alignment.ChainIndex2];

            if (ntermCnTest)
            {
                int finalOtherIndex = Math.Min(otherChain.Count - 1, alignment.Range2.End + minSubstructureLength - 1);
                Trace.Assert(alignment.Range1.Start < cnChain.Count);
                Trace.Assert(0 <= alignment.Range2.End && alignment.Range2.End < otherChain.Count && finalOtherIndex < otherChain.Count);
                IChain copyCn    = new Chain(cnChain[0, alignment.Range1.Start]);
                IChain copyOther = new Chain(otherChain[alignment.Range2.End, finalOtherIndex], true);

                copyOther.Transform(alignment.Align2);

                if (!Clash.AnyContact(copyCn, copyOther, Clash.ContactType.MainchainMainchainClash))
                {
                    copyCn.AddRange(copyOther);


                    AxisPattern <IChain> pattern   = new AxisPattern <IChain>(Vector3.UnitZ, multiplicity, copyCn);
                    IChain[]             neighbors = pattern[1, multiplicity - 1].ToArray();

                    //IChain[] pattern = CxUtilities.Pattern(copyCn, Vector3.UnitZ, multiplicity, new int[] { 0 }, true);

                    if (!Clash.AnyContact(new IChain[] { copyCn }, neighbors, Clash.ContactType.MainchainMainchainClash))
                    {
                        return(false);
                    }
                }
            }

            if (ctermCnTest)
            {
                int firstOtherIndex = Math.Max(0, alignment.Range2.Start - minSubstructureLength + 1);
                Trace.Assert(0 <= alignment.Range1.End && alignment.Range1.End < cnChain.Count);
                Trace.Assert(0 <= firstOtherIndex && firstOtherIndex < otherChain.Count && alignment.Range2.Start < otherChain.Count);
                IChain copyCn    = new Chain(cnChain[alignment.Range1.End, cnChain.Count - 1]);
                IChain copyOther = new Chain(otherChain[firstOtherIndex, alignment.Range2.Start], true);
                copyOther.Transform(alignment.Align2);

                if (!Clash.AnyContact(copyCn, copyOther, Clash.ContactType.MainchainMainchainClash))
                {
                    copyCn.AddRange(copyOther);

                    AxisPattern <IChain> pattern   = new AxisPattern <IChain>(Vector3.UnitZ, multiplicity, copyCn);
                    IChain[]             neighbors = pattern[1, multiplicity - 1].ToArray();

                    //IChain[] pattern = CxUtilities.Pattern(copyCn, Vector3.UnitZ, multiplicity, new int[] { 0 }, true);

                    if (!Clash.AnyContact(new IChain[] { copyCn }, neighbors, Clash.ContactType.MainchainMainchainClash))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }