Пример #1
0
        public static Atom add(Atom a, Atom b)
        {
            Atom c = new Atom();
                c.setX(a.getX() + b.getX());
                c.setY(a.getY() + b.getY());
                c.setZ(a.getZ() + b.getZ());

                return c;
        }
Пример #2
0
        public static Atom vectorProduct(Atom a, Atom b)
        {
            Atom c = new Atom();

            c.setX(a.getY() * b.getZ() - a.getZ() * b.getY());
            c.setY(a.getZ() * b.getX() - a.getX() * b.getZ());
            c.setZ(a.getX() * b.getY() - a.getY() * b.getX());
            return(c);
        }
Пример #3
0
        public static Atom subtract(Atom a, Atom b)
        {
            Atom c = new Atom();

            c.setX(a.getX() - b.getX());
            c.setY(a.getY() - b.getY());
            c.setZ(a.getZ() - b.getZ());

            return(c);
        }
Пример #4
0
        public static Atom add(Atom a, Atom b)
        {
            Atom c = new Atom();

            c.setX(a.getX() + b.getX());
            c.setY(a.getY() + b.getY());
            c.setZ(a.getZ() + b.getZ());

            return(c);
        }
Пример #5
0
 public static Atom vectorProduct(Atom a, Atom b)
 {
     Atom c = new Atom();
         c.setX(a.getY() * b.getZ() - a.getZ() * b.getY());
         c.setY(a.getZ() * b.getX() - a.getX() * b.getZ());
         c.setZ(a.getX() * b.getY() - a.getY() * b.getX());
         return c;
 }
Пример #6
0
        public static Atom subtract(Atom a, Atom b)
        {
            Atom c = new Atom();
                c.setX(a.getX() - b.getX());
                c.setY(a.getY() - b.getY());
                c.setZ(a.getZ() - b.getZ());

                return c;
        }
Пример #7
0
        private Structure loadStructure(string fileName)
        {
            Structure structure = new Structure();
            int       l         = fileName.Length;

            structure.PDBCode = fileName.Substring(l - 8, 4);
            bool         flag = false;
            string       line = "";
            StreamReader file = new StreamReader(fileName);
            Group        g    = new Group();
            AminoAcid    aa   = new AminoAcid();

            while ((line = file.ReadLine()) != null)
            {
                if (line.StartsWith("ATOM"))
                {
                    try{
                        if (flag)
                        {
                            g.groupID = (line.ElementAt(21) - 65);
                            aa.aaID   = Convert.ToInt16(line.Substring(22, 4).Trim()); flag = false;
                        }
                        if (aa.aaID != (Convert.ToInt16(line.Substring(22, 4).Trim())))
                        {
                            g.AA.Add(aa);
                            aa      = new AminoAcid();
                            aa.aaID = Convert.ToInt16(line.Substring(22, 4).Trim());
                        }
                        if (g.groupID != (line.ElementAt(21) - 65))
                        {
                            structure.Groups.Add(g);
                            g         = new Group();
                            g.groupID = (line.ElementAt(21) - 65);
                        }
                        Atom ob = new Atom();

                        ob.setX(Convert.ToDouble(line.Substring(30, 8).Trim()));
                        ob.setY(Convert.ToDouble(line.Substring(38, 8).Trim()));
                        ob.setZ(Convert.ToDouble(line.Substring(46, 8).Trim()));
                        ob.Name = line.Substring(12, 3).Trim();
                        if (ob.Name.Equals("N"))
                        {
                            aa.setN(ob);
                        }
                        else if (ob.Name.Equals("CA"))
                        {
                            aa.setCA(ob);
                        }
                        else if (ob.Name.Equals("CB"))
                        {
                            aa.setCB(ob);
                        }
                        else if (ob.Name.Equals("O"))
                        {
                            aa.setO(ob);
                        }
                        else if (ob.Name.Equals("C"))
                        {
                            aa.setC(ob);
                        }
                    }
                    catch (Exception) { }
                }
            }
            g.AA.Add(aa); structure.Groups.Add(g);

            file.Close();
            count++;
            return(structure);
        }
Пример #8
0
        private Structure loadStructure(string fileName)
        {
            Structure structure = new Structure();
            int l = fileName.Length;
            structure.PDBCode = fileName.Substring(l-8,4);
                bool flag = false;
                string line = "";
                StreamReader file = new StreamReader(fileName);
                Group g = new Group();
                AminoAcid aa = new AminoAcid();
            while ((line = file.ReadLine()) != null)
            {

                if (line.StartsWith("ATOM"))
                {
                    try{
                        if (flag)
                    {
                        g.groupID = (line.ElementAt(21) - 65);
                        aa.aaID = Convert.ToInt16(line.Substring(22, 4).Trim()); flag = false;
                    }
                    if (aa.aaID != (Convert.ToInt16(line.Substring(22, 4).Trim())))
                    {
                        g.AA.Add(aa);
                        aa = new AminoAcid();
                        aa.aaID = Convert.ToInt16(line.Substring(22, 4).Trim());
                    }
                    if (g.groupID != (line.ElementAt(21) - 65))
                    {
                        structure.Groups.Add(g);
                        g = new Group();
                        g.groupID = (line.ElementAt(21) - 65);
                    }
                    Atom ob = new Atom();

                        ob.setX(Convert.ToDouble(line.Substring(30, 8).Trim()));
                        ob.setY(Convert.ToDouble(line.Substring(38, 8).Trim()));
                        ob.setZ(Convert.ToDouble(line.Substring(46, 8).Trim()));
                        ob.Name = line.Substring(12, 3).Trim();
                        if (ob.Name.Equals("N")) aa.setN(ob);
                        else if (ob.Name.Equals("CA")) aa.setCA(ob);
                        else if (ob.Name.Equals("CB")) aa.setCB(ob);
                        else if (ob.Name.Equals("O")) aa.setO(ob);
                        else if (ob.Name.Equals("C")) aa.setC(ob);
                    }
                    catch (Exception) { }
                }
            }
                    g.AA.Add(aa); structure.Groups.Add(g);

                file.Close();
                count++;
            return structure;
        }