Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
User:Speleo3
(section)
User page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
User contributions
Logs
View user groups
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== load_mtz_cctbx: Load MTZ files with a [[CCTBX]] wrapper (3 files) === 1) ~/bin/mtz2ccp4.sh <source lang="bash"> #!/bin/bash export PATH=/opt/ccp4/ccp4-6.5/bin:$PATH exec cctbx.python ~/bin/mtz2ccp4.py "$@" </source> 2) ~/bin/mtz2ccp4.py <source lang="python"> #!/opt/ccp4/ccp4-6.5/bin/cctbx.python import os import sys import tempfile def mtz2ccp4maps(filename, prefix='map'): ''' Creates a temporary directory and dumps all maps from the given MTZ file into this directory as CCP4 maps files. Returns the path of the temporary directory. ''' from iotbx.reflection_file_reader import any_reflection_file hkl_in = any_reflection_file(file_name=filename) temp_dir = tempfile.mkdtemp() for i_map, array in enumerate(hkl_in.as_miller_arrays()): if array.is_complex_array(): fft_map = array.fft_map(resolution_factor=0.25).apply_sigma_scaling() map_filename = os.path.join(temp_dir, prefix + '_' + '_'.join(array.info().labels) + '.ccp4') fft_map.as_ccp4_map(file_name=map_filename) return temp_dir # print the name of the temporary directory to standard output print mtz2ccp4maps(*sys.argv[1:]) </source> 3) ~/.pymolrc.py <source lang="python"> @cmd.extend def load_mtz_cctbx(filename, prefix=''): ''' DESCRIPTION Load all maps from an MTZ file, using the mtz2ccp4.sh wrapper which uses iotbx (cctbx). ''' import subprocess import glob import shutil if not prefix: prefix = os.path.basename(filename).rpartition('.')[0] outdir = subprocess.Popen([os.path.expanduser('~/bin/mtz2ccp4.sh'), filename, prefix], stdout=subprocess.PIPE).stdout.readlines()[0].strip() for mapfilename in glob.glob(os.path.join(outdir, '*.ccp4')): cmd.load(mapfilename) shutil.rmtree(outdir) </source>
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
User:Speleo3
(section)
Add topic