Beispiel #1
0
        private returnV GetStructAfterRotation(string refStructure, string modelStructure)
        {
            float[,] transMatrix = null;
            float [] cent1 = new float [3];
            float [] cent2 = new float [3];

            if (!pdbs.molDic.ContainsKey(refStructure) || !pdbs.molDic.ContainsKey(modelStructure))
            {
                return(null);
            }
            posMOL locPosMol = Optimization.PrepareData(pdbs.molDic[refStructure], pdbs.molDic[modelStructure], true);

            //opt.Rmsd(locPosMol.posmol1, locPosMol.posmol2, cent1, cent2, true);

            /* float [,]mm=new float [3,3];
             *
             * mm[0, 0] = 0; mm[0, 1] = 0; mm[0, 2] = 1;
             * mm[1, 0] = 1; mm[1, 1] = 0; mm[1, 2] = 0;
             * mm[2, 0] = 0; mm[2, 1] = 1; mm[2, 2] = 0;
             *
             * float [,]test=Optimization.MultMatrixTrans(locPosMol.posmol1, mm);*/

            transMatrix = Optimization.TransMatrix(locPosMol.posmol2, locPosMol.posmol1);
            //transMatrix = opt.TransMatrix(locPosMol.posmol1, test);
            if (transMatrix == null)
            {
                return(null);
            }

//            float[,] akk = Optimization.MultMatrixTrans(test, transMatrix);
            transMatrix = Optimization.MultMatrixTrans(locPosMol.posmol2, transMatrix);
            returnV r = new returnV();

            r.x = transMatrix;
            r.y = locPosMol.atoms;
            return(r);
            //return Optimization.MultMatrixTrans(test, transMatrix);
            //return akk;
            //return opt.posMolRot;
            //return opt.TransMatrix(opt.posMol1, opt.posMol2);
        }
Beispiel #2
0
        private returnV GetStructAfterRotation(string refStructure, string modelStructure)
        {

            float[,] transMatrix=null;
            float []cent1=new float [3];
            float []cent2=new float [3];

            if (!pdbs.molDic.ContainsKey(refStructure) || !pdbs.molDic.ContainsKey(modelStructure))
                return null;
            posMOL locPosMol=Optimization.PrepareData(pdbs.molDic[refStructure], pdbs.molDic[modelStructure],true);

            //opt.Rmsd(locPosMol.posmol1, locPosMol.posmol2, cent1, cent2, true);
           /* float [,]mm=new float [3,3];

            mm[0, 0] = 0; mm[0, 1] = 0; mm[0, 2] = 1;
            mm[1, 0] = 1; mm[1, 1] = 0; mm[1, 2] = 0;
            mm[2, 0] = 0; mm[2, 1] = 1; mm[2, 2] = 0;

            float [,]test=Optimization.MultMatrixTrans(locPosMol.posmol1, mm);*/
            
           transMatrix = Optimization.TransMatrix(locPosMol.posmol2, locPosMol.posmol1);
            //transMatrix = opt.TransMatrix(locPosMol.posmol1, test);
            if (transMatrix == null)
                return null;

//            float[,] akk = Optimization.MultMatrixTrans(test, transMatrix);
            transMatrix = Optimization.MultMatrixTrans(locPosMol.posmol2, transMatrix);
            returnV r=new returnV();
            r.x = transMatrix;
            r.y = locPosMol.atoms;
            return r;
            //return Optimization.MultMatrixTrans(test, transMatrix);
            //return akk;
            //return opt.posMolRot;
            //return opt.TransMatrix(opt.posMol1, opt.posMol2);

        }
Beispiel #3
0
        private float[,,] CalcRefPosition(List <string> structures, Dictionary <string, float[, , ]> aRotMol)
        {
            //float[,] refPosition = null;
            int[] counts;
            aRotMol.Clear();

            if (pdbs.molDic.Keys.Count == 1)
            {
                pdbs.EmptyAlignment(structures[0]);
            }

            float[, ,] refPosition = new float[pdbs.molDic[structures[0]].indexMol.Length, atomDic.Keys.Count, 3];
            //refPosition = new float[maxV, 3];
            counts = new int[pdbs.molDic[structures[0]].indexMol.Length];


            //Find longest structure (based on Atoms)
            string refLength = "";
            int    maxLength = 0;

            foreach (var item in structures)
            {
                int localMax = 0;
                foreach (var it in pdbs.molDic[item].mol.Chains[0].Residues)
                {
                    localMax += it.Atoms.Count;
                }
                if (localMax > maxLength)
                {
                    maxLength = localMax;
                    refLength = item;
                }
            }

            foreach (var item in structures)
            {
                returnV aux = GetStructAfterRotation(refLength, item);
                if (aux == null)
                {
                    continue;
                }
                float[, ,] auxK = new float[pdbs.molDic[refLength].indexMol.Length, atomDic.Keys.Count, 3];


                for (int i = 0, m = 0; i < aux.y.Length; i++)
                {
                    for (int j = 0; j < aux.y[i].Count; j++, m++)
                    {
                        for (int n = 0; n < 3; n++)
                        {
                            refPosition[i, atomDic[aux.y[i][j]], n] += aux.x[m, n];
                            auxK[i, atomDic[aux.y[i][j]], n]         = aux.x[m, n];
                        }

                        counts[i]++;
                    }
                }
                aRotMol.Add(item, auxK);
            }
            for (int i = 0; i < refPosition.GetLength(0); i++)
            {
                if (counts[i] > 0)
                {
                    for (int j = 0; j < refPosition.GetLength(1); j++)
                    {
                        for (int n = 0; n < refPosition.GetLength(2); n++)
                        {
                            refPosition[i, j, n] /= counts[i];
                        }
                    }
                }
            }


            return(refPosition);
        }