Exemple #1
0
        public static void Run()
        {
            // get the primary structure
            Console.WriteLine("Parsing GRO File");

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            PrimaryStructure primaryStructure = GROStructureParser.GetStructure(inputFilePath + inputFileName);

            stopWatch.Stop();

            Console.WriteLine("Structure Parsing Complete [" + stopWatch.ElapsedMilliseconds + " ms]");

            // get the structure trajectory
            int atomCount = XTCTrajectoryParser.GetAtomCount(inputFilePath + trajectoryFileName);

            if (atomCount == primaryStructure.AtomCount())
            {
                Console.WriteLine("Atom Count matches.");
            }
            else
            {
                Console.WriteLine("Atom count doesnt match between primary structure and trajectory");
            }

            Stopwatch stopWatch2 = new Stopwatch();

            stopWatch2.Start();
            PrimaryStructureTrajectory trajectory = XTCTrajectoryParser.GetTrajectory(inputFilePath + trajectoryFileName, 0, 100, 1);

            stopWatch2.Stop();

            Console.WriteLine("Trajectory Parsing Complete [" + stopWatch2.ElapsedMilliseconds + " ms]");

            // get the secondary structure for the base primary structure

            Stopwatch stopWatch3 = new Stopwatch();

            stopWatch3.Start();
            SecondaryStructure secondaryStructure = SecondaryStructure.CreateFromPrimaryStructure(primaryStructure, strideExePath, tmpFilePath);

            Console.WriteLine("Main Secondary Structure Parsing Complete [" + stopWatch3.ElapsedMilliseconds + " ms]");

            Console.WriteLine(secondaryStructure);

            // get the secondary structure for a frame of the trajectory
            Stopwatch stopWatch4 = new Stopwatch();

            stopWatch4.Start();

            SecondaryStructureTrajectory secondaryStructureTrajectory = new SecondaryStructureTrajectory(primaryStructure, trajectory, strideExePath, tmpFilePath);
            SecondaryStructure           secondaryStructure2          = secondaryStructureTrajectory.GetStructure(50);

            Console.WriteLine("Secondary Structure Parsing for frame 50 Complete [" + stopWatch3.ElapsedMilliseconds + " ms]");

            Console.WriteLine(secondaryStructure2);
        }
Exemple #2
0
        // private static string inputFileFileName = @"lipoprotein_DS.pdb";
        //private static string inputFileFileName = @"lipoprotein.pdb";

        //private static string inputFilePath = @"D:\Molecule Examples\PDB Example Files\";
        //private static string inputFileFileName = @"Zika_Virus_5ire.pdb";

        public static void Run()
        {
            Console.WriteLine("Parsing PBD File");

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            // PrimaryStructure model = PDBStructureParser.GetStructure(inputFilePath + inputFileFileName);
            PrimaryStructure model = GROStructureParser.GetStructure(inputFilePath + inputFileFileName);

            stopWatch.Stop();

            Console.WriteLine("Structure Parsing Complete [" + stopWatch.ElapsedMilliseconds + " ms]");
            Console.WriteLine("Atom Count: " + model.Atoms().Count);

            // Console.WriteLine(model.ToString());

            foreach (Chain chain in model.Chains())
            {
                Console.WriteLine("Chain " + chain.ID + ": ");//  + residue.ToString());
                if (chain.ResidueType == StandardResidue.AminoAcid)
                {
                    foreach (Residue residue in chain.MainChainResidues)
                    {
                        Console.WriteLine(residue);
                    }
                    //foreach (Atom mainChainAtom in chain.Value.MainChainAtoms) {
                    //    Console.WriteLine(mainChainAtom);
                    //}
                }
                else
                {
                    Console.WriteLine("Chain " + chain.ID + " is not a protein chain");
                    //foreach (KeyValuePair<int, Residue> residue in chain.Value.Residues) {
                    //    Console.WriteLine(residue.Value.ResidueType.ToString());
                    //}
                }
            }
        }
Exemple #3
0
        public static void Run()
        {
            Console.WriteLine("Parsing GRO File");

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            PrimaryStructure primaryStructure = GROStructureParser.GetStructure(filepath + structureFile);

            stopWatch.Stop();

            Console.WriteLine("Structure Parsing Complete [" + stopWatch.ElapsedMilliseconds + " ms]");

            stopWatch.Reset();
            stopWatch.Start();
            SecondaryStructure secondaryStructure = SecondaryStructure.CreateFromPrimaryStructure(primaryStructure, strideExePath, tmpFilePath);

            Console.WriteLine("Main Secondary Structure Parsing Complete [" + stopWatch.ElapsedMilliseconds + " ms]");


            foreach (Chain chain in primaryStructure.Chains())
            {
                Console.WriteLine("\n---------------------\n");
                Console.WriteLine("Chain ID: " + chain.ID);
                Console.WriteLine("Chain Residue Count: " + chain.Residues.Count);
                foreach (Residue residue in chain.Residues)
                {
                    Console.WriteLine("Residue index: " + residue.Index + ", ResidueID: " + residue.ID + ", Residue Name: " + residue.Name);
                    SecondaryStructureInfomation information = secondaryStructure.GetStructureInformation(residue.Index);
                    if (information == null)
                    {
                        Console.WriteLine("information null: " + residue.Index);
                    }
                }
            }
        }
Exemple #4
0
        public static void ParseGromacs()
        {
            Console.WriteLine("Parsing GRO File");

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            PrimaryStructure model = GROStructureParser.GetStructure(filepath + structureFile);

            stopWatch.Stop();

            Console.WriteLine("Structure Parsing Complete [" + stopWatch.ElapsedMilliseconds + " ms]");
            Console.WriteLine("Atom Count: " + model.Atoms().Count);


            foreach (Atom atom in model.Atoms())
            {
                Console.WriteLine("Atom " + atom.Index + ": " + atom.ToString());
            }

            Console.WriteLine("\n---------------------\n");

            Dictionary <Element, Dictionary <int, Atom> > atomSet = model.GetAtomsByElement();

            foreach (KeyValuePair <Element, Dictionary <int, Atom> > set in atomSet)
            {
                Element element = set.Key;

                Console.WriteLine("Element: " + element.ToString());
                Dictionary <int, Atom> atoms = set.Value;

                foreach (KeyValuePair <int, Atom> atom in atoms)
                {
                    Console.WriteLine("Atom: " + atom.Value.ToString());
                }
            }

            foreach (Chain chain in model.Chains())
            {
                Console.WriteLine("\n---------------------\n");
                Console.WriteLine("Chain ID: " + chain.ID);
                Console.WriteLine("Chain Residue Count: " + chain.Residues.Count);
                foreach (Residue residue in chain.Residues)
                {
                    Console.WriteLine("ResidueID: " + residue.ID + ", Residue Name: " + residue.Name);
                }
            }


            stopWatch.Reset();
            stopWatch.Start();

            int NumberOfProcessorCores = 6;

            Dictionary <int, Bond> bonds = model.GenerateBonds(NumberOfProcessorCores);

            Console.WriteLine("Bond generation complete [" + stopWatch.ElapsedMilliseconds + " ms]");

            int count = 0;

            foreach (KeyValuePair <int, Bond> bond in bonds)
            {
                Atom atom1 = model.Atoms()[bond.Value.Atom1Index];
                Atom atom2 = model.Atoms()[bond.Value.Atom2Index];

                if ((atom1.Element == Element.O && atom2.Element == Element.H) ||
                    (atom2.Element == Element.O && atom1.Element == Element.H))
                {
                    Console.WriteLine("O-H bond found. Distance: " + Vector3.Distance(atom1.Position, atom2.Position));
                    count++;
                    if (count > 5)
                    {
                        break;
                    }
                }
            }

            Console.WriteLine("Getting frame count from trajectory file");

            stopWatch.Reset();
            stopWatch.Start();
            count = XTCTrajectoryParser.GetFrameCount(filepath + trajectoryFile);
            stopWatch.Stop();

            Console.WriteLine("Frame count complete [" + stopWatch.ElapsedMilliseconds + " ms]");
            Console.WriteLine("Frames counted: " + count);
        }