diff --git a/README.rst b/README.rst index 5fd69f60..451aa09d 100644 --- a/README.rst +++ b/README.rst @@ -76,6 +76,17 @@ The ``Xyz.comment`` property, which describes the file, and a ``Xyz.model`` property, which returns the ``Model`` the file describes. +From .pdb +~~~~~~~~~ + +A .pdb can also be loaded from a file, but they can also be fetched directly +from the RCSB over the internet using the PDB code: + + >>> pdb = atomium.pdb_from_file("1LOL.pdb") + >>> pdb2 = atomium.fetch("5HVD") + >>> pdb2.model() + + The Model ~~~~~~~~~ @@ -141,6 +152,8 @@ Atoms can be bonded to one another using the ``Atom.bond`` method: {""} >>> atom.bonded_atoms() {} + >>> atom.bond_with(other_atom) + >>> atom.unbond(other_atom) >>> atom.bonds() {} @@ -148,22 +161,124 @@ Atoms can be bonded to one another using the ``Atom.bond`` method: {} +Sub-Structures +~~~~~~~~~~~~~~ + +Molecules +######### + +PDB files contain descriptions of the various molecular units within the model. +The simplest way to access these is to get the ``Molecule`` objects in +the model: + + >>> pdb.model().molecules(water=False) + {, , , , , < + Chain (214 residues)>} + >>> pdb.model().molecules(water=False, generic=True) + {, , , } + +In the first case all molecules (excluding water molecules) are returned - these +include generic ``Molecule`` objects, used to represent the small +molecules in the PDB, and also ``Chain`` objects, which are the main +macromolecular unit of the PDB. + +Other criteria can be used: + + >>> pdb.model().molecules(name="XMP") + {, } + >>> pdb.model().molecule(name="XMP") + + >>> pdb.model().molecule("B5002") + + +Here, all XMP molecules are returned, then the first matching XMP molecule, then +the molecule with ID 'B5002'. + +Chains +###### + +You can specifically get chains in much the same way: + + >>> pdb.model().chains() + {, } + >>> pdb.model().chain("A") + + >>> pdb.model().chain("B") + + +A ``Chain`` is a useful object in its own right: + + >>> pdb.model().chain("A").length() + 204 + +Residues +######## + +Both models and chains are ``ResidueStructure`` objects, which allows +you to access their ``Residue`` objects: + + >>> pdb.model().residues(name="SER") + {, , , , , , , , , , , , , , , , , } + >>> pdb.model().residue("A23") + + +Residues are also a kind of Molecule, and have other useful properties: + + >>> pdb.model().residue("A23").name() + 'ASN' + >>> pdb.model().residue("A23").chain() + + >>> pdb.model().residue("A23").next() + + >>> pdb.model().residue("A23").previous() + + + Saving ~~~~~~ A model can be saved to file using: >>> model.save("new.xyz", description="Modifed glucose") + >>> model.save("new.pdb") + +Any structure can be saved in this way, so you can save chains or molecules to +their own seperate files if you so wish. -The ``Xyz`` object itself can also be saved: + >>> model.chain("A").save("chainA.pdb") + >>> model.chain("B").save("chainB.pdb") + >>> model.molecule(name="XMP").save("ligand.xyz") + +The ``Xyz`` or ``Pdb`` object itself can also be saved: >>> glucose.comment("Modified glucose") >>> glucose.save("new.xyz") + >>> pdb.save("new.pdb") Changelog --------- +Release 0.4.0 +~~~~~~~~~~~~~ + +`26 August 2017` + +* Added PDB parsing. +* Added PDB saving. +* Gave atoms ability to get specific bond with other atom. +* Added bond angle calculation. +* Added ability to filter out water molecules. + Release 0.3.0 ~~~~~~~~~~~~~ diff --git a/docs/source/index.rst b/docs/source/index.rst index 32a80ac3..2b63ee8e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,13 +7,11 @@ Example ------- >>> import atomium - >>> glucose = atomium.xyz_from_file("glucose.xyz") - >>> glucose.comment() - 'glucose from 2gbp' - >>> glucose.model() - - >>> glucose.model().mass() - 168.0606 + >>> pdb = atomium.fetch("5HVD") + >>> pdb.model() + + >>> pdb.model().chain("A") +