コード例 #1
0
            //public void NeighborsUpdatePeerPoint(int i)
            //{
            //    List<Structs.Point> points = this.r;
            //    Structs.Point temp = points[i];
            //    temp.neighbors = NeighborsProcess(points[i], i, true);
            //    points[i] = temp;

            //    this.r = points;
            //}


            internal static BasicStructs.Neighbor[] NeighborsProcess(BasicStructs.Point point, int selectNode, bool calcEnergy)
            {
                BasicStructs.Point originalPoint = point;

                point.x++;
                BasicStructs.Neighbor M1 = NeighborsCheck(point, selectNode, 0, calcEnergy);

                point = originalPoint;
                point.x--;
                BasicStructs.Neighbor M2 = NeighborsCheck(point, selectNode, 1, calcEnergy);

                point = originalPoint;
                point.y++;
                BasicStructs.Neighbor M3 = NeighborsCheck(point, selectNode, 2, calcEnergy);

                point = originalPoint;
                point.y--;
                BasicStructs.Neighbor M4 = NeighborsCheck(point, selectNode, 3, calcEnergy);

                point = originalPoint;
                point.z++;
                BasicStructs.Neighbor M5 = NeighborsCheck(point, selectNode, 4, calcEnergy);

                point = originalPoint;
                point.z--;
                BasicStructs.Neighbor M6 = NeighborsCheck(point, selectNode, 5, calcEnergy);

                return(new BasicStructs.Neighbor[6] {
                    M1, M2, M3, M4, M5, M6
                });
            }
コード例 #2
0
        private void ModelForFile(ref double cont, ref int cadeiaIdeal, ref int cadeiaReal, ref int cadeiaSoft, ref int cadeiaError)
        {
            string[] lines = Regex.Split(AppConfigClient.Param.dataToProcess.file, "\r\n");

            //foreach (string line in lines)
            for (int i = 0; i < lines.Count(); i++)
            {
                string line = lines[i];
                try
                {
                    Structs.BasicStructs.Point tempCoord = new Structs.BasicStructs.Point();
                    string[] coord = line.Split(new char[] { '\t' });
                    tempCoord.x = Convert.ToInt32(coord[0]);
                    tempCoord.y = Convert.ToInt32(coord[1]);
                    tempCoord.z = Convert.ToInt32(coord[2]);
                    GCPS.chain.r.Add(tempCoord);
                }
                catch (FormatException ex)
                {
                    GICO.WriteLine(ex);
                }
            }

            ProcessMonomero(ref cont, ref cadeiaIdeal, ref cadeiaReal, ref cadeiaSoft, ref cadeiaError);

            //Prepara aplicação para gerar uma nova ISEM
            Protein.ClearAppToGenNewIsem();
        }
コード例 #3
0
        /// <summary>
        /// Retorno total de item em E
        /// </summary>
        /// <returns></returns>
        public double ECount()
        {
            int count = 0;

            //foreach (Structs.Point item in r)
            for (int i = 0; i < r.Count; i++)
            {
                BasicStructs.Point item = r[i];
                count += item.e.Count;
            }
            return(count);
        }
コード例 #4
0
            /// <summary>
            /// Salva em arquivo o contato topológico de vizinhos de primeiro contato
            /// </summary>
            /// <param name="isem"></param>
            public void NeighborsSave(long isem, ref int numberNeighborTopological)
            {
                string file = isem.ToString();
                //Members.initialIsem = Members.isem

                string dir      = IO.Directory.SubDirNeighbors;
                string pathFile = dir + @"\" + file + Consts.extensionOfFile;

                ExtendedStreamWriter sw = new ExtendedStreamWriter(Config.Crypt);

                sw.CreateText(pathFile, Config.CurrentGuid);

                int numberContact = 0;

                numberNeighborTopological = 0;
                //sw.WriteLine("Residuo | 1o.Vz.| 2o.Vz.| 3o.Vz.| 4o.Vz.| 5o.Vz.| 6o.Vz.|");

                List <BasicStructs.Point> points = this.r;

                //foreach (Structs.Point temp in points)
                for (int i = 0; i < points.Count; i++)
                {
                    BasicStructs.Point temp = points[i];
                    sw.Write("{0}\t", i);

                    if (temp.neighbors != null)
                    {
                        bool ocuredContact = false;
                        for (int j = 0; j < temp.neighbors.Length; j++)
                        {
                            if (temp.neighbors[j].classification == NeighborsType.neighborTopological)
                            {
                                numberContact++;
                                ocuredContact = true;
                                sw.Write("{0}\t", temp.neighbors[j].classification.ToString() + "(" + temp.neighbors[j].contacResidue.ToString() + ")");
                            }
                        }
                        if (ocuredContact)
                        {
                            numberNeighborTopological++;
                        }
                    }
                    sw.WriteLine();
                }

                sw.WriteLine();
                sw.WriteLine("numberContact:" + numberContact);
                sw.WriteLine("numberNeighborTopological:" + numberNeighborTopological);
                //this.numberNeighborTopological = numberNeighborTopological;
                sw.Flush();
                sw.Close();
            }
コード例 #5
0
            public void NeighborsUpdateAll()
            {
                for (int i = 0; i < GCPS.tempChain.r.Count; i++)
                {
                    CalculatingEnergy.DelEnergyFWD(i);
                }

                List <BasicStructs.Point> points = this.r;

                for (int i = 0; i < points.Count; i++)
                {
                    BasicStructs.Point temp = points[i];
                    temp.neighbors = NeighborsProcess(points[i], i, true);
                    points[i]      = temp;
                }

                this.r = points;
            }
コード例 #6
0
            internal static BasicStructs.Neighbor NeighborsCheck(BasicStructs.Point tempCoord, int selectNode, int M, bool calcEnergy)
            {
                for (int i = 0; i < GridProteinFolding.Core.eFolding.Simulation.tempChain.r.Count; i++)
                {
                    BasicStructs.Point temp = GCPS.tempChain.r[i];

                    //ocupado por um resíduo vizinho da cadeia: M(i,j) = -1;
                    if (temp.x == tempCoord.x &&
                        temp.y == tempCoord.y &&
                        temp.z == tempCoord.z && (((selectNode + 1) == i) || ((selectNode - 1) == i)))
                    {
                        return(new BasicStructs.Neighbor()
                        {
                            classification = NeighborsType.neighborChain,
                            contacResidue = i
                        });
                    }
                    //ocupado por um vizinho topológico :  M(i,j) = +1;
                    else if (temp.x == tempCoord.x &&
                             temp.y == tempCoord.y &&
                             temp.z == tempCoord.z)
                    {
                        if (calcEnergy)
                        {
                            CalculatingEnergy.AddEnergy(GCPS.energeticMatrix[selectNode, i], selectNode, i);
                        }

                        return(new BasicStructs.Neighbor()
                        {
                            classification = NeighborsType.neighborTopological,
                            contacResidue = i
                        });
                    }
                }
                //sítio vazio:  M(i,j) = 0.

                return(new BasicStructs.Neighbor()
                {
                    classification = NeighborsType.emptySite,
                    contacResidue = -1
                });
            }
コード例 #7
0
        /// <summary>
        /// Save as coordenadas geradas da SEMENTE
        /// </summary>
        private static void SaveSeedCoordAtDirSeed()
        {
            string dir      = GridProteinFolding.Process.IO.Directory.DirSeed;
            string pathFile = dir + @"\" + GCPS.chain.isem + Consts.extensionOfFile;

            ExtendedStreamWriter sw = new ExtendedStreamWriter();

            sw.CreateText(pathFile, Config.currentGuid);

            sw.WriteLine("{0}", GCPS.chain.isem);

            for (int i = 0; i < GCPS.chain.r.Count; i++)
            {
                BasicStructs.Point temp = GCPS.chain.r[i];
                sw.WriteLine("{0}\t{1}\t{2}", temp.x, temp.y, temp.z);
            }

            sw.Flush();
            sw.Close();
        }
コード例 #8
0
        /// <summary>
        /// Rotina o qual costroi a cadeia de monomeros
        /// </summary>
        /// <param name="lastValed">posição do último monomero válido</param>
        public static void CreateStruct(ref int lastValed)
        {
            while (GCPS.chain.r.Count < AppConfigClient.Param.dataToProcess.totalSitio)
            {
                BasicStructs.Point tempCoord = new BasicStructs.Point(); //Crio uma coordenada temporária

                lastValed = GCPS.chain.r.Count - 1;

                tempCoord.x = GCPS.chain.r[lastValed].x; //Copia o último ponto válido para a coordenada temporária
                tempCoord.y = GCPS.chain.r[lastValed].y;
                tempCoord.z = GCPS.chain.r[lastValed].z;

                tempCoord.deadEndPoints = string.Empty;
                tempCoord.deadEnd       = 0;

                //Sorteira X,Y ou Z
                Randomic.Random();
                if (Randomic.randu < Consts.rXYZ) //X
                {
                    Randomic.Random();
                    tempCoord.x = Randomic.randu < 0.5 ? tempCoord.x - 1 : tempCoord.x + 1; //escolhe +/- 1
                }
                else if (Randomic.randu < (Consts.rXYZ * 2))                                //Y
                {
                    Randomic.Random();
                    tempCoord.y = Randomic.randu < 0.5 ? tempCoord.y - 1 : tempCoord.y + 1; //escolhe +/- 1
                }
                else
                {                                                                           //Z
                    Randomic.Random();
                    tempCoord.z = Randomic.randu < 0.5 ? tempCoord.z - 1 : tempCoord.z + 1; //escolhe +/- 1
                }


                //aidiconar valor de enegia inicial
                tempCoord.e = new List <TypeE>();

                //adiciona o novo ponto
                GCPS.chain.r.Add(tempCoord);
            }
        }
コード例 #9
0
        /// <summary>
        /// Atribui valor energético a um nó
        /// </summary>
        /// <param name="energy"></param>
        /// <param name="selectNode"></param>
        /// <param name="i"></param>
        public static void AddEnergy(double energy, int selectNode, int i)
        {
            Structs.BasicStructs.Point tempPoint         = GCPS.tempChain.r[selectNode];
            Structs.BasicStructs.Point tempPointInverted = GCPS.tempChain.r[i];

            int count = tempPoint.e.Count(item => (item.i == i && item.selectNode == selectNode));

            count += tempPointInverted.e.Count(item => (item.i == selectNode && item.selectNode == i));

            //int idx = tempPoint.e.FindIndex(item => (item.i == i && item.selectNode == selectNode) || (item.i == selectNode && item.selectNode == i));
            if (count == 0)
            {
                //aplica nova energia na posição do node
                tempPoint.e.Add(new TypeE()
                {
                    e = energy, selectNode = selectNode, i = i
                });
                GCPS.tempChain.r[selectNode] = tempPoint;

                GCPS.chain.interationEnergy += "Add;";
            }
        }
コード例 #10
0
        /// <summary>
        /// Cria um Monometro
        /// </summary>
        /// <param name="tempCoord"></param>
        public static void CreateMono(ref BasicStructs.Point tempCoord)
        {
            tempCoord = GCPS.chain.r[GCPS.chain.r.Count - 1]; //Copia o último ponto válido para a coordenada temporária

            //Sorteira X,Y ou Z
            Randomic.Random();
            if (Randomic.randu < Consts.rXYZ) //X
            {
                Randomic.Random();
                tempCoord.x = Randomic.randu < 0.5 ? tempCoord.x - 1 : tempCoord.x + 1; //escolhe +/- 1
            }
            else if (Randomic.randu < (Consts.rXYZ * 2))                                //Y
            {
                Randomic.Random();

                tempCoord.y = Randomic.randu < 0.5 ? tempCoord.y - 1 : tempCoord.y + 1; //escolhe +/- 1
            }
            else
            {                                                                           //Z
                Randomic.Random();
                tempCoord.z = Randomic.randu < 0.5 ? tempCoord.z - 1 : tempCoord.z + 1; //escolhe +/- 1
            }
        }