// Parses through all pdb-file's lines void Parse(IEnumerable<string> pdbLines) { foreach (string pdbLine in pdbLines) { if (pdbLine.StartsWith("REMARK")) continue; if (pdbLine.StartsWith("ATOM")) { ParseAtom(pdbLine); } else if (pdbLine.StartsWith("HETATM")) { ParseHetAtom(pdbLine); } else if (pdbLine.StartsWith("HELIX")) { ParseHelix(pdbLine); } else if (pdbLine.StartsWith("SHEET")) { ParseSheet(pdbLine); } else if (pdbLine.StartsWith("ENDMDL") || pdbLine.StartsWith("END")) { Molecule molecule = new Molecule(); molecule.Atoms.AddRange(atoms); molecule.Chains.AddRange(chains.Values); molecule.CalculateBonds(); molecules.Add(molecule); atoms.Clear(); chains.Clear(); } } }