hPDB 1.0 → 1.1
raw patch · 4 files changed
+57/−10 lines, 4 filesdep +Octree
Dependencies added: Octree
Files
- Bio/PDB/Structure/Elements.hs +6/−1
- Bio/PDB/Structure/Neighbours.hs +30/−0
- README.md +1/−1
- hPDB.cabal +20/−8
Bio/PDB/Structure/Elements.hs view
@@ -6,7 +6,9 @@ -- Guessing element name from atom name (for standard residues only.) guessElement, -- properties of elements- atomicNumber, atomicMass, covalentRadius, vanDerWaalsRadius) where+ atomicNumber, atomicMass,+ covalentRadius, maxCovalentRadius,+ vanDerWaalsRadius, maxVanDerWaalsRadius) where import Prelude hiding (error, String) import Data.ByteString.Char8 as BS@@ -251,6 +253,7 @@ covalentRadius "ZR" = 1.75 covalentRadius x = defaulting ["Unknown covalent radius for element:", BS.pack $ show x] 0.0 +maxCovalentRadius = covalentRadius "FR" {-# INLINE atomicMass #-} -- | Atomic mass of a given element in g/mol@@ -481,6 +484,8 @@ vanDerWaalsRadius "ZN" = 1.39 vanDerWaalsRadius "ZR" = 2.00 vanDerWaalsRadius e = defaulting ["Do not know van der Waals radius of", BS.pack $ show e] 0.0++maxVanDerWaalsRadius = vanDerWaalsRadius "K" {-# INLINE assignElement #-} -- | Given a PDB 'Atom' extract or guess its 'Element' name.
+ Bio/PDB/Structure/Neighbours.hs view
@@ -0,0 +1,30 @@+{-# LANGUAGE NoMonomorphismRestriction, FlexibleContexts #-}+-- | Searching for neighbouring atoms in a 3D space using `Octree`.+module Bio.PDB.Structure.Neighbours(makeOctree, findInRadius, findNearest)+where++import qualified Data.Octree as Oct+import Bio.PDB.Structure+import Bio.PDB.Iterable+import Data.Vector.V3++-- | Octree of `Atom`s.+type AtomOctree = Oct.Octree Atom++-- | Preparing atom to be inserted into `Octree`.+extract :: Atom -> (Oct.Vector3, Atom)+extract (at@(Atom { coord = cvec,+ atSerial = ser ,+ element = elt })) = (cvec, at)++-- | Make an Octree of `Atom`s+makeOctree :: Iterable a Atom => a -> AtomOctree+makeOctree = Oct.fromList . Prelude.map extract . itfoldr (:) []++-- | Find all `Atom`s within a given radius from a point.+findInRadius :: AtomOctree -> Double -> Vector3 -> [(Vector3, Atom)]+findInRadius = Oct.withinRange++-- | Find an `Atom`s closest to a point.+findNearest :: AtomOctree -> Vector3 -> Maybe (Vector3, Atom)+findNearest = Oct.nearest
README.md view
@@ -2,7 +2,7 @@ ==== Haskell PDB file format parser. -[](https://travis-ci.org/mgajda/hPDB)+[](https://travis-ci.org/BioHaskell/hPDB) Protein Data Bank file format is a most popular format for holding biomolecule data.
hPDB.cabal view
@@ -1,14 +1,26 @@ name: hPDB-version: 1.0+version: 1.1 synopsis: Protein Databank file format library-homepage: https://github.com/mgajda/hpdb+homepage: https://github.com/BioHaskell/hPDB stability: stable package-url: http://hackage.haskell.org/package/hPDB-description: Protein Data Bank file format is a most popular format for holding biomolecule data.+description: Protein Data Bank file format is a most popular format for holding biological macromolecular data. .- This is a very fast parser: below 7s for the largest entry in PDB - 1HTQ which is over 70MB - as compared with 11s of RASMOL 2.7.5, or 2m15s of BioPython with Python 2.6 interpreter.+ This is a very fast sequential parser: .- It is aimed to not only deliver event-based interface, but also a high-level data structure for manipulating data in spirit of BioPython's PDB parser. + * below 7s for the largest entry in PDB - 1HTQ which is over 70MB - as compared with + .+ * 11s of RASMOL 2.7.5,+ .+ * or 2m15s of BioPython with Python 2.6 interpreter.+ .+ In its parallel incarnation it is most probably the fastest parser for PDB format.+ .+ It is aimed to not only deliver event-based interface, but also a high-level data+ structure for manipulating data in spirit of BioPython's PDB parser. + .+ <http://dx.doi.org/10.1186/1756-0500-6-483 hPDB - Haskell library for processing atomic biomolecular structures in Protein Data Bank format - Michal Jan Gajda. BMC Research Notes 2013, 6:483.>+ category: Bioinformatics license: BSD3 license-file: LICENSE@@ -25,7 +37,7 @@ source-repository head type: git- location: https://github.com/mgajda/hPDB+ location: https://github.com/BioHaskell/hPDB flag have-mmap description: Use mmap to read input faster.@@ -65,7 +77,7 @@ Library ghc-options: -fspec-constr-count=4 -O3 - build-depends: base>=4.0, base <4.8, ghc-prim, directory, mtl, template-haskell, vector, AC-Vector, containers, deepseq, QuickCheck >= 2.5.0.0, text>=0.11.1.13, iterable >= 2.0, parallel >= 3.0.0.0, bytestring, zlib+ build-depends: base>=4.0, base <4.8, ghc-prim, directory, mtl, template-haskell, vector, AC-Vector, containers, deepseq, QuickCheck >= 2.5.0.0, text>=0.11.1.13, iterable >= 2.0, parallel >= 3.0.0.0, bytestring, zlib, Octree>= 0.5 if flag(have-sse2) ghc-options: -msse2 if flag(have-mmap)@@ -78,6 +90,6 @@ build-depends: text-format >= 0.3.1.0 other-extensions: ScopedTypeVariables OverloadedStrings BangPatterns NoMonomorphismRestriction EmptyDataDecls MagicHash CPP PatternGuards NamedFieldPuns DisambiguateRecordFields TemplateHaskell MultiParamTypeClasses FlexibleInstances FlexibleContexts other-modules: Bio.PDB.EventParser.ParseATOM, Bio.PDB.EventParser.ParseCAVEAT, Bio.PDB.EventParser.ParseCISPEP, Bio.PDB.EventParser.ParseCONECT, Bio.PDB.EventParser.ParseCRYST1, Bio.PDB.EventParser.ParseDBREF, Bio.PDB.EventParser.ParseFORMUL, Bio.PDB.EventParser.ParseHEADER, Bio.PDB.EventParser.ParseHELIX, Bio.PDB.EventParser.ParseHET, Bio.PDB.EventParser.ParseHETNAM, Bio.PDB.EventParser.ParseHYDBND, Bio.PDB.EventParser.ParseIntRecord, Bio.PDB.EventParser.ParseJRNL, Bio.PDB.EventParser.ParseLINK, Bio.PDB.EventParser.ParseListRecord, Bio.PDB.EventParser.ParseMASTER, Bio.PDB.EventParser.ParseMatrixRecord, Bio.PDB.EventParser.ParseMODRES, Bio.PDB.EventParser.ParseObsoleting, Bio.PDB.EventParser.ParseREMARK, Bio.PDB.EventParser.ParseREVDAT, Bio.PDB.EventParser.ParseSEQADV, Bio.PDB.EventParser.ParseSEQRES, Bio.PDB.EventParser.ParseSHEET, Bio.PDB.EventParser.ParseSITE, Bio.PDB.EventParser.ParseSLTBRG, Bio.PDB.EventParser.ParseSpecListRecord, Bio.PDB.EventParser.ParseSPLIT, Bio.PDB.EventParser.ParseSSBOND, Bio.PDB.EventParser.ParseTER, Bio.PDB.EventParser.ParseTITLE, Bio.PDB.EventParser.ParseTVECT, Bio.PDB.EventParser.PDBParsingAbstractions, Bio.PDB.EventParser.FastParse, Bio.PDB.Util.MissingInstances, Bio.PDB.Common, Bio.PDB.Iterable.Utils, Bio.PDB.Iterable.Instances, Bio.PDB.StructureBuilder.Internals, Bio.PDB.StructureBuilder.Parallel- exposed-modules: Bio.PDB.EventParser.PDBEvents, Bio.PDB.EventParser.PDBEventParser, Bio.PDB.EventParser.ExperimentalMethods, Bio.PDB.EventParser.HelixTypes, Bio.PDB.EventParser.StrandSense, Bio.PDB.Structure, Bio.PDB.StructureBuilder, Bio.PDB.Iterable, Bio.PDB.IO, Bio.PDB.Fasta, Bio.PDB, Bio.PDB.Structure.Vector, Bio.PDB.Structure.Elements, Bio.PDB.Structure.List, Bio.PDB.StructurePrinter, Bio.PDB.EventParser.PDBEventPrinter, Bio.PDB.IO.OpenAnyFile+ exposed-modules: Bio.PDB.EventParser.PDBEvents, Bio.PDB.EventParser.PDBEventParser, Bio.PDB.EventParser.ExperimentalMethods, Bio.PDB.EventParser.HelixTypes, Bio.PDB.EventParser.StrandSense, Bio.PDB.Structure, Bio.PDB.StructureBuilder, Bio.PDB.Iterable, Bio.PDB.IO, Bio.PDB.Fasta, Bio.PDB, Bio.PDB.Structure.Vector, Bio.PDB.Structure.Elements, Bio.PDB.Structure.List, Bio.PDB.StructurePrinter, Bio.PDB.EventParser.PDBEventPrinter, Bio.PDB.IO.OpenAnyFile, Bio.PDB.Structure.Neighbours exposed: True