Skip to content

Commit

Permalink
htdocs update
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondLightSource-build-server committed Mar 12, 2023
1 parent ade7ef3 commit bc3af58
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 62 deletions.
62 changes: 33 additions & 29 deletions _sources/iotbx/iotbx.pdb_tutorial.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ these steps::
if (len(args) == 0):
raise RuntimeError("Please specify one or more pdb file names.")
for file_name in args:
pdb_obj = iotbx.pdb.hierarchy.input(file_name=file_name)
pdb_obj.hierarchy.overall_counts().show()
pdb_obj = iotbx.pdb.input(file_name=file_name)
pdb_obj.construct_hierarchy().overall_counts().show()

if (__name__ == "__main__"):
run(sys.argv[1:])
Expand Down Expand Up @@ -104,8 +104,8 @@ us exactly where the error originates. This is often extremely helpful.

The meat of the script is in these two lines::

pdb_obj = iotbx.pdb.hierarchy.input(file_name=file_name)
pdb_obj.hierarchy.overall_counts().show()
pdb_obj = iotbx.pdb.input(file_name=file_name)
pdb_obj.construct_hierarchy().overall_counts().show()

The first line executes the two steps outline above. This is really
all we need, but the second line produces output that is useful to
Expand Down Expand Up @@ -206,22 +206,23 @@ as found in `v1_loop_over_atoms.py`_::
from __future__ import division
import iotbx.pdb
import sys

def run(args):
if (len(args) == 0):
raise RuntimeError("Please specify one or more pdb file names.")
for file_name in args:
pdb_obj = iotbx.pdb.hierarchy.input(file_name=file_name)
pdb_obj.hierarchy.overall_counts().show()
for model in pdb_obj.hierarchy.models():
pdb_obj = iotbx.pdb.input(file_name=file_name)
hierarchy = pdb_obj.construct_hierarchy()
hierarchy.overall_counts().show()
for model in hierarchy.models():
for chain in model.chains():
for rg in chain.residue_groups():
print 'resid: "%s"' % rg.resid()
for ag in rg.atom_groups():
print ' altloc: "%s", resname: "%s"' % (ag.altloc, ag.resname)
for atom in ag.atoms():
print ' ', atom.name

if (__name__ == "__main__"):
run(sys.argv[1:])

Expand Down Expand Up @@ -300,16 +301,17 @@ The complete source for this script::
import iotbx.pdb
import iotbx.pdb.amino_acid_codes
import sys

def run(args):
if (len(args) == 0):
raise RuntimeError("Please specify one or more pdb file names.")
aa_resnames = iotbx.pdb.amino_acid_codes.one_letter_given_three_letter
ala_atom_names = set([" N ", " CA ", " C ", " O ", " CB "])
for file_name in args:
pdb_obj = iotbx.pdb.hierarchy.input(file_name=file_name)
pdb_obj.hierarchy.overall_counts().show()
for model in pdb_obj.hierarchy.models():
pdb_obj = iotbx.pdb.input(file_name=file_name)
hierarchy = pdb_obj.construct_hierarchy()
hierarchy.overall_counts().show()
for model in hierarchy.models():
for chain in model.chains():
for rg in chain.residue_groups():
for ag in rg.atom_groups():
Expand All @@ -318,8 +320,8 @@ The complete source for this script::
if (atom.name not in ala_atom_names):
ag.remove_atom(atom=atom)
output_pdb = "v2_truncated_to_ala_"+file_name
pdb_obj.hierarchy.write_pdb_file(file_name=output_pdb)
hierarchy.write_pdb_file(file_name=output_pdb)

if (__name__ == "__main__"):
run(sys.argv[1:])

Expand Down Expand Up @@ -423,16 +425,17 @@ The complete source for this script::
import iotbx.pdb
import iotbx.pdb.amino_acid_codes
import sys

def run(args):
if (len(args) == 0):
raise RuntimeError("Please specify one or more pdb file names.")
aa_resnames = iotbx.pdb.amino_acid_codes.one_letter_given_three_letter
ala_atom_names = set([" N ", " CA ", " C ", " O ", " CB "])
for file_name in args:
pdb_obj = iotbx.pdb.hierarchy.input(file_name=file_name)
pdb_obj.hierarchy.overall_counts().show()
for model in pdb_obj.hierarchy.models():
pdb_obj = iotbx.pdb.input(file_name=file_name)
hierarchy = pdb_obj.construct_hierarchy()
hierarchy.overall_counts().show()
for model in hierarchy.models():
for chain in model.chains():
for rg in chain.residue_groups():
def have_amino_acid():
Expand All @@ -446,8 +449,8 @@ The complete source for this script::
if (atom.name not in ala_atom_names):
ag.remove_atom(atom=atom)
output_pdb = "v3_truncated_to_ala_"+file_name
pdb_obj.hierarchy.write_pdb_file(file_name=output_pdb)
hierarchy.write_pdb_file(file_name=output_pdb)

if (__name__ == "__main__"):
run(sys.argv[1:])

Expand Down Expand Up @@ -516,7 +519,7 @@ There are three more small enhancements compared to the
working directory, not the directory of the input file (which
may be in another user's directory or a system directory)

- ``iotbx.pdb.hierarchy.input`` is able to open `.gz` files
- ``iotbx.pdb.input`` is able to open `.gz` files
directly (e.g. compressed files as downloaded from the PDB).
However, the ``.write_pdb_file()`` method always writes plain
(non-compressed) files. Therefore the ``.gz`` extension has to be
Expand All @@ -535,19 +538,20 @@ Full source::
import iotbx.pdb
import iotbx.pdb.amino_acid_codes
import sys, os

def run(args):
if (len(args) == 0):
raise RuntimeError("Please specify one or more pdb file names.")
aa_resnames = iotbx.pdb.amino_acid_codes.one_letter_given_three_letter
ala_atom_names = set([" N ", " CA ", " C ", " O ", " CB "])
for file_name in args:
pdb_obj = iotbx.pdb.hierarchy.input(file_name=file_name)
pdb_obj.hierarchy.overall_counts().show()
pdb_obj = iotbx.pdb.input(file_name=file_name)
hierarchy = pdb_obj.construct_hierarchy()
hierarchy.overall_counts().show()
n_amino_acid_residues = 0
n_other_residues = 0
n_atoms_removed = 0
for model in pdb_obj.hierarchy.models():
for model in hierarchy.models():
for chain in model.chains():
for rg in chain.residue_groups():
def have_amino_acid():
Expand All @@ -571,12 +575,12 @@ Full source::
output_pdb = "v4_truncated_to_ala_"+os.path.basename(file_name)
if (output_pdb.endswith(".gz")): output_pdb = output_pdb[:-3]
print "Writing file:", output_pdb
pdb_obj.hierarchy.write_pdb_file(
hierarchy.write_pdb_file(
file_name=output_pdb,
crystal_symmetry=pdb_obj.input.crystal_symmetry(),
crystal_symmetry=pdb_obj.crystal_symmetry(),
append_end=True)
print

if (__name__ == "__main__"):
run(sys.argv[1:])

Expand Down
2 changes: 1 addition & 1 deletion cctbx/cctbx.command_line.precession_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ <h3>Navigation</h3>

<dl class="py function">
<dt class="sig sig-object py" id="cctbx.command_line.precession_view.run">
<span class="sig-prename descclassname"><span class="pre">cctbx.command_line.precession_view.</span></span><span class="sig-name descname"><span class="pre">run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out=&lt;colorama.ansitowin32.StreamWrapper</span> <span class="pre">object&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">silent=True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cctbx.command_line.precession_view.run" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">cctbx.command_line.precession_view.</span></span><span class="sig-name descname"><span class="pre">run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out=&lt;_io.TextIOWrapper</span> <span class="pre">name='&lt;stdout&gt;'</span> <span class="pre">mode='w'</span> <span class="pre">encoding='utf-8'&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">silent=True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cctbx.command_line.precession_view.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</section>
Expand Down
Loading

0 comments on commit bc3af58

Please sign in to comment.