Exemple #1
0
 public override int GetDistance(string refStructure, string modelStructure)
 {
     if (!pdbs.molDic.ContainsKey(refStructure) || !pdbs.molDic.ContainsKey(modelStructure))
     {
         return(errorValue);
     }
     if (pdbPos == null)
     {
         posMOL locPosMol = Optimization.PrepareData(pdbs.molDic[refStructure], pdbs.molDic[modelStructure]);
         return((int)(Optimization.Rmsd(locPosMol.posmol1, locPosMol.posmol2, false) * 100));
     }
     else
     {
         return((int)(Optimization.Rmsd(pdbPos[hashIndex[refStructure]], pdbPos[hashIndex[modelStructure]], false) * 100));
     }
 }
Exemple #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);
        }
Exemple #3
0
        public override int GetDistance(string refStructure, string modelStructure)
        {
            KeyValuePair <List <int>, float[, ]> bestpair = default(KeyValuePair <List <int>, float[, ]>);

            if (!pdbs.molDic.ContainsKey(refStructure) || !pdbs.molDic.ContainsKey(modelStructure))
            {
                return(errorValue);
            }

            posMOL locPosMol = Optimization.PrepareData(pdbs.molDic[refStructure], pdbs.molDic[modelStructure]);

            foreach (var item in segments)
            {
                if (locPosMol.posmol1.GetLength(0) < item)
                {
                    continue;
                }
                KeyValuePair <List <int>, float[, ]> seg = FindLongestSegment(item, Threshold, locPosMol.posmol1, locPosMol.posmol2);
                if (seg.Key != null && (bestpair.Equals(default(KeyValuePair <List <int>, float[, ]>)) || bestpair.Key.Count < seg.Key.Count))
                {
                    bestpair = seg;
                }
            }

            if (!bestpair.Equals(default(KeyValuePair <List <int>, float[, ]>)))
            {
                if (bestpair.Key == null)
                {
                    return(0);
                }
                else
                {
                    return(bestpair.Key.Count * 100 / pdbs.molDic[refStructure].molLength);
                }
            }


            return(0);
        }
Exemple #4
0
        public override int GetDistance(string refStructure, string modelStructure)
        {
            int seedL = 4;
            //float maxDist = 3.5f;
            float maxDist = 5.0f;

            if (!pdbs.molDic.ContainsKey(refStructure) || !pdbs.molDic.ContainsKey(modelStructure))
            {
                return(errorValue);
            }


            posMOL locPosMol = Optimization.PrepareData(pdbs.molDic[refStructure], pdbs.molDic[modelStructure]);

            KeyValuePair <List <int>, float[, ]> seg = FindLongestSegment(seedL, maxDist, locPosMol.posmol1, locPosMol.posmol2);

            if (seg.Key == null)
            {
                return(0);
            }

            float sum   = 0;
            float mDist = maxDist * maxDist;
            float rmsd  = 0;

            foreach (var item in seg.Key)
            {
                float dist = 0;
                dist  = calcDist(locPosMol.posmol1, seg.Value, item);
                rmsd += dist;
                dist *= dist;
                sum  += 100 / (1 + dist / mDist);
            }
            rmsd /= seg.Key.Count;
            return(100 - (int)((sum / pdbs.molDic[refStructure].molLength)));//locPosMol.posmol1.GetLength(0)));
        }