IMP-users
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
July 2014
- 4 participants
- 13 discussions
Dear all,
when compiling IMP 2.2.0 (on CentOS 5), `make` exits with the following
errors:
imp-2.2.0 > make
Scanning dependencies of target IMP-containers
[ 0%] Built target IMP-containers
Scanning dependencies of target IMP-version
[ 0%] Computing version number
[ 0%] Built target IMP-version
Scanning dependencies of target IMP.base-version
[ 0%] Building module version info
[ 0%] Built target IMP.base-version
Scanning dependencies of target IMP.base-all-header
[ 0%] Built target IMP.base-all-header
Scanning dependencies of target IMP.base-lib
[ 0%] Building CXX object
modules/base/src/CMakeFiles/IMP.base-lib.dir/__/__/__/src/base/paths.cpp.o
[ 0%] Building CXX object
modules/base/src/CMakeFiles/IMP.base-lib.dir/__/__/__/src/base_all.cpp.o
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/statistics.cpp:
In function 'void IMP::base::show_timings(IMP::base::TextOutput)':
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/statistics.cpp:31:
error: a function-definition is not allowed here before ':' token
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected primary-expression at end of input
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected `;' at end of input
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected primary-expression at end of input
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected `)' at end of input
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected statement at end of input
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected `}' at end of input
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:
At global scope:
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected `}' at end of input
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/base/src/utility.cpp:36:
error: expected `}' at end of input
make[2]: ***
[modules/base/src/CMakeFiles/IMP.base-lib.dir/__/__/__/src/base_all.cpp.o]
Error 1
make[1]: *** [modules/base/src/CMakeFiles/IMP.base-lib.dir/all] Error 2
make: *** [all] Error 2
imp-2.2.0 >
The previous `cmake` had run sccessfully (not all modules were found,
though). You can find the complete `cmake` output at the end of this post.
Any idea how this problem can be tracked down?
Frank
---------------------------- cmake ----------------------------
imp-2.2.0 > /g/software/bin/cmake-3.0.0 ../imp-2.2.0
-DCMAKE_INSTALL_PREFIX=/g/software/linux/pack/imp-2.2.0 \
?
-DBoost_INCLUDE_DIR=/g/software/linux/pack/boost-1.46.0/include \
?
-DBoost_LIBRARY_DIRS=/g/software/linux/pack/boost-1.46.0/lib
-- The C compiler identification is GNU 4.1.2
-- The CXX compiler identification is GNU 4.1.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Running check_common_problems
-- Running clean_build_dir
-- Running setup_cmake
-- GCC version: 4.1.2
-- GCC version: 4.1.2
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named etree.ElementTree
-- Python xml.etree not found, docs disabled.
-- Python version is 2.4
-- Found PythonLibs: /usr/lib64/libpython2.4.so (found suitable exact
version "2.4.3")
-- Running setup
-- Running setup_all
-- Running making containers
-- Running setup_module_alias for compatibility
-- Setting up alias for module base as compatibility
-- Running setup_module_alias for kernel
-- Setting up alias for module kernel as
-- Boost version: 1.46.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- program_options
-- Performing Test IMP_COMPILER_HAS_AUTO
-- Performing Test IMP_COMPILER_HAS_AUTO - Failed
-- Performing Test IMP_COMPILER_HAS_DEBUG_VECTOR
-- Performing Test IMP_COMPILER_HAS_DEBUG_VECTOR - Success
GPerfTools not found
Log4CXX not found
TCMalloc_HeapChecker not found
TCMalloc_HeapProfiler not found
-- Running generate paths.cpp
Configuring module base ... yes
-- Running setup_swig_wrappers base
-- Running IMP.base making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/base.h
Configuring module benchmark ... yes
-- Running setup_swig_wrappers benchmark
-- Running IMP.benchmark making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/benchmark.h
-- CGAL not found. Set the CGAL_DIR cmake variable or environment
variable to the directory containing CGALConfig.cmake. This is either
the binary directory where CGAL was configured or PREFIX/lib/CGAL for an
installation.
Configuring module cgal ... CGAL not found
Different data/build_info/sorted_modules
-cgal
Module IMP.cgal disabled
Configuring module kmeans ... yes
-- Running setup_swig_wrappers kmeans
-- Running IMP.kmeans making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/kmeans.h
Configuring module module_template ... yes
-- Running setup_swig_wrappers module_template
-- Running IMP.module_template making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/module_template.h
-- Could NOT find MPI_C (missing: MPI_C_LIBRARIES MPI_C_INCLUDE_PATH)
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIBRARIES
MPI_CXX_INCLUDE_PATH)
-- MPI not found
Configuring module mpi ... MPI not found
Different data/build_info/sorted_modules
-mpi
Module IMP.mpi disabled
Configuring module test ... yes
-- Running setup_swig_wrappers test
-- Running IMP.test making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/test.h
ANN not found
Configuring module algebra ... yes
-- Running setup_swig_wrappers algebra
-- Running IMP.algebra making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/algebra.h
Configuring module kernel ... yes
-- Running setup_swig_wrappers kernel
-- Running IMP.kernel making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/kernel.h
Configuring module display ... yes
-- Running setup_swig_wrappers display
-- Running IMP.display making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/display.h
-- Found GSL
-- Performing Test GSL_found
-- Performing Test GSL_found - Success
-- Found GSL
Configuring module gsl ... yes
-- Running setup_swig_wrappers gsl
-- Running IMP.gsl making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/gsl.h
Configuring module parallel ... yes
-- Running setup_swig_wrappers parallel
-- Running IMP.parallel making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/parallel.h
-- Found HDF5
-- Performing Test HDF5_found
-- Performing Test HDF5_found - Success
-- Found HDF5
Configuring module score_functor ... yes
-- Running setup_swig_wrappers score_functor
-- Running IMP.score_functor making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/score_functor.h
Configuring module statistics ... yes
-- Running setup_swig_wrappers statistics
-- Running IMP.statistics making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/statistics.h
Configuring module core ... yes
-- Running setup_swig_wrappers core
-- Running IMP.core making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/core.h
Configuring module container ... yes
-- Running setup_swig_wrappers container
-- Running IMP.container making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/container.h
Configuring module modeller ... yes
-- Running setup_swig_wrappers modeller
-- Running IMP.modeller making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/modeller.h
Configuring module symmetry ... yes
-- Running setup_swig_wrappers symmetry
-- Running IMP.symmetry making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/symmetry.h
Configuring module atom ... yes
-- Running setup_swig_wrappers atom
-- Running IMP.atom making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/atom.h
Configuring module scratch ... yes
-- Running setup_swig_wrappers scratch
-- Running IMP.scratch making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/scratch.h
Configuring module em ... yes
-- Running setup_swig_wrappers em
-- Running IMP.em making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/em.h
Configuring module kinematics ... yes
-- Running setup_swig_wrappers kinematics
-- Running IMP.kinematics making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/kinematics.h
Configuring module misc ... yes
-- Running setup_swig_wrappers misc
-- Running IMP.misc making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/misc.h
-- Performing Test RMF_environment
-- Performing Test RMF_environment - Failed
-- Building internal RMF
-- Boost version: 1.46.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- program_options
-- iostreams
-- Found HDF5:
/g/software/linux/pack/hdf5-1.8.4/lib/libhdf5.so;/g/software/linux/pack/hdf5-1.8.4/lib/libhdf5.so;/g/software/linux/pack/hdf5-1.8.4/lib/libhdf5.so;/g/software/linux/pack/szlib-2.1/lib/libsz.so;/usr/lib64/libz.so;/usr/lib64/libm.so
-- Deprecated backends (and hdf5) are enabled
-- GCC version: 4.1.2
-- GCC version: 4.1.2
-- Running Making RMF/HDF5.h
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/src/dependency/RMF/include/RMF/HDF5.h
-- Running Making RMF.h
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/src/dependency/RMF/include/RMF.h
-- Running setup_cmake.py
-- Running Running setup_cmake.py
-- Logging disabled
-- Using VMD headers found in
/g/software/linux/pack/imp-2.2.0/SRC/imp-2.2.0/modules/rmf/dependency/RMF_source/plugins/vmd/include
-- Found SWIG: swig (found version "1.3.29")
-- /usr/include/python2.4
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named etree.ElementTree
-- Python xml.etree not found, docs disabled.
-- RMF doc disabled
Configuring module rmf ... yes
-- Running setup_swig_wrappers rmf
-- Running IMP.rmf making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/rmf.h
Configuring module rotamer ... yes
-- Running setup_swig_wrappers rotamer
-- Running IMP.rotamer making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/rotamer.h
Configuring module saxs ... yes
-- Running setup_swig_wrappers saxs
-- Running IMP.saxs making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/saxs.h
-- Found HDF5
-- Found HDF5
Configuring module domino ... yes
-- Running setup_swig_wrappers domino
-- Running IMP.domino making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/domino.h
Configuring module isd ... yes
-- Running setup_swig_wrappers isd
-- Running IMP.isd making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/isd.h
-- Found FFTW3
-- Performing Test FFTW3_found
-- Performing Test FFTW3_found - Success
-- Found FFTW3
OpenCV21 not found
OpenCV22 not found
em2d is disabled
Different data/build_info/sorted_modules
-em2d
Module IMP.em2d disabled
ExampleDependency not found
Configuring module example ... yes
-- Running setup_swig_wrappers example
-- Running IMP.example making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/example.h
-- Found FFTW3
-- Found FFTW3
Configuring module multifit ... yes
-- Running setup_swig_wrappers multifit
-- Running IMP.multifit making all header
-- Updating
/g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/multifit.h
Configuring module pepdock ... yes
-- Running setup_swig_wrappers pepdock
-- Running IMP.pepdock making all header
-- Updating /g/software/linux/pack/imp-2.2.0/SRC/build/include/IMP/pepdock.h
libTau not found
Configuring module cnmultifit ... libTau not found
Different data/build_info/sorted_modules
-cnmultifit
Module IMP.cnmultifit disabled
-- Running setup_swig_dependencies
Configuring application EMageFit ... no
Different data/build_info/applications
-EMageFit
Application EMageFit disabled
Configuring application cnmultifit_tools ... no
Different data/build_info/applications
-cnmultifit_tools
Application cnmultifit_tools disabled
Configuring application em_tools ... yes
Configuring application example_app ... yes
Configuring application foxs ... yes
Configuring application integrative_docking ... yes
Configuring application ligand_score ... yes
Configuring application multifit_tools ... yes
Configuring application pdb_tools ... yes
Configuring application rmf_tools ... yes
Configuring application saxs_merge ... yes
Configuring application saxs_tools ... yes
-- Running setup_imppy
-- Documentation disabled as doxygen not found
-- Configuring done
-- Generating done
-- Build files have been written to:
/g/software/linux/pack/imp-2.2.0/SRC/build
imp-2.2.0 >
2
8
IMP 2.2.0 building (cmake): How to add dependencies in non-standard locations?
by Frank Thommen 31 Jul '14
by Frank Thommen 31 Jul '14
31 Jul '14
Hi,
as usual when it comes to cmake I'm running into troubles, as many of
our packages are installed in non-standard locations and I don't seem to
be able to configure cmake correctly for those dependencies.
For Boost I succeeded by using
-DBoost_INCLUDE_DIR=/g/software/linux/pack/boost-1.46.0/include
-DBoost_LIBRARY_DIRS=/g/software/linux/pack/boost-1.46.0/lib
to `cmake`. But e.g. for HDF5 this doesn't seem to work. I get this in
the output of `cmake`:
-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
-- Deprecated backends (and hdf5) are disabled
Therefore I tried setting environment the variables $HDF5_LIBRARIES and
$DF5_INCLUDE_DIRS to correct values and I also tried with the `cmake`
options
-DHDF5_LIBRARIES=/g/software/linux/pack/hdf5-1.8.4/lib
-DHDF5_INCLUDE_DIRS=/g/software/linux/pack/hdf5-1.8.4/include
None of the two worked. HDF5 is still not found.
How can I set the correct paths for external libraries? Specifically
for HDF5, SWIG and FFTW3? Yes, I tried to find this through Google but
didn't find a general solution.
Locally installing the prerequisites is not an option, as this will be a
shared installation, used by many workstations.
Thanks in advance
Frank
2
3
ah i see, yes i had no movers or optimizers ...
so now i'm trying to set up a RigidBodyMover but i'm struggling to create
the rigid bodies. There seem to be two different ways of doing this, either
IMP.atom.create_rigid_body or IMP.atom.setup_as_rigid_body.
If I use create_rigid_body then when i later try to add restraints i get
told "leaf 'A' ... does not have mass"
If I use setup_as_rigid_body i can add the restraints but i when i try to
add it to the RigidBodyMover i get told "Rigid body passed to
RigidBodyMover must be set to be optimized" even
though rb.set_coordinates_are_optimized(True)
what is the function of choice here ?
thanks !
josh
------------------------------
def create_representation():
m= IMP.Model()
all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
all.set_name("the universe")
# create a protein, represented as a set of connected balls of
appropriate
# radii and number, chose by the resolution parameter and the number of
# amino acids.
def create_protein_from_pdbs(name, files):
def create_from_pdb(file):
sls=IMP.SetLogState(IMP.NONE)
datadir = os.getcwd()
print datadir
t=IMP.atom.read_pdb( datadir+'/' + file, m,
IMP.atom.ATOMPDBSelector())
del sls
#IMP.atom.show_molecular_hierarchy(t)
c=IMP.atom.Chain(IMP.atom.get_by_type(t,
IMP.atom.CHAIN_TYPE)[0])
# there is no reason to use all atoms, just approximate the pdb
shape instead
s=IMP.atom.create_simplified_along_backbone(c,1)
# make the simplified structure rigid
rb=IMP.atom.create_rigid_body(s)
#rb=IMP.atom.setup_as_rigid_body(s)
#rb=IMP.atom.create_rigid_body(c)
rb.set_coordinates_are_optimized(True)
print rb.get_coordinates_are_optimized()
return rb
h= create_from_pdb(files[0])
h.set_name(name)
all.add_child(h)
create_protein_from_pdbs("A", [Firstpdb])
(m,all)= create_representation()
On 11 July 2014 19:42, <imp-users-request(a)salilab.org> wrote:
> Send IMP-users mailing list submissions to
> imp-users(a)salilab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://salilab.org/mailman/listinfo/imp-users
> or, via email, send a message with subject or body 'help' to
> imp-users-request(a)salilab.org
>
> You can reach the person managing the list at
> imp-users-owner(a)salilab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IMP-users digest..."
>
>
> Today's Topics:
>
> 1. getting the MCCGsampler to work (Josh Bullock)
> 2. Re: getting the MCCGsampler to work (Ben Webb)
> 3. Re: getting the MCCGsampler to work (Ben Webb)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 11 Jul 2014 13:12:01 +0100
> From: Josh Bullock <jma.bullock(a)gmail.com>
> To: imp-users(a)salilab.org
> Subject: [IMP-users] getting the MCCGsampler to work
> Message-ID:
> <
> CAHh_40_B9Ciag3LMdDMgFLJf2MCx2-tGPp3tmMke9MQriHwMJA(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hello again,
>
> So I have the same overall problem as before - creating an ensemble of a
> 4-subunit complex using MSconnectivity restraints. Having visualised the
> output (via RMF - thanks Barak :?) , it's clear that no matter how many
> steps of CG or MC I put, the models do not change from their initial random
> placement. I know that the restraints are present because the models are
> evaluated and scored appropriately.
>
> So I saw on an old (2011) nup84 example that MCCG can't handle rigid
> bodies, is this still the case ? If so, should I switch to the DOMINO
> sampler ? or it does work and likely there's an error in my code ...
>
> Many thanks !
>
> Josh
>
> -------------------------------------------------
>
> import IMP
> import IMP.atom
> import IMP.rmf
> import inspect
> import IMP.container
> import IMP.display
> import IMP.statistics
> #import IMP.example
> import sys, math, os, optparse
> import RMF
>
> from optparse import OptionParser
>
>
> # Convert the arguments into strings and number
> Firstpdb = str(sys.argv[1])
> Secondpdb = str(sys.argv[2])
> Thirdpdb = str(sys.argv[3])
> Fourthpdb = str(sys.argv[4])
> models = float(sys.argv[5])
>
> #*****************************************
>
> # the spring constant to use, it doesnt really matter
> k=100
> # the target resolution for the representation, this is used to specify how
> detailed
> # the representation used should be
> resolution=300
> # the box to perform everything
> bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
> IMP.algebra.Vector3D(100, 100, 100))
>
>
> # this function creates the molecular hierarchies for the various involved
> proteins
> def create_representation():
> m= IMP.Model()
> all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> all.set_name("the universe")
> # create a protein, represented as a set of connected balls of
> appropriate
> # radii and number, chose by the resolution parameter and the number of
> # amino acids.
>
> def create_protein_from_pdbs(name, files):
>
> def create_from_pdb(file):
> sls=IMP.SetLogState(IMP.NONE)
> datadir = os.getcwd()
> print datadir
> t=IMP.atom.read_pdb( datadir+'/' + file, m,
> IMP.atom.ATOMPDBSelector())
> del sls
> #IMP.atom.show_molecular_hierarchy(t)
> c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> IMP.atom.CHAIN_TYPE)[0])
> if c.get_number_of_children()==0:
> IMP.atom.show_molecular_hierarchy(t)
> # there is no reason to use all atoms, just approximate the pdb
> shape instead
> s=IMP.atom.create_simplified_along_backbone(c,
> 1)
> #IMP.atom.destroy(t)
> # make the simplified structure rigid
> rb=IMP.atom.create_rigid_body(s)
> rb=IMP.atom.create_rigid_body(c)
> rb.set_coordinates_are_optimized(True)
> return s # <------- swapping c with s will give a coarse
> grain representation - much faster !
> # return c
>
> h= create_from_pdb(files[0])
> h.set_name(name)
> all.add_child(h)
>
> create_protein_from_pdbs("A", [Firstpdb])
> create_protein_from_pdbs("B", [Secondpdb])
> create_protein_from_pdbs("C", [Thirdpdb])
> create_protein_from_pdbs("D", [Fourthpdb])
> #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
> return (m, all)
>
> # create the needed restraints and add them to the model
>
> def create_restraints(m, all):
> def add_connectivity_restraint(s):
>
> tr= IMP.core.TableRefiner()
> rps=[]
> for sc in s:
> ps= sc.get_selected_particles()
> rps.append(ps[0])
> tr.add_particle(ps[0], ps)
>
> # duplicate the IMP.atom.create_connectivity_restraint
> functionality
>
> score=
>
> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
>
> #ub = IMP.core.HarmonicUpperBound(1.0, 0.1)
> #ss = IMP.core.DistancePairScore(ub)
>
> r= IMP.core.MSConnectivityRestraint(m,score)
>
> iA = r.add_type([rps[0]])
> iB = r.add_type([rps[1]])
> iC = r.add_type([rps[2]])
> iD = r.add_type([rps[3]])
> #n1 = r.add_composite([iA, iB])
> n1 = r.add_composite([iA, iB, iC, iD])
> n2 = r.add_composite([iA, iB],n1)
> n3 = r.add_composite([iB, iD],n1)
> n4 = r.add_composite([iA, iB, iC],n1)
> n5 = r.add_composite([iB, iC, iD],n1)
>
> m.add_restraint(r)
>
> evr=IMP.atom.create_excluded_volume_restraint([all])
> m.add_restraint(evr)
> # a Selection allows for natural specification of what the restraints
> act on
> S= IMP.atom.Selection
> sA=S(hierarchy=all, molecule="A")
> sB=S(hierarchy=all, molecule="B")
> sC=S(hierarchy=all, molecule="C")
> sD=S(hierarchy=all, molecule="D")
> add_connectivity_restraint([sA, sB, sC, sD])
>
> nbl = IMP.container.ClosePairContainer([all], 0, 2)
> h = IMP.core.HarmonicLowerBound(0, 1)
> sd = IMP.core.SphereDistancePairScore(h)
> # use the lower bound on the inter-sphere distance to push the spheres
> apart
> nbr = IMP.container.PairsRestraint(sd, nbl)
> m.add_restraint(nbr)
>
>
> # r1 = IMP.core.ExcludedVolumeRestraint(all)
> # m.add_restraint(r1)
>
>
> # find acceptable conformations of the model
> def get_conformations(m):
> sampler= IMP.core.MCCGSampler(m)
> sampler.set_bounding_box(bb)
> # magic numbers, experiment with them and make them large enough for
> things to work
> sampler.set_number_of_conjugate_gradient_steps(200)
> sampler.set_number_of_monte_carlo_steps(40)
> sampler.set_number_of_attempts(models)
> # We don't care to see the output from the sampler
> #sampler.set_log_level(IMP.SILENT)
> # return the IMP.ConfigurationSet storing all the found configurations
> that
> # meet the various restraint maximum scores.
> cs= sampler.create_sample()
> return cs
>
>
> # cluster the conformations and write them to a file
> def analyze_conformations(cs, all, gs):
> # we want to cluster the configurations to make them easier to
> understand
> # in this case, the clustering is pretty meaningless
> embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,
>
> IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)), True)
> cluster= IMP.statistics.create_lloyds_kmeans(embed, 10, 10000)
> # dump each cluster center to a file so it can be viewed.
> for i in range(cluster.get_number_of_clusters()):
> center= cluster.get_cluster_center(i)
> cs.load_configuration(i)
> h = IMP.atom.Hierarchy.get_children(all)
> #tfn = IMP.create_temporary_file_name("cluster%d"%i, ".rmf")
> huh = "./models/CLUSTER%d"%i
> huh = huh +".rmf"
> #print "file is", tfn
> print "file is", huh
> rh = RMF.create_rmf_file(huh)
>
>
> IMP.rmf.add_hierarchies(rh, h)
>
> # add the current configuration to the file as frame 0
> IMP.rmf.save_frame(rh)
>
> #for g in gs:
> # rh.add_geometry(g)
>
>
>
> #******************************************************************************************
> # now do the actual work
>
> (m,all)= create_representation()
> #IMP.atom.show_molecular_hierarchy(all)
> create_restraints(m, all)
>
> # in order to display the results, we need something that maps the
> particles onto
> # geometric objets. The IMP.display.Geometry objects do this mapping.
> # IMP.display.XYZRGeometry map an IMP.core.XYZR particle onto a sphere
> gs=[]
> for i in range(all.get_number_of_children()):
> color= IMP.display.get_display_color(i)
> n= all.get_child(i)
> name= n.get_name()
> g= IMP.atom.HierarchyGeometry(n)
> g.set_color(color)
> gs.append(g)
>
> cs= get_conformations(m)
>
> print "found", cs.get_number_of_configurations(), "solutions"
>
> ListScores = []
> for i in range(0, cs.get_number_of_configurations()):
> cs.load_configuration(i)
> # print the configuration
> print "solution number: ",i,"scored :", m.evaluate(False)
> ListScores.append(m.evaluate(False))
>
> # for each of the configuration, dump it to a file to view in pymol
> for i in range(0, cs.get_number_of_configurations()):
> cs.load_configuration(i)
> h = IMP.atom.Hierarchy.get_children(all)
> #tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> #print "file is", tfn
> huh = "./models/IMP%d"%i
> huh = huh +".rmf"
> print "file is", huh
> rh = RMF.create_rmf_file(huh)
>
> # add the hierarchy to the file
> IMP.rmf.add_hierarchies(rh, h)
>
> # add the current configuration to the file as frame 0
> IMP.rmf.save_frame(rh)
>
> #for g in gs:
> # w.add_geometry(g)
>
> analyze_conformations(cs, all, gs)
>
2
1
15 Jul '14
hi list, sorry, just wanted to clarify a little more my ( lack of )
understanding re particles ...
so when i create a rigid body, i'm decorating a selection of particles -
but it's the particles that hold all the information. and what i want to
add to the root hierarchy are the decorated particles, not the decorator
itself, correct ? i think that this is why i was getting no mass before.
so when i load a pdb into IMP, a particle is created for each atom ? I've
been loading 4 pdb structures into IMP with a total number of 308 amino
acids, but i seem to be creating at least 10,515 particles ( shown by
printing IMP.kernel.Particle.get_index(IMP.Particle(m)) ) and i can't make
that add up - conceptually i'm a bit lost ...
and finally is there a way to access each set of decorated particles
iteratively ? i think my problems with creating the RigidBodyMover are
because i'm trying to add the entire model at once ( as shown ) - and there
are some particles in there which i haven't been able to decorate.
rb_mover = IMP.core.RigidBodyMover(m,
IMP.kernel.Particle.get_index(IMP.Particle(m)), maxTranslation, maxRotation
)
eagerly anticipating enlightenment,
josh
p.s. full script for reference
https://gist.github.com/mysticvision/abb8d42e24f329b5388b
On 14 July 2014 17:09, <imp-users-request(a)salilab.org> wrote:
> Send IMP-users mailing list submissions to
> imp-users(a)salilab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://salilab.org/mailman/listinfo/imp-users
> or, via email, send a message with subject or body 'help' to
> imp-users-request(a)salilab.org
>
> You can reach the person managing the list at
> imp-users-owner(a)salilab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IMP-users digest..."
>
>
> Today's Topics:
>
> 1. Re: getting the MCCGsampler to work (Josh Bullock)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 14 Jul 2014 17:09:08 +0100
> From: Josh Bullock <jma.bullock(a)gmail.com>
> To: imp-users(a)salilab.org
> Subject: Re: [IMP-users] getting the MCCGsampler to work
> Message-ID:
> <
> CAHh_40-ROvuH3Koy+cyBvjpi127Y67VBLk3pAo-FX0HEFYJpWg(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> ah i see, yes i had no movers or optimizers ...
>
> so now i'm trying to set up a RigidBodyMover but i'm struggling to create
> the rigid bodies. There seem to be two different ways of doing this, either
> IMP.atom.create_rigid_body or IMP.atom.setup_as_rigid_body.
>
> If I use create_rigid_body then when i later try to add restraints i get
> told "leaf 'A' ... does not have mass"
>
> If I use setup_as_rigid_body i can add the restraints but i when i try to
> add it to the RigidBodyMover i get told "Rigid body passed to
> RigidBodyMover must be set to be optimized" even
> though rb.set_coordinates_are_optimized(True)
>
> what is the function of choice here ?
>
> thanks !
>
> josh
>
> ------------------------------
>
> def create_representation():
> m= IMP.Model()
> all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> all.set_name("the universe")
> # create a protein, represented as a set of connected balls of
> appropriate
> # radii and number, chose by the resolution parameter and the number of
> # amino acids.
>
> def create_protein_from_pdbs(name, files):
>
> def create_from_pdb(file):
> sls=IMP.SetLogState(IMP.NONE)
> datadir = os.getcwd()
> print datadir
> t=IMP.atom.read_pdb( datadir+'/' + file, m,
> IMP.atom.ATOMPDBSelector())
> del sls
> #IMP.atom.show_molecular_hierarchy(t)
> c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> IMP.atom.CHAIN_TYPE)[0])
>
> # there is no reason to use all atoms, just approximate the pdb
> shape instead
> s=IMP.atom.create_simplified_along_backbone(c,1)
>
> # make the simplified structure rigid
> rb=IMP.atom.create_rigid_body(s)
> #rb=IMP.atom.setup_as_rigid_body(s)
> #rb=IMP.atom.create_rigid_body(c)
> rb.set_coordinates_are_optimized(True)
> print rb.get_coordinates_are_optimized()
>
> return rb
>
> h= create_from_pdb(files[0])
> h.set_name(name)
> all.add_child(h)
>
> create_protein_from_pdbs("A", [Firstpdb])
>
> (m,all)= create_representation()
>
>
> On 11 July 2014 19:42, <imp-users-request(a)salilab.org> wrote:
>
> > Send IMP-users mailing list submissions to
> > imp-users(a)salilab.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > https://salilab.org/mailman/listinfo/imp-users
> > or, via email, send a message with subject or body 'help' to
> > imp-users-request(a)salilab.org
> >
> > You can reach the person managing the list at
> > imp-users-owner(a)salilab.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of IMP-users digest..."
> >
> >
> > Today's Topics:
> >
> > 1. getting the MCCGsampler to work (Josh Bullock)
> > 2. Re: getting the MCCGsampler to work (Ben Webb)
> > 3. Re: getting the MCCGsampler to work (Ben Webb)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Fri, 11 Jul 2014 13:12:01 +0100
> > From: Josh Bullock <jma.bullock(a)gmail.com>
> > To: imp-users(a)salilab.org
> > Subject: [IMP-users] getting the MCCGsampler to work
> > Message-ID:
> > <
> > CAHh_40_B9Ciag3LMdDMgFLJf2MCx2-tGPp3tmMke9MQriHwMJA(a)mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Hello again,
> >
> > So I have the same overall problem as before - creating an ensemble of a
> > 4-subunit complex using MSconnectivity restraints. Having visualised the
> > output (via RMF - thanks Barak :?) , it's clear that no matter how many
> > steps of CG or MC I put, the models do not change from their initial
> random
> > placement. I know that the restraints are present because the models are
> > evaluated and scored appropriately.
> >
> > So I saw on an old (2011) nup84 example that MCCG can't handle rigid
> > bodies, is this still the case ? If so, should I switch to the DOMINO
> > sampler ? or it does work and likely there's an error in my code ...
> >
> > Many thanks !
> >
> > Josh
> >
> > -------------------------------------------------
> >
> > import IMP
> > import IMP.atom
> > import IMP.rmf
> > import inspect
> > import IMP.container
> > import IMP.display
> > import IMP.statistics
> > #import IMP.example
> > import sys, math, os, optparse
> > import RMF
> >
> > from optparse import OptionParser
> >
> >
> > # Convert the arguments into strings and number
> > Firstpdb = str(sys.argv[1])
> > Secondpdb = str(sys.argv[2])
> > Thirdpdb = str(sys.argv[3])
> > Fourthpdb = str(sys.argv[4])
> > models = float(sys.argv[5])
> >
> > #*****************************************
> >
> > # the spring constant to use, it doesnt really matter
> > k=100
> > # the target resolution for the representation, this is used to specify
> how
> > detailed
> > # the representation used should be
> > resolution=300
> > # the box to perform everything
> > bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
> > IMP.algebra.Vector3D(100, 100, 100))
> >
> >
> > # this function creates the molecular hierarchies for the various
> involved
> > proteins
> > def create_representation():
> > m= IMP.Model()
> > all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> > all.set_name("the universe")
> > # create a protein, represented as a set of connected balls of
> > appropriate
> > # radii and number, chose by the resolution parameter and the number
> of
> > # amino acids.
> >
> > def create_protein_from_pdbs(name, files):
> >
> > def create_from_pdb(file):
> > sls=IMP.SetLogState(IMP.NONE)
> > datadir = os.getcwd()
> > print datadir
> > t=IMP.atom.read_pdb( datadir+'/' + file, m,
> > IMP.atom.ATOMPDBSelector())
> > del sls
> > #IMP.atom.show_molecular_hierarchy(t)
> > c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> > IMP.atom.CHAIN_TYPE)[0])
> > if c.get_number_of_children()==0:
> > IMP.atom.show_molecular_hierarchy(t)
> > # there is no reason to use all atoms, just approximate the
> pdb
> > shape instead
> > s=IMP.atom.create_simplified_along_backbone(c,
> > 1)
> > #IMP.atom.destroy(t)
> > # make the simplified structure rigid
> > rb=IMP.atom.create_rigid_body(s)
> > rb=IMP.atom.create_rigid_body(c)
> > rb.set_coordinates_are_optimized(True)
> > return s # <------- swapping c with s will give a
> coarse
> > grain representation - much faster !
> > # return c
> >
> > h= create_from_pdb(files[0])
> > h.set_name(name)
> > all.add_child(h)
> >
> > create_protein_from_pdbs("A", [Firstpdb])
> > create_protein_from_pdbs("B", [Secondpdb])
> > create_protein_from_pdbs("C", [Thirdpdb])
> > create_protein_from_pdbs("D", [Fourthpdb])
> > #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
> > return (m, all)
> >
> > # create the needed restraints and add them to the model
> >
> > def create_restraints(m, all):
> > def add_connectivity_restraint(s):
> >
> > tr= IMP.core.TableRefiner()
> > rps=[]
> > for sc in s:
> > ps= sc.get_selected_particles()
> > rps.append(ps[0])
> > tr.add_particle(ps[0], ps)
> >
> > # duplicate the IMP.atom.create_connectivity_restraint
> > functionality
> >
> > score=
> >
> >
> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
> >
> > #ub = IMP.core.HarmonicUpperBound(1.0, 0.1)
> > #ss = IMP.core.DistancePairScore(ub)
> >
> > r= IMP.core.MSConnectivityRestraint(m,score)
> >
> > iA = r.add_type([rps[0]])
> > iB = r.add_type([rps[1]])
> > iC = r.add_type([rps[2]])
> > iD = r.add_type([rps[3]])
> > #n1 = r.add_composite([iA, iB])
> > n1 = r.add_composite([iA, iB, iC, iD])
> > n2 = r.add_composite([iA, iB],n1)
> > n3 = r.add_composite([iB, iD],n1)
> > n4 = r.add_composite([iA, iB, iC],n1)
> > n5 = r.add_composite([iB, iC, iD],n1)
> >
> > m.add_restraint(r)
> >
> > evr=IMP.atom.create_excluded_volume_restraint([all])
> > m.add_restraint(evr)
> > # a Selection allows for natural specification of what the restraints
> > act on
> > S= IMP.atom.Selection
> > sA=S(hierarchy=all, molecule="A")
> > sB=S(hierarchy=all, molecule="B")
> > sC=S(hierarchy=all, molecule="C")
> > sD=S(hierarchy=all, molecule="D")
> > add_connectivity_restraint([sA, sB, sC, sD])
> >
> > nbl = IMP.container.ClosePairContainer([all], 0, 2)
> > h = IMP.core.HarmonicLowerBound(0, 1)
> > sd = IMP.core.SphereDistancePairScore(h)
> > # use the lower bound on the inter-sphere distance to push the
> spheres
> > apart
> > nbr = IMP.container.PairsRestraint(sd, nbl)
> > m.add_restraint(nbr)
> >
> >
> > # r1 = IMP.core.ExcludedVolumeRestraint(all)
> > # m.add_restraint(r1)
> >
> >
> > # find acceptable conformations of the model
> > def get_conformations(m):
> > sampler= IMP.core.MCCGSampler(m)
> > sampler.set_bounding_box(bb)
> > # magic numbers, experiment with them and make them large enough for
> > things to work
> > sampler.set_number_of_conjugate_gradient_steps(200)
> > sampler.set_number_of_monte_carlo_steps(40)
> > sampler.set_number_of_attempts(models)
> > # We don't care to see the output from the sampler
> > #sampler.set_log_level(IMP.SILENT)
> > # return the IMP.ConfigurationSet storing all the found
> configurations
> > that
> > # meet the various restraint maximum scores.
> > cs= sampler.create_sample()
> > return cs
> >
> >
> > # cluster the conformations and write them to a file
> > def analyze_conformations(cs, all, gs):
> > # we want to cluster the configurations to make them easier to
> > understand
> > # in this case, the clustering is pretty meaningless
> > embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,
> >
> > IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)), True)
> > cluster= IMP.statistics.create_lloyds_kmeans(embed, 10, 10000)
> > # dump each cluster center to a file so it can be viewed.
> > for i in range(cluster.get_number_of_clusters()):
> > center= cluster.get_cluster_center(i)
> > cs.load_configuration(i)
> > h = IMP.atom.Hierarchy.get_children(all)
> > #tfn = IMP.create_temporary_file_name("cluster%d"%i, ".rmf")
> > huh = "./models/CLUSTER%d"%i
> > huh = huh +".rmf"
> > #print "file is", tfn
> > print "file is", huh
> > rh = RMF.create_rmf_file(huh)
> >
> >
> > IMP.rmf.add_hierarchies(rh, h)
> >
> > # add the current configuration to the file as frame 0
> > IMP.rmf.save_frame(rh)
> >
> > #for g in gs:
> > # rh.add_geometry(g)
> >
> >
> >
> >
> #******************************************************************************************
> > # now do the actual work
> >
> > (m,all)= create_representation()
> > #IMP.atom.show_molecular_hierarchy(all)
> > create_restraints(m, all)
> >
> > # in order to display the results, we need something that maps the
> > particles onto
> > # geometric objets. The IMP.display.Geometry objects do this mapping.
> > # IMP.display.XYZRGeometry map an IMP.core.XYZR particle onto a sphere
> > gs=[]
> > for i in range(all.get_number_of_children()):
> > color= IMP.display.get_display_color(i)
> > n= all.get_child(i)
> > name= n.get_name()
> > g= IMP.atom.HierarchyGeometry(n)
> > g.set_color(color)
> > gs.append(g)
> >
> > cs= get_conformations(m)
> >
> > print "found", cs.get_number_of_configurations(), "solutions"
> >
> > ListScores = []
> > for i in range(0, cs.get_number_of_configurations()):
> > cs.load_configuration(i)
> > # print the configuration
> > print "solution number: ",i,"scored :", m.evaluate(False)
> > ListScores.append(m.evaluate(False))
> >
> > # for each of the configuration, dump it to a file to view in pymol
> > for i in range(0, cs.get_number_of_configurations()):
> > cs.load_configuration(i)
> > h = IMP.atom.Hierarchy.get_children(all)
> > #tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> > #print "file is", tfn
> > huh = "./models/IMP%d"%i
> > huh = huh +".rmf"
> > print "file is", huh
> > rh = RMF.create_rmf_file(huh)
> >
> > # add the hierarchy to the file
> > IMP.rmf.add_hierarchies(rh, h)
> >
> > # add the current configuration to the file as frame 0
> > IMP.rmf.save_frame(rh)
> >
> > #for g in gs:
> > # w.add_geometry(g)
> >
> > analyze_conformations(cs, all, gs)
> >
2
1
Hello again,
So I have the same overall problem as before - creating an ensemble of a
4-subunit complex using MSconnectivity restraints. Having visualised the
output (via RMF - thanks Barak :¬) , it's clear that no matter how many
steps of CG or MC I put, the models do not change from their initial random
placement. I know that the restraints are present because the models are
evaluated and scored appropriately.
So I saw on an old (2011) nup84 example that MCCG can't handle rigid
bodies, is this still the case ? If so, should I switch to the DOMINO
sampler ? or it does work and likely there's an error in my code ...
Many thanks !
Josh
-------------------------------------------------
import IMP
import IMP.atom
import IMP.rmf
import inspect
import IMP.container
import IMP.display
import IMP.statistics
#import IMP.example
import sys, math, os, optparse
import RMF
from optparse import OptionParser
# Convert the arguments into strings and number
Firstpdb = str(sys.argv[1])
Secondpdb = str(sys.argv[2])
Thirdpdb = str(sys.argv[3])
Fourthpdb = str(sys.argv[4])
models = float(sys.argv[5])
#*****************************************
# the spring constant to use, it doesnt really matter
k=100
# the target resolution for the representation, this is used to specify how
detailed
# the representation used should be
resolution=300
# the box to perform everything
bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
IMP.algebra.Vector3D(100, 100, 100))
# this function creates the molecular hierarchies for the various involved
proteins
def create_representation():
m= IMP.Model()
all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
all.set_name("the universe")
# create a protein, represented as a set of connected balls of
appropriate
# radii and number, chose by the resolution parameter and the number of
# amino acids.
def create_protein_from_pdbs(name, files):
def create_from_pdb(file):
sls=IMP.SetLogState(IMP.NONE)
datadir = os.getcwd()
print datadir
t=IMP.atom.read_pdb( datadir+'/' + file, m,
IMP.atom.ATOMPDBSelector())
del sls
#IMP.atom.show_molecular_hierarchy(t)
c=IMP.atom.Chain(IMP.atom.get_by_type(t,
IMP.atom.CHAIN_TYPE)[0])
if c.get_number_of_children()==0:
IMP.atom.show_molecular_hierarchy(t)
# there is no reason to use all atoms, just approximate the pdb
shape instead
s=IMP.atom.create_simplified_along_backbone(c,
1)
#IMP.atom.destroy(t)
# make the simplified structure rigid
rb=IMP.atom.create_rigid_body(s)
rb=IMP.atom.create_rigid_body(c)
rb.set_coordinates_are_optimized(True)
return s # <------- swapping c with s will give a coarse
grain representation - much faster !
# return c
h= create_from_pdb(files[0])
h.set_name(name)
all.add_child(h)
create_protein_from_pdbs("A", [Firstpdb])
create_protein_from_pdbs("B", [Secondpdb])
create_protein_from_pdbs("C", [Thirdpdb])
create_protein_from_pdbs("D", [Fourthpdb])
#create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
return (m, all)
# create the needed restraints and add them to the model
def create_restraints(m, all):
def add_connectivity_restraint(s):
tr= IMP.core.TableRefiner()
rps=[]
for sc in s:
ps= sc.get_selected_particles()
rps.append(ps[0])
tr.add_particle(ps[0], ps)
# duplicate the IMP.atom.create_connectivity_restraint functionality
score=
IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
#ub = IMP.core.HarmonicUpperBound(1.0, 0.1)
#ss = IMP.core.DistancePairScore(ub)
r= IMP.core.MSConnectivityRestraint(m,score)
iA = r.add_type([rps[0]])
iB = r.add_type([rps[1]])
iC = r.add_type([rps[2]])
iD = r.add_type([rps[3]])
#n1 = r.add_composite([iA, iB])
n1 = r.add_composite([iA, iB, iC, iD])
n2 = r.add_composite([iA, iB],n1)
n3 = r.add_composite([iB, iD],n1)
n4 = r.add_composite([iA, iB, iC],n1)
n5 = r.add_composite([iB, iC, iD],n1)
m.add_restraint(r)
evr=IMP.atom.create_excluded_volume_restraint([all])
m.add_restraint(evr)
# a Selection allows for natural specification of what the restraints
act on
S= IMP.atom.Selection
sA=S(hierarchy=all, molecule="A")
sB=S(hierarchy=all, molecule="B")
sC=S(hierarchy=all, molecule="C")
sD=S(hierarchy=all, molecule="D")
add_connectivity_restraint([sA, sB, sC, sD])
nbl = IMP.container.ClosePairContainer([all], 0, 2)
h = IMP.core.HarmonicLowerBound(0, 1)
sd = IMP.core.SphereDistancePairScore(h)
# use the lower bound on the inter-sphere distance to push the spheres
apart
nbr = IMP.container.PairsRestraint(sd, nbl)
m.add_restraint(nbr)
# r1 = IMP.core.ExcludedVolumeRestraint(all)
# m.add_restraint(r1)
# find acceptable conformations of the model
def get_conformations(m):
sampler= IMP.core.MCCGSampler(m)
sampler.set_bounding_box(bb)
# magic numbers, experiment with them and make them large enough for
things to work
sampler.set_number_of_conjugate_gradient_steps(200)
sampler.set_number_of_monte_carlo_steps(40)
sampler.set_number_of_attempts(models)
# We don't care to see the output from the sampler
#sampler.set_log_level(IMP.SILENT)
# return the IMP.ConfigurationSet storing all the found configurations
that
# meet the various restraint maximum scores.
cs= sampler.create_sample()
return cs
# cluster the conformations and write them to a file
def analyze_conformations(cs, all, gs):
# we want to cluster the configurations to make them easier to
understand
# in this case, the clustering is pretty meaningless
embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,
IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)), True)
cluster= IMP.statistics.create_lloyds_kmeans(embed, 10, 10000)
# dump each cluster center to a file so it can be viewed.
for i in range(cluster.get_number_of_clusters()):
center= cluster.get_cluster_center(i)
cs.load_configuration(i)
h = IMP.atom.Hierarchy.get_children(all)
#tfn = IMP.create_temporary_file_name("cluster%d"%i, ".rmf")
huh = "./models/CLUSTER%d"%i
huh = huh +".rmf"
#print "file is", tfn
print "file is", huh
rh = RMF.create_rmf_file(huh)
IMP.rmf.add_hierarchies(rh, h)
# add the current configuration to the file as frame 0
IMP.rmf.save_frame(rh)
#for g in gs:
# rh.add_geometry(g)
#******************************************************************************************
# now do the actual work
(m,all)= create_representation()
#IMP.atom.show_molecular_hierarchy(all)
create_restraints(m, all)
# in order to display the results, we need something that maps the
particles onto
# geometric objets. The IMP.display.Geometry objects do this mapping.
# IMP.display.XYZRGeometry map an IMP.core.XYZR particle onto a sphere
gs=[]
for i in range(all.get_number_of_children()):
color= IMP.display.get_display_color(i)
n= all.get_child(i)
name= n.get_name()
g= IMP.atom.HierarchyGeometry(n)
g.set_color(color)
gs.append(g)
cs= get_conformations(m)
print "found", cs.get_number_of_configurations(), "solutions"
ListScores = []
for i in range(0, cs.get_number_of_configurations()):
cs.load_configuration(i)
# print the configuration
print "solution number: ",i,"scored :", m.evaluate(False)
ListScores.append(m.evaluate(False))
# for each of the configuration, dump it to a file to view in pymol
for i in range(0, cs.get_number_of_configurations()):
cs.load_configuration(i)
h = IMP.atom.Hierarchy.get_children(all)
#tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
#print "file is", tfn
huh = "./models/IMP%d"%i
huh = huh +".rmf"
print "file is", huh
rh = RMF.create_rmf_file(huh)
# add the hierarchy to the file
IMP.rmf.add_hierarchies(rh, h)
# add the current configuration to the file as frame 0
IMP.rmf.save_frame(rh)
#for g in gs:
# w.add_geometry(g)
analyze_conformations(cs, all, gs)
2
2
Re: [IMP-users] Sampling and writing to pym/rmf (Barak Raveh) (Josh Bullock)
by Josh Bullock 03 Jul '14
by Josh Bullock 03 Jul '14
03 Jul '14
aha it works !!! just had to update chimera ... thanks for all the help :¬)
josh
On 3 July 2014 16:26, <imp-users-request(a)salilab.org> wrote:
> Send IMP-users mailing list submissions to
> imp-users(a)salilab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://salilab.org/mailman/listinfo/imp-users
> or, via email, send a message with subject or body 'help' to
> imp-users-request(a)salilab.org
>
> You can reach the person managing the list at
> imp-users-owner(a)salilab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IMP-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Josh Bullock)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 3 Jul 2014 16:25:53 +0100
> From: Josh Bullock <jma.bullock(a)gmail.com>
> To: imp-users(a)salilab.org
> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak Raveh)
> Message-ID:
> <
> CAHh_40--TFunShec5yvANLWngkFu6cq1g-N_JAO9vaOkO6OeVA(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> so this is what is looks like with rmf_show:
>
> https://gist.github.com/mysticvision/271d973806603967fd31
>
> i'll email you the rmf now.
>
> thanks !
>
>
> On 3 July 2014 14:28, <imp-users-request(a)salilab.org> wrote:
>
> > Send IMP-users mailing list submissions to
> > imp-users(a)salilab.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > https://salilab.org/mailman/listinfo/imp-users
> > or, via email, send a message with subject or body 'help' to
> > imp-users-request(a)salilab.org
> >
> > You can reach the person managing the list at
> > imp-users-owner(a)salilab.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of IMP-users digest..."
> >
> >
> > Today's Topics:
> >
> > 1. Re: Sampling and writing to pym/rmf (Josh Bullock) (Barak Raveh)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Thu, 3 Jul 2014 06:27:55 -0700
> > From: Barak Raveh <barak.raveh(a)gmail.com>
> > To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> > Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Josh
> > Bullock)
> > Message-ID:
> > <
> > CAHp+_UoKxFzCF8W21dQv5OhWFuSc78HZp8JdnBZH5eEjeNEEvQ(a)mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > You can use rmf_show and rmf_show -v to view your file in human readable
> > format
> > http://integrativemodeling.org/rmf/nightly/doc/executables.html
> >
> > About chimera, are you using a latest nightly build? You can send me the
> > RMF file and I'll give a look to see if it depends on the chimera
> version.
> >
> > Barak
> >
> >
> > On Thu, Jul 3, 2014 at 5:55 AM, Josh Bullock <jma.bullock(a)gmail.com>
> > wrote:
> >
> > > oh so there is something in the .rmf file, looks a bit garbled though
> ...
> > > is this normal ?
> > >
> > > https://gist.github.com/mysticvision/271d973806603967fd31
> > >
> > >
> > > On 3 July 2014 13:44, <imp-users-request(a)salilab.org> wrote:
> > >
> > >> Send IMP-users mailing list submissions to
> > >> imp-users(a)salilab.org
> > >>
> > >> To subscribe or unsubscribe via the World Wide Web, visit
> > >> https://salilab.org/mailman/listinfo/imp-users
> > >> or, via email, send a message with subject or body 'help' to
> > >> imp-users-request(a)salilab.org
> > >>
> > >> You can reach the person managing the list at
> > >> imp-users-owner(a)salilab.org
> > >>
> > >> When replying, please edit your Subject line so it is more specific
> > >> than "Re: Contents of IMP-users digest..."
> > >>
> > >>
> > >> Today's Topics:
> > >>
> > >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Josh Bullock)
> > >>
> > >>
> > >> ----------------------------------------------------------------------
> > >>
> > >> Message: 1
> > >> Date: Thu, 3 Jul 2014 13:44:22 +0100
> > >> From: Josh Bullock <jma.bullock(a)gmail.com>
> > >> To: imp-users(a)salilab.org
> > >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak Raveh)
> > >> Message-ID:
> > >> <CAHh_40_zsUCt4=
> > >> nZbvDRd0owHzz_v_DHEiB-R+Em3ggDScS2zg(a)mail.gmail.com>
> > >> Content-Type: text/plain; charset="utf-8"
> > >>
> > >> aha okay, so now i'm generating .rmf files however when trying to open
> > >> them
> > >> in chimera I get the following error:
> > >>
> > >> "Invalid handle returned from H5Fopen(name.c_str(), H5F_ACC_RDONLY,
> > >> plist)"
> > >> in file "
> > >>
> > >> I'm not sure whether this is because I've created empty .rmf files or
> > >> something else is wrong ...
> > >>
> > >> the code for making the rmf files:
> > >>
> > >> for i in range(0, cs.get_number_of_configurations()):
> > >> cs.load_configuration(i)
> > >> h = IMP.atom.Hierarchy.get_children(all)
> > >> tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> > >> print "file is", tfn
> > >> rh = RMF.create_rmf_file(tfn)
> > >>
> > >> # add the hierarchy to the file
> > >> IMP.rmf.add_hierarchies(rh, h)
> > >>
> > >> # add the current configuration to the file as frame 0
> > >> IMP.rmf.save_frame(rh)
> > >>
> > >>
> > >> On 3 July 2014 00:20, <imp-users-request(a)salilab.org> wrote:
> > >>
> > >> > Send IMP-users mailing list submissions to
> > >> > imp-users(a)salilab.org
> > >> >
> > >> > To subscribe or unsubscribe via the World Wide Web, visit
> > >> > https://salilab.org/mailman/listinfo/imp-users
> > >> > or, via email, send a message with subject or body 'help' to
> > >> > imp-users-request(a)salilab.org
> > >> >
> > >> > You can reach the person managing the list at
> > >> > imp-users-owner(a)salilab.org
> > >> >
> > >> > When replying, please edit your Subject line so it is more specific
> > >> > than "Re: Contents of IMP-users digest..."
> > >> >
> > >> >
> > >> > Today's Topics:
> > >> >
> > >> > 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> > >> >
> > >> >
> > >> >
> ----------------------------------------------------------------------
> > >> >
> > >> > Message: 1
> > >> > Date: Wed, 2 Jul 2014 16:20:19 -0700
> > >> > From: Barak Raveh <barak.raveh(a)gmail.com>
> > >> > To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> > >> > Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> > >> > Message-ID:
> > >> > <
> > >> > CAHp+_Uoq-HAyca9AX_pFcEje32ke3J3KuKZWYfuj+M8SZWUkCw(a)mail.gmail.com>
> > >> > Content-Type: text/plain; charset="utf-8"
> > >> >
> > >> > Hi Josh,
> > >> >
> > >> > An IMP model contains a list of particles that are tightly
> associated
> > >> with
> > >> > it (a particle does not exist outside the context of a model). Given
> > the
> > >> > disclaimer that I have never used ConfigurationSet, my understanding
> > >> from
> > >> > its documentation is that when you load a configuration, the values
> of
> > >> the
> > >> > particles within the model are updated accordingly. If I understand
> > your
> > >> > code correctly, 'all' is the root of the hierarchy in your model, so
> > it
> > >> is
> > >> > 'all' that you should add to the rmf. The values of 'all' and all of
> > its
> > >> > children are supposed to update when you load a configuration,
> > >> > automatically.
> > >> >
> > >> > All that being said said - use this advice at own risk, perhaps
> > someone
> > >> > could advise you better. Let me know if you have more questions.
> > >> >
> > >> > Barak
> > >> >
> > >> >
> > >> > On Wed, Jul 2, 2014 at 3:42 PM, Josh Bullock <jma.bullock(a)gmail.com
> >
> > >> > wrote:
> > >> >
> > >> > >
> > >> > >
> > >> > > Conceptually I do ( i think ... ) but not practically. I'm hoping
> to
> > >> view
> > >> > > each of the models i created - with MSrestraints - separately as
> an
> > >> .rmf
> > >> > in
> > >> > > chimera, just so i can see what i'm making !
> > >> > >
> > >> > > so i have created my models using:
> > >> > >
> > >> > > cs= get_conformations(m)
> > >> > >
> > >> > > do i have to assign each model to a particle before i can write it
> > to
> > >> an
> > >> > > .rmf ? Or is each model already a particle with hierarchy ?
> > >> > >
> > >> > > -------------------------------------------
> > >> > >
> > >> > > for i in range(0, cs.get_number_of_configurations()):
> > >> > > cs.load_configuration(i)
> > >> > > h = IMP.atom.Hierarchy(m) # <------- how do i call the
> > >> hierarchy
> > >> > of
> > >> > > the current loaded configuration ?
> > >> > > c = p.get_children(h)
> > >> > > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> > >> > > rh = RMF.create_rmf_file(tfn)
> > >> > >
> > >> > > # add the hierarchy to the file
> > >> > > IMP.rmf.add_hierarchies(rh, h)
> > >> > >
> > >> > > # add the current configuration to the file as frame 0
> > >> > > IMP.rmf.save_frame(rh)
> > >> > >
> > >> > > On 2 July 2014 23:03, <imp-users-request(a)salilab.org> wrote:
> > >> > >
> > >> > >> Send IMP-users mailing list submissions to
> > >> > >> imp-users(a)salilab.org
> > >> > >>
> > >> > >> To subscribe or unsubscribe via the World Wide Web, visit
> > >> > >> https://salilab.org/mailman/listinfo/imp-users
> > >> > >> or, via email, send a message with subject or body 'help' to
> > >> > >> imp-users-request(a)salilab.org
> > >> > >>
> > >> > >> You can reach the person managing the list at
> > >> > >> imp-users-owner(a)salilab.org
> > >> > >>
> > >> > >> When replying, please edit your Subject line so it is more
> specific
> > >> > >> than "Re: Contents of IMP-users digest..."
> > >> > >>
> > >> > >>
> > >> > >> Today's Topics:
> > >> > >>
> > >> > >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> > >> > >>
> > >> > >>
> > >> > >>
> > >> ----------------------------------------------------------------------
> > >> > >>
> > >> > >> Message: 1
> > >> > >> Date: Wed, 2 Jul 2014 15:03:19 -0700
> > >> > >>
> > >> > >> From: Barak Raveh <barak.raveh(a)gmail.com>
> > >> > >> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> > >> > >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> > >> > >> Message-ID:
> > >> > >> <CAHp+_UqO8rXRMsUSndbg-c0jyDxnswDe9aFKvW889gGMU=
> > >> > >> 4MMQ(a)mail.gmail.com>
> > >> > >> Content-Type: text/plain; charset="utf-8"
> > >> > >>
> > >> > >>
> > >> > >> * I meant
> > >> > >>
> > >> > >> h = IMP.atom.Hierarchy(p)
> > >> > >> c = p.get_children(h)
> > >> > >>
> > >> > >> this assumes that particle p was already decorated as Hierarchy
> > (let
> > >> me
> > >> > >> know if you are not familiar with decorators, Hierarchy, or
> > >> Particle).
> > >> > >>
> > >> > >>
> > >> > >>
> > >> > >> On Wed, Jul 2, 2014 at 3:02 PM, Barak Raveh <
> barak.raveh(a)gmail.com
> > >
> > >> > >> wrote:
> > >> > >>
> > >> > >> > Hi Josh,
> > >> > >> >
> > >> > >> > I think get_children() is only a member function of Hierarchy,
> so
> > >> you
> > >> > >> > should do something like
> > >> > >> >
> > >> > >> > IMP.atom.Hierarchy(p)
> > >> > >> > c = p.get_children()
> > >> > >> >
> > >> > >> > 'cs' seems to be a ConfigurationSet object - are you sure that
> > you
> > >> > >> expect
> > >> > >> > it to have children?
> > >> > >> >
> > >> > >> > What do you want to do?
> > >> > >> >
> > >> > >> > Cheers,
> > >> > >> > Barak
> > >> > >> >
> > >> > >> > On Wed, Jul 2, 2014 at 1:42 PM, Josh Bullock <
> > >> jma.bullock(a)gmail.com>
> > >> > >> > wrote:
> > >> > >> >
> > >> > >> >> ah sorry ! this line gives me the error
> > >> > >> >>
> > >> > >> >> h= IMP.atom.Hierarchy.get_children(cs)
> > >> > >> >>
> > >> > >> >> thanks
> > >> > >> >>
> > >> > >> >> josh
> > >> > >> >>
> > >> > >> >> On 2 July 2014 17:45, <imp-users-request(a)salilab.org> wrote:
> > >> > >> >>
> > >> > >> >>> Send IMP-users mailing list submissions to
> > >> > >> >>> imp-users(a)salilab.org
> > >> > >> >>>
> > >> > >> >>> To subscribe or unsubscribe via the World Wide Web, visit
> > >> > >> >>> https://salilab.org/mailman/listinfo/imp-users
> > >> > >> >>> or, via email, send a message with subject or body 'help' to
> > >> > >> >>> imp-users-request(a)salilab.org
> > >> > >> >>>
> > >> > >> >>> You can reach the person managing the list at
> > >> > >> >>> imp-users-owner(a)salilab.org
> > >> > >> >>>
> > >> > >> >>> When replying, please edit your Subject line so it is more
> > >> specific
> > >> > >> >>> than "Re: Contents of IMP-users digest..."
> > >> > >> >>>
> > >> > >> >>>
> > >> > >> >>> Today's Topics:
> > >> > >> >>>
> > >> > >> >>> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> (Barak
> > >> > Raveh)
> > >> > >> >>>
> > >> > >> >>>
> > >> > >> >>>
> > >> >
> ----------------------------------------------------------------------
> > >> > >> >>>
> > >> > >> >>> Message: 1
> > >> > >> >>> Date: Wed, 2 Jul 2014 09:45:30 -0700
> > >> > >> >>> From: Barak Raveh <barak.raveh(a)gmail.com>
> > >> > >> >>> To: Help and discussion for users of IMP <
> > imp-users(a)salilab.org>
> > >> > >> >>> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> (Barak
> > >> > Raveh)
> > >> > >> >>> Message-ID:
> > >> > >> >>> <CAHp+_Uo19VasJDJYi+2CoUUu=
> > >> > >> >>> u_6duKCraVetU4dW45+oDhTAw(a)mail.gmail.com>
> > >> > >> >>> Content-Type: text/plain; charset="utf-8"
> > >> > >> >>>
> > >> > >> >>> Which lines throws the error?
> > >> > >> >>>
> > >> > >> >>>
> > >> > >> >>> On Wed, Jul 2, 2014 at 4:56 AM, Josh Bullock <
> > >> jma.bullock(a)gmail.com
> > >> > >
> > >> > >> >>> wrote:
> > >> > >> >>>
> > >> > >> >>> > Hi Barek,
> > >> > >> >>> >
> > >> > >> >>> > So I'm not giving hierarchy.get_children the correct input:
> > >> > >> >>> >
> > >> > >> >>> > TypeError: unbound method get_children() must be called
> with
> > >> > >> Hierarchy
> > >> > >> >>> > instance as first argument (got ConfigurationSet instance
> > >> instead)
> > >> > >> >>> >
> > >> > >> >>> > I'm not sure which argument is the hierarchy instance.
> > >> > >> >>> >
> > >> > >> >>> > Thanks,
> > >> > >> >>> >
> > >> > >> >>> > Josh
> > >> > >> >>> >
> > >> > >> >>> > -------------------------------------------------
> > >> > >> >>> >
> > >> > >> >>> > cs= get_conformations(m)
> > >> > >> >>>
> > >> > >> >>> >
> > >> > >> >>> > for i in range(0, cs.get_number_of_configurations()):
> > >> > >> >>> > JOSH = cs.load_configuration(i)
> > >> > >> >>> > S= IMP.atom.Selection
> > >> > >> >>> > h= IMP.atom.Hierarchy.get_children(cs)
> > >> > >> >>> > tfn = IMP.create_temporary_file_name("josh%d"%i,
> ".rmf")
> > >> > >> >>> > rh = RMF.create_rmf_file(tfn)
> > >> > >> >>> >
> > >> > >> >>> > On 1 July 2014 17:31, <imp-users-request(a)salilab.org>
> wrote:
> > >> > >> >>> >
> > >> > >> >>> >> Send IMP-users mailing list submissions to
> > >> > >> >>> >> imp-users(a)salilab.org
> > >> > >> >>> >>
> > >> > >> >>> >> To subscribe or unsubscribe via the World Wide Web, visit
> > >> > >> >>> >> https://salilab.org/mailman/listinfo/imp-users
> > >> > >> >>> >> or, via email, send a message with subject or body 'help'
> to
> > >> > >> >>> >> imp-users-request(a)salilab.org
> > >> > >> >>> >>
> > >> > >> >>> >> You can reach the person managing the list at
> > >> > >> >>> >> imp-users-owner(a)salilab.org
> > >> > >> >>> >>
> > >> > >> >>> >> When replying, please edit your Subject line so it is more
> > >> > specific
> > >> > >> >>> >> than "Re: Contents of IMP-users digest..."
> > >> > >> >>> >>
> > >> > >> >>> >>
> > >> > >> >>> >> Today's Topics:
> > >> > >> >>> >>
> > >> > >> >>> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> > >> > >> >>> >>
> > >> > >> >>> >>
> > >> > >> >>> >>
> > >> > >>
> > >> ----------------------------------------------------------------------
> > >> > >> >>> >>
> > >> > >> >>> >> Message: 1
> > >> > >> >>> >> Date: Tue, 1 Jul 2014 09:31:33 -0700
> > >> > >> >>> >> From: Barak Raveh <barak.raveh(a)gmail.com>
> > >> > >> >>> >> To: Help and discussion for users of IMP <
> > >> imp-users(a)salilab.org>
> > >> > >> >>> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> > >> > >> >>> >> Message-ID:
> > >> > >> >>> >> <CAHp+_UowiBwJozbwOfi8yFEVt7Z8o2tEZ=
> > >> > >> >>> >> LvYPnJh-LjpC2cSA(a)mail.gmail.com>
> > >> > >> >>> >> Content-Type: text/plain; charset="utf-8"
> > >> > >> >>>
> > >> > >> >>> >>
> > >> > >> >>> >> Hi Josh, from a very superficial look, your code to write
> > the
> > >> RMF
> > >> > >> >>> files
> > >> > >> >>> >> seems fine - do you get an output RMF file? Could you load
> > it
> > >> in
> > >> > >> >>> Chimera?
> > >> > >> >>> >>
> > >> > >> >>> >>
> > >> > >> >>> >> On Tue, Jul 1, 2014 at 2:40 AM, Josh Bullock <
> > >> > >> jma.bullock(a)gmail.com>
> > >> > >> >>> >> wrote:
> > >> > >> >>> >>
> > >> > >> >>> >> > Hello,
> > >> > >> >>> >> >
> > >> > >> >>> >> > I'm relatively new to all this so please let me know if
> > i'm
> > >> > >> making
> > >> > >> >>> any
> > >> > >> >>> >> > obvious errors ...
> > >> > >> >>> >> >
> > >> > >> >>> >> > Essentially all i'm trying to do is generate an ensemble
> > of
> > >> > >> models
> > >> > >> >>> made
> > >> > >> >>> >> > from four subunits - constrained by MS connectivity
> > >> restraints.
> > >> > >> The
> > >> > >> >>> >> models
> > >> > >> >>> >> > get scored but nothing seems to write to the pymol file.
> > >> > Ideally
> > >> > >> i'd
> > >> > >> >>> >> like
> > >> > >> >>> >> > to write to an .rmf but i haven't worked that one out
> > either
> > >> > ...
> > >> > >> >>> >> >
> > >> > >> >>> >> > Is this a reasonable way to go about my problem ?
> > >> > >> >>> >> >
> > >> > >> >>> >> > Many thanks,
> > >> > >> >>> >> >
> > >> > >> >>> >> > Josh
> > >> > >> >>> >> >
> > >> > >> >>> >> > -------------------------------------------
> > >> > >> >>> >> >
> > >> > >> >>> >> > import IMP
> > >> > >> >>> >> > import IMP.atom
> > >> > >> >>> >> > import IMP.rmf
> > >> > >> >>> >> > import inspect
> > >> > >> >>> >> > import IMP.container
> > >> > >> >>> >> > import IMP.display
> > >> > >> >>> >> > import IMP.statistics
> > >> > >> >>> >> > #import IMP.example
> > >> > >> >>> >> > import sys, math, os, optparse
> > >> > >> >>> >> > import RMF
> > >> > >> >>> >> >
> > >> > >> >>> >> > from optparse import OptionParser
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >> > # Convert the arguments into strings and number
> > >> > >> >>> >> > Firstpdb = str(sys.argv[1])
> > >> > >> >>> >> > Secondpdb = str(sys.argv[2])
> > >> > >> >>> >> > Thirdpdb = str(sys.argv[3])
> > >> > >> >>> >> > Fourthpdb = str(sys.argv[4])
> > >> > >> >>> >> > models = float(sys.argv[5])
> > >> > >> >>> >> >
> > >> > >> >>> >> > #*****************************************
> > >> > >> >>> >> >
> > >> > >> >>> >> > # the spring constant to use, it doesnt really matter
> > >> > >> >>> >> > k=100
> > >> > >> >>> >> > # the target resolution for the representation, this is
> > >> used to
> > >> > >> >>> specify
> > >> > >> >>> >> > how detailed
> > >> > >> >>> >> > # the representation used should be
> > >> > >> >>> >> > resolution=300
> > >> > >> >>> >> > # the box to perform everything
> > >> > >> >>> >> >
> bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
> > >> > >> >>> >> > IMP.algebra.Vector3D(300,
> > 300,
> > >> > 300))
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >> > # this function creates the molecular hierarchies for
> the
> > >> > various
> > >> > >> >>> >> involved
> > >> > >> >>> >> > proteins
> > >> > >> >>> >> > def create_representation():
> > >> > >> >>> >> > m= IMP.Model()
> > >> > >> >>> >> >
> all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> > >> > >> >>> >> > all.set_name("the universe")
> > >> > >> >>> >> > # create a protein, represented as a set of
> connected
> > >> balls
> > >> > >> of
> > >> > >> >>> >> > appropriate
> > >> > >> >>> >> > # radii and number, chose by the resolution
> parameter
> > >> and
> > >> > the
> > >> > >> >>> >> number of
> > >> > >> >>> >> > # amino acids.
> > >> > >> >>> >> >
> > >> > >> >>> >> > def create_protein_from_pdbs(name, files):
> > >> > >> >>> >> >
> > >> > >> >>> >> > def create_from_pdb(file):
> > >> > >> >>> >> > sls=IMP.SetLogState(IMP.NONE)
> > >> > >> >>> >> > datadir = os.getcwd()
> > >> > >> >>> >> > print datadir
> > >> > >> >>> >> > t=IMP.atom.read_pdb( datadir+'/' + file, m,
> > >> > >> >>> >> >
> > IMP.atom.ATOMPDBSelector())
> > >> > >> >>> >> > del sls
> > >> > >> >>> >> > #IMP.atom.show_molecular_hierarchy(t)
> > >> > >> >>> >> > c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> > >> > >> >>> >> > IMP.atom.CHAIN_TYPE)[0])
> > >> > >> >>> >> > if c.get_number_of_children()==0:
> > >> > >> >>> >> > IMP.atom.show_molecular_hierarchy(t)
> > >> > >> >>> >> > # there is no reason to use all atoms, just
> > >> > >> approximate
> > >> > >> >>> the
> > >> > >> >>> >> > pdb shape instead
> > >> > >> >>> >> >
> s=IMP.atom.create_simplified_along_backbone(c,
> > >> > >> >>> >> >
> > >> > >> >>> >> resolution/300.0)
> > >> > >> >>> >> > IMP.atom.destroy(t)
> > >> > >> >>> >> > # make the simplified structure rigid
> > >> > >> >>> >> > rb=IMP.atom.create_rigid_body(s)
> > >> > >> >>> >> > # rb=IMP.atom.create_rigid_body(c)
> > >> > >> >>> >> > rb.set_coordinates_are_optimized(True)
> > >> > >> >>> >> > return s
> > >> > >> >>> >> > # return c
> > >> > >> >>> >> >
> > >> > >> >>> >> > h= create_from_pdb(files[0])
> > >> > >> >>> >> > h.set_name(name)
> > >> > >> >>> >> > all.add_child(h)
> > >> > >> >>> >> >
> > >> > >> >>> >> > create_protein_from_pdbs("A", [Firstpdb])
> > >> > >> >>> >> > create_protein_from_pdbs("B", [Secondpdb])
> > >> > >> >>> >> > create_protein_from_pdbs("C", [Thirdpdb])
> > >> > >> >>> >> > create_protein_from_pdbs("D", [Fourthpdb])
> > >> > >> >>> >> > #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
> > >> > >> >>> >> > return (m, all)
> > >> > >> >>> >> >
> > >> > >> >>> >> > # create the needed restraints and add them to the model
> > >> > >> >>> >> >
> > >> > >> >>> >> > def create_restraints(m, all):
> > >> > >> >>> >> > def add_connectivity_restraint(s):
> > >> > >> >>> >> >
> > >> > >> >>> >> > tr= IMP.core.TableRefiner()
> > >> > >> >>> >> > rps=[]
> > >> > >> >>> >> > for sc in s:
> > >> > >> >>> >> > ps= sc.get_selected_particles()
> > >> > >> >>> >> > rps.append(ps[0])
> > >> > >> >>> >> > tr.add_particle(ps[0], ps)
> > >> > >> >>> >> >
> > >> > >> >>> >> > # duplicate the
> > >> IMP.atom.create_connectivity_restraint
> > >> > >> >>> >> > functionality
> > >> > >> >>> >> >
> > >> > >> >>> >> > score=
> > >> > >> >>> >> >
> > >> > >> >>> >>
> > >> > >> >>>
> > >> > >>
> > >> >
> > >>
> >
> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
> > >> > >> >>> >> >
> > >> > >> >>> >> > r= IMP.core.MSConnectivityRestraint(m,score)
> > >> > >> >>> >> >
> > >> > >> >>> >> > iA = r.add_type([rps[0]])
> > >> > >> >>> >> > iB = r.add_type([rps[1]])
> > >> > >> >>> >> > iC = r.add_type([rps[2]])
> > >> > >> >>> >> > iD = r.add_type([rps[3]])
> > >> > >> >>> >> > n1 = r.add_composite([iA, iB, iC, iD])
> > >> > >> >>> >> > n2 = r.add_composite([iA, iB], n1)
> > >> > >> >>> >> > n3 = r.add_composite([iC, iD], n1)
> > >> > >> >>> >> > n4 = r.add_composite([iB, iC, iD], n1)
> > >> > >> >>> >> >
> > >> > >> >>> >> > m.add_restraint(r)
> > >> > >> >>> >> >
> > >> > >> >>> >> > evr=IMP.atom.create_excluded_volume_restraint([all])
> > >> > >> >>> >> > m.add_restraint(evr)
> > >> > >> >>> >> > # a Selection allows for natural specification of
> what
> > >> the
> > >> > >> >>> >> restraints
> > >> > >> >>> >> > act on
> > >> > >> >>> >> > S= IMP.atom.Selection
> > >> > >> >>> >> > sA=S(hierarchy=all, molecule="A")
> > >> > >> >>> >> > sB=S(hierarchy=all, molecule="B")
> > >> > >> >>> >> > sC=S(hierarchy=all, molecule="C")
> > >> > >> >>> >> > sD=S(hierarchy=all, molecule="D")
> > >> > >> >>> >> > add_connectivity_restraint([sA, sB, sC, sD])
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >> > # find acceptable conformations of the model
> > >> > >> >>> >> > def get_conformations(m):
> > >> > >> >>> >> > sampler= IMP.core.MCCGSampler(m)
> > >> > >> >>> >> > sampler.set_bounding_box(bb)
> > >> > >> >>> >> > # magic numbers, experiment with them and make them
> > >> large
> > >> > >> >>> enough for
> > >> > >> >>> >> > things to work
> > >> > >> >>> >> > sampler.set_number_of_conjugate_gradient_steps(100)
> > >> > >> >>> >> > sampler.set_number_of_monte_carlo_steps(20)
> > >> > >> >>> >> > sampler.set_number_of_attempts(models)
> > >> > >> >>> >> > # We don't care to see the output from the sampler
> > >> > >> >>> >> > sampler.set_log_level(IMP.SILENT)
> > >> > >> >>> >> > # return the IMP.ConfigurationSet storing all the
> > found
> > >> > >> >>> >> configurations
> > >> > >> >>> >> > that
> > >> > >> >>> >> > # meet the various restraint maximum scores.
> > >> > >> >>> >> > cs= sampler.create_sample()
> > >> > >> >>> >> > return cs
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >> > # cluster the conformations and write them to a file
> > >> > >> >>> >> > def analyze_conformations(cs, all, gs):
> > >> > >> >>> >> > # we want to cluster the configurations to make them
> > >> easier
> > >> > >> to
> > >> > >> >>> >> > understand
> > >> > >> >>> >> > # in the case, the clustering is pretty meaningless
> > >> > >> >>> >> > embed=
> IMP.statistics.ConfigurationSetXYZEmbedding(cs,
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)),
> > >> > >> >>> True)
> > >> > >> >>> >> > cluster= IMP.statistics.create_lloyds_kmeans(embed,
> > 10,
> > >> > >> 10000)
> > >> > >> >>> >> > # dump each cluster center to a file so it can be
> > >> viewed.
> > >> > >> >>> >> > for i in range(cluster.get_number_of_clusters()):
> > >> > >> >>> >> > center= cluster.get_cluster_center(i)
> > >> > >> >>> >> > cs.load_configuration(i)
> > >> > >> >>> >> > w= IMP.display.PymolWriter("cluster.%d.pym"%i)
> > >> > >> >>> >> > for g in gs:
> > >> > >> >>> >> > w.add_geometry(g)
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >>
> > >> > >> >>>
> > >> > >>
> > >> >
> > >>
> >
> #******************************************************************************************
> > >> > >> >>> >> > # now do the actual work
> > >> > >> >>> >> >
> > >> > >> >>> >> > (m,all)= create_representation()
> > >> > >> >>> >> > IMP.atom.show_molecular_hierarchy(all)
> > >> > >> >>> >> > create_restraints(m, all)
> > >> > >> >>> >> >
> > >> > >> >>> >> > # in order to display the results, we need something
> that
> > >> maps
> > >> > >> the
> > >> > >> >>> >> > particles onto
> > >> > >> >>> >> > # geometric objets. The IMP.display.Geometry objects do
> > this
> > >> > >> >>> mapping.
> > >> > >> >>> >> > # IMP.display.XYZRGeometry map an IMP.core.XYZR particle
> > >> onto a
> > >> > >> >>> sphere
> > >> > >> >>> >> > gs=[]
> > >> > >> >>> >> > for i in range(all.get_number_of_children()):
> > >> > >> >>> >> > color= IMP.display.get_display_color(i)
> > >> > >> >>> >> > n= all.get_child(i)
> > >> > >> >>> >> > name= n.get_name()
> > >> > >> >>> >> > g= IMP.atom.HierarchyGeometry(n)
> > >> > >> >>> >> > g.set_color(color)
> > >> > >> >>> >> > gs.append(g)
> > >> > >> >>> >> >
> > >> > >> >>> >> > cs= get_conformations(m)
> > >> > >> >>> >> >
> > >> > >> >>> >> > print "found", cs.get_number_of_configurations(),
> > >> "solutions"
> > >> > >> >>> >> >
> > >> > >> >>> >> > ListScores = []
> > >> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> > >> > >> >>> >> > cs.load_configuration(i)
> > >> > >> >>> >> > # print the configuration
> > >> > >> >>> >> > print "solution number: ",i,"scored :",
> > >> > m.evaluate(False)
> > >> > >> >>> >> > ListScores.append(m.evaluate(False))
> > >> > >> >>> >> >
> > >> > >> >>> >> > f1 = open("out_scores.csv", "w")
> > >> > >> >>> >> > f1.write("\n".join(map(lambda x: str(x), ListScores)))
> > >> > >> >>> >> > f1.close()
> > >> > >> >>> >> >
> > >> > >> >>> >> > # for each of the configuration, dump it to a file to
> view
> > >> in
> > >> > >> pymol
> > >> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> > >> > >> >>> >> > JOSH = cs.load_configuration(i)
> > >> > >> >>> >> > S= IMP.atom.Selection
> > >> > >> >>> >> > h= IMP.atom.Hierarchy.get_children(cs)
> > >> > >> >>> >> > tfn = IMP.create_temporary_file_name("josh%d"%i,
> > ".rmf")
> > >> > >> >>> >> > rh = RMF.create_rmf_file(tfn)
> > >> > >> >>> >> >
> > >> > >> >>> >> > # add the hierarchy to the file
> > >> > >> >>> >> > IMP.rmf.add_hierarchies(rh, h)
> > >> > >> >>> >> >
> > >> > >> >>> >> > # add the current configuration to the file as
> frame 0
> > >> > >> >>> >> > IMP.rmf.save_frame(rh)
> > >> > >> >>> >> >
> > >> > >> >>> >> > for g in gs:
> > >> > >> >>> >> > w.add_geometry(g)
> > >> > >> >>> >> >
> > >> > >> >>> >> > analyze_conformations(cs, all, gs)
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >> > _______________________________________________
> > >> > >> >>> >> > IMP-users mailing list
> > >> > >> >>> >> > IMP-users(a)salilab.org
> > >> > >> >>> >> > https://salilab.org/mailman/listinfo/imp-users
> > >> > >> >>> >> >
> > >> > >> >>> >> >
> > >> > >> >>> >>
> > >> > >> >>> >>
> > >> > >> >>> >> --
> > >> > >> >>> >> Barak
> > >> > >> >>> >>
1
0
so this is what is looks like with rmf_show:
https://gist.github.com/mysticvision/271d973806603967fd31
i'll email you the rmf now.
thanks !
On 3 July 2014 14:28, <imp-users-request(a)salilab.org> wrote:
> Send IMP-users mailing list submissions to
> imp-users(a)salilab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://salilab.org/mailman/listinfo/imp-users
> or, via email, send a message with subject or body 'help' to
> imp-users-request(a)salilab.org
>
> You can reach the person managing the list at
> imp-users-owner(a)salilab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IMP-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Sampling and writing to pym/rmf (Josh Bullock) (Barak Raveh)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 3 Jul 2014 06:27:55 -0700
> From: Barak Raveh <barak.raveh(a)gmail.com>
> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Josh
> Bullock)
> Message-ID:
> <
> CAHp+_UoKxFzCF8W21dQv5OhWFuSc78HZp8JdnBZH5eEjeNEEvQ(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> You can use rmf_show and rmf_show -v to view your file in human readable
> format
> http://integrativemodeling.org/rmf/nightly/doc/executables.html
>
> About chimera, are you using a latest nightly build? You can send me the
> RMF file and I'll give a look to see if it depends on the chimera version.
>
> Barak
>
>
> On Thu, Jul 3, 2014 at 5:55 AM, Josh Bullock <jma.bullock(a)gmail.com>
> wrote:
>
> > oh so there is something in the .rmf file, looks a bit garbled though ...
> > is this normal ?
> >
> > https://gist.github.com/mysticvision/271d973806603967fd31
> >
> >
> > On 3 July 2014 13:44, <imp-users-request(a)salilab.org> wrote:
> >
> >> Send IMP-users mailing list submissions to
> >> imp-users(a)salilab.org
> >>
> >> To subscribe or unsubscribe via the World Wide Web, visit
> >> https://salilab.org/mailman/listinfo/imp-users
> >> or, via email, send a message with subject or body 'help' to
> >> imp-users-request(a)salilab.org
> >>
> >> You can reach the person managing the list at
> >> imp-users-owner(a)salilab.org
> >>
> >> When replying, please edit your Subject line so it is more specific
> >> than "Re: Contents of IMP-users digest..."
> >>
> >>
> >> Today's Topics:
> >>
> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Josh Bullock)
> >>
> >>
> >> ----------------------------------------------------------------------
> >>
> >> Message: 1
> >> Date: Thu, 3 Jul 2014 13:44:22 +0100
> >> From: Josh Bullock <jma.bullock(a)gmail.com>
> >> To: imp-users(a)salilab.org
> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak Raveh)
> >> Message-ID:
> >> <CAHh_40_zsUCt4=
> >> nZbvDRd0owHzz_v_DHEiB-R+Em3ggDScS2zg(a)mail.gmail.com>
> >> Content-Type: text/plain; charset="utf-8"
> >>
> >> aha okay, so now i'm generating .rmf files however when trying to open
> >> them
> >> in chimera I get the following error:
> >>
> >> "Invalid handle returned from H5Fopen(name.c_str(), H5F_ACC_RDONLY,
> >> plist)"
> >> in file "
> >>
> >> I'm not sure whether this is because I've created empty .rmf files or
> >> something else is wrong ...
> >>
> >> the code for making the rmf files:
> >>
> >> for i in range(0, cs.get_number_of_configurations()):
> >> cs.load_configuration(i)
> >> h = IMP.atom.Hierarchy.get_children(all)
> >> tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> >> print "file is", tfn
> >> rh = RMF.create_rmf_file(tfn)
> >>
> >> # add the hierarchy to the file
> >> IMP.rmf.add_hierarchies(rh, h)
> >>
> >> # add the current configuration to the file as frame 0
> >> IMP.rmf.save_frame(rh)
> >>
> >>
> >> On 3 July 2014 00:20, <imp-users-request(a)salilab.org> wrote:
> >>
> >> > Send IMP-users mailing list submissions to
> >> > imp-users(a)salilab.org
> >> >
> >> > To subscribe or unsubscribe via the World Wide Web, visit
> >> > https://salilab.org/mailman/listinfo/imp-users
> >> > or, via email, send a message with subject or body 'help' to
> >> > imp-users-request(a)salilab.org
> >> >
> >> > You can reach the person managing the list at
> >> > imp-users-owner(a)salilab.org
> >> >
> >> > When replying, please edit your Subject line so it is more specific
> >> > than "Re: Contents of IMP-users digest..."
> >> >
> >> >
> >> > Today's Topics:
> >> >
> >> > 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> >> >
> >> >
> >> > ----------------------------------------------------------------------
> >> >
> >> > Message: 1
> >> > Date: Wed, 2 Jul 2014 16:20:19 -0700
> >> > From: Barak Raveh <barak.raveh(a)gmail.com>
> >> > To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> >> > Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> >> > Message-ID:
> >> > <
> >> > CAHp+_Uoq-HAyca9AX_pFcEje32ke3J3KuKZWYfuj+M8SZWUkCw(a)mail.gmail.com>
> >> > Content-Type: text/plain; charset="utf-8"
> >> >
> >> > Hi Josh,
> >> >
> >> > An IMP model contains a list of particles that are tightly associated
> >> with
> >> > it (a particle does not exist outside the context of a model). Given
> the
> >> > disclaimer that I have never used ConfigurationSet, my understanding
> >> from
> >> > its documentation is that when you load a configuration, the values of
> >> the
> >> > particles within the model are updated accordingly. If I understand
> your
> >> > code correctly, 'all' is the root of the hierarchy in your model, so
> it
> >> is
> >> > 'all' that you should add to the rmf. The values of 'all' and all of
> its
> >> > children are supposed to update when you load a configuration,
> >> > automatically.
> >> >
> >> > All that being said said - use this advice at own risk, perhaps
> someone
> >> > could advise you better. Let me know if you have more questions.
> >> >
> >> > Barak
> >> >
> >> >
> >> > On Wed, Jul 2, 2014 at 3:42 PM, Josh Bullock <jma.bullock(a)gmail.com>
> >> > wrote:
> >> >
> >> > >
> >> > >
> >> > > Conceptually I do ( i think ... ) but not practically. I'm hoping to
> >> view
> >> > > each of the models i created - with MSrestraints - separately as an
> >> .rmf
> >> > in
> >> > > chimera, just so i can see what i'm making !
> >> > >
> >> > > so i have created my models using:
> >> > >
> >> > > cs= get_conformations(m)
> >> > >
> >> > > do i have to assign each model to a particle before i can write it
> to
> >> an
> >> > > .rmf ? Or is each model already a particle with hierarchy ?
> >> > >
> >> > > -------------------------------------------
> >> > >
> >> > > for i in range(0, cs.get_number_of_configurations()):
> >> > > cs.load_configuration(i)
> >> > > h = IMP.atom.Hierarchy(m) # <------- how do i call the
> >> hierarchy
> >> > of
> >> > > the current loaded configuration ?
> >> > > c = p.get_children(h)
> >> > > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> >> > > rh = RMF.create_rmf_file(tfn)
> >> > >
> >> > > # add the hierarchy to the file
> >> > > IMP.rmf.add_hierarchies(rh, h)
> >> > >
> >> > > # add the current configuration to the file as frame 0
> >> > > IMP.rmf.save_frame(rh)
> >> > >
> >> > > On 2 July 2014 23:03, <imp-users-request(a)salilab.org> wrote:
> >> > >
> >> > >> Send IMP-users mailing list submissions to
> >> > >> imp-users(a)salilab.org
> >> > >>
> >> > >> To subscribe or unsubscribe via the World Wide Web, visit
> >> > >> https://salilab.org/mailman/listinfo/imp-users
> >> > >> or, via email, send a message with subject or body 'help' to
> >> > >> imp-users-request(a)salilab.org
> >> > >>
> >> > >> You can reach the person managing the list at
> >> > >> imp-users-owner(a)salilab.org
> >> > >>
> >> > >> When replying, please edit your Subject line so it is more specific
> >> > >> than "Re: Contents of IMP-users digest..."
> >> > >>
> >> > >>
> >> > >> Today's Topics:
> >> > >>
> >> > >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> >> > >>
> >> > >>
> >> > >>
> >> ----------------------------------------------------------------------
> >> > >>
> >> > >> Message: 1
> >> > >> Date: Wed, 2 Jul 2014 15:03:19 -0700
> >> > >>
> >> > >> From: Barak Raveh <barak.raveh(a)gmail.com>
> >> > >> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> >> > >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> >> > >> Message-ID:
> >> > >> <CAHp+_UqO8rXRMsUSndbg-c0jyDxnswDe9aFKvW889gGMU=
> >> > >> 4MMQ(a)mail.gmail.com>
> >> > >> Content-Type: text/plain; charset="utf-8"
> >> > >>
> >> > >>
> >> > >> * I meant
> >> > >>
> >> > >> h = IMP.atom.Hierarchy(p)
> >> > >> c = p.get_children(h)
> >> > >>
> >> > >> this assumes that particle p was already decorated as Hierarchy
> (let
> >> me
> >> > >> know if you are not familiar with decorators, Hierarchy, or
> >> Particle).
> >> > >>
> >> > >>
> >> > >>
> >> > >> On Wed, Jul 2, 2014 at 3:02 PM, Barak Raveh <barak.raveh(a)gmail.com
> >
> >> > >> wrote:
> >> > >>
> >> > >> > Hi Josh,
> >> > >> >
> >> > >> > I think get_children() is only a member function of Hierarchy, so
> >> you
> >> > >> > should do something like
> >> > >> >
> >> > >> > IMP.atom.Hierarchy(p)
> >> > >> > c = p.get_children()
> >> > >> >
> >> > >> > 'cs' seems to be a ConfigurationSet object - are you sure that
> you
> >> > >> expect
> >> > >> > it to have children?
> >> > >> >
> >> > >> > What do you want to do?
> >> > >> >
> >> > >> > Cheers,
> >> > >> > Barak
> >> > >> >
> >> > >> > On Wed, Jul 2, 2014 at 1:42 PM, Josh Bullock <
> >> jma.bullock(a)gmail.com>
> >> > >> > wrote:
> >> > >> >
> >> > >> >> ah sorry ! this line gives me the error
> >> > >> >>
> >> > >> >> h= IMP.atom.Hierarchy.get_children(cs)
> >> > >> >>
> >> > >> >> thanks
> >> > >> >>
> >> > >> >> josh
> >> > >> >>
> >> > >> >> On 2 July 2014 17:45, <imp-users-request(a)salilab.org> wrote:
> >> > >> >>
> >> > >> >>> Send IMP-users mailing list submissions to
> >> > >> >>> imp-users(a)salilab.org
> >> > >> >>>
> >> > >> >>> To subscribe or unsubscribe via the World Wide Web, visit
> >> > >> >>> https://salilab.org/mailman/listinfo/imp-users
> >> > >> >>> or, via email, send a message with subject or body 'help' to
> >> > >> >>> imp-users-request(a)salilab.org
> >> > >> >>>
> >> > >> >>> You can reach the person managing the list at
> >> > >> >>> imp-users-owner(a)salilab.org
> >> > >> >>>
> >> > >> >>> When replying, please edit your Subject line so it is more
> >> specific
> >> > >> >>> than "Re: Contents of IMP-users digest..."
> >> > >> >>>
> >> > >> >>>
> >> > >> >>> Today's Topics:
> >> > >> >>>
> >> > >> >>> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Barak
> >> > Raveh)
> >> > >> >>>
> >> > >> >>>
> >> > >> >>>
> >> > ----------------------------------------------------------------------
> >> > >> >>>
> >> > >> >>> Message: 1
> >> > >> >>> Date: Wed, 2 Jul 2014 09:45:30 -0700
> >> > >> >>> From: Barak Raveh <barak.raveh(a)gmail.com>
> >> > >> >>> To: Help and discussion for users of IMP <
> imp-users(a)salilab.org>
> >> > >> >>> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak
> >> > Raveh)
> >> > >> >>> Message-ID:
> >> > >> >>> <CAHp+_Uo19VasJDJYi+2CoUUu=
> >> > >> >>> u_6duKCraVetU4dW45+oDhTAw(a)mail.gmail.com>
> >> > >> >>> Content-Type: text/plain; charset="utf-8"
> >> > >> >>>
> >> > >> >>> Which lines throws the error?
> >> > >> >>>
> >> > >> >>>
> >> > >> >>> On Wed, Jul 2, 2014 at 4:56 AM, Josh Bullock <
> >> jma.bullock(a)gmail.com
> >> > >
> >> > >> >>> wrote:
> >> > >> >>>
> >> > >> >>> > Hi Barek,
> >> > >> >>> >
> >> > >> >>> > So I'm not giving hierarchy.get_children the correct input:
> >> > >> >>> >
> >> > >> >>> > TypeError: unbound method get_children() must be called with
> >> > >> Hierarchy
> >> > >> >>> > instance as first argument (got ConfigurationSet instance
> >> instead)
> >> > >> >>> >
> >> > >> >>> > I'm not sure which argument is the hierarchy instance.
> >> > >> >>> >
> >> > >> >>> > Thanks,
> >> > >> >>> >
> >> > >> >>> > Josh
> >> > >> >>> >
> >> > >> >>> > -------------------------------------------------
> >> > >> >>> >
> >> > >> >>> > cs= get_conformations(m)
> >> > >> >>>
> >> > >> >>> >
> >> > >> >>> > for i in range(0, cs.get_number_of_configurations()):
> >> > >> >>> > JOSH = cs.load_configuration(i)
> >> > >> >>> > S= IMP.atom.Selection
> >> > >> >>> > h= IMP.atom.Hierarchy.get_children(cs)
> >> > >> >>> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> >> > >> >>> > rh = RMF.create_rmf_file(tfn)
> >> > >> >>> >
> >> > >> >>> > On 1 July 2014 17:31, <imp-users-request(a)salilab.org> wrote:
> >> > >> >>> >
> >> > >> >>> >> Send IMP-users mailing list submissions to
> >> > >> >>> >> imp-users(a)salilab.org
> >> > >> >>> >>
> >> > >> >>> >> To subscribe or unsubscribe via the World Wide Web, visit
> >> > >> >>> >> https://salilab.org/mailman/listinfo/imp-users
> >> > >> >>> >> or, via email, send a message with subject or body 'help' to
> >> > >> >>> >> imp-users-request(a)salilab.org
> >> > >> >>> >>
> >> > >> >>> >> You can reach the person managing the list at
> >> > >> >>> >> imp-users-owner(a)salilab.org
> >> > >> >>> >>
> >> > >> >>> >> When replying, please edit your Subject line so it is more
> >> > specific
> >> > >> >>> >> than "Re: Contents of IMP-users digest..."
> >> > >> >>> >>
> >> > >> >>> >>
> >> > >> >>> >> Today's Topics:
> >> > >> >>> >>
> >> > >> >>> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> >> > >> >>> >>
> >> > >> >>> >>
> >> > >> >>> >>
> >> > >>
> >> ----------------------------------------------------------------------
> >> > >> >>> >>
> >> > >> >>> >> Message: 1
> >> > >> >>> >> Date: Tue, 1 Jul 2014 09:31:33 -0700
> >> > >> >>> >> From: Barak Raveh <barak.raveh(a)gmail.com>
> >> > >> >>> >> To: Help and discussion for users of IMP <
> >> imp-users(a)salilab.org>
> >> > >> >>> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> >> > >> >>> >> Message-ID:
> >> > >> >>> >> <CAHp+_UowiBwJozbwOfi8yFEVt7Z8o2tEZ=
> >> > >> >>> >> LvYPnJh-LjpC2cSA(a)mail.gmail.com>
> >> > >> >>> >> Content-Type: text/plain; charset="utf-8"
> >> > >> >>>
> >> > >> >>> >>
> >> > >> >>> >> Hi Josh, from a very superficial look, your code to write
> the
> >> RMF
> >> > >> >>> files
> >> > >> >>> >> seems fine - do you get an output RMF file? Could you load
> it
> >> in
> >> > >> >>> Chimera?
> >> > >> >>> >>
> >> > >> >>> >>
> >> > >> >>> >> On Tue, Jul 1, 2014 at 2:40 AM, Josh Bullock <
> >> > >> jma.bullock(a)gmail.com>
> >> > >> >>> >> wrote:
> >> > >> >>> >>
> >> > >> >>> >> > Hello,
> >> > >> >>> >> >
> >> > >> >>> >> > I'm relatively new to all this so please let me know if
> i'm
> >> > >> making
> >> > >> >>> any
> >> > >> >>> >> > obvious errors ...
> >> > >> >>> >> >
> >> > >> >>> >> > Essentially all i'm trying to do is generate an ensemble
> of
> >> > >> models
> >> > >> >>> made
> >> > >> >>> >> > from four subunits - constrained by MS connectivity
> >> restraints.
> >> > >> The
> >> > >> >>> >> models
> >> > >> >>> >> > get scored but nothing seems to write to the pymol file.
> >> > Ideally
> >> > >> i'd
> >> > >> >>> >> like
> >> > >> >>> >> > to write to an .rmf but i haven't worked that one out
> either
> >> > ...
> >> > >> >>> >> >
> >> > >> >>> >> > Is this a reasonable way to go about my problem ?
> >> > >> >>> >> >
> >> > >> >>> >> > Many thanks,
> >> > >> >>> >> >
> >> > >> >>> >> > Josh
> >> > >> >>> >> >
> >> > >> >>> >> > -------------------------------------------
> >> > >> >>> >> >
> >> > >> >>> >> > import IMP
> >> > >> >>> >> > import IMP.atom
> >> > >> >>> >> > import IMP.rmf
> >> > >> >>> >> > import inspect
> >> > >> >>> >> > import IMP.container
> >> > >> >>> >> > import IMP.display
> >> > >> >>> >> > import IMP.statistics
> >> > >> >>> >> > #import IMP.example
> >> > >> >>> >> > import sys, math, os, optparse
> >> > >> >>> >> > import RMF
> >> > >> >>> >> >
> >> > >> >>> >> > from optparse import OptionParser
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >> > # Convert the arguments into strings and number
> >> > >> >>> >> > Firstpdb = str(sys.argv[1])
> >> > >> >>> >> > Secondpdb = str(sys.argv[2])
> >> > >> >>> >> > Thirdpdb = str(sys.argv[3])
> >> > >> >>> >> > Fourthpdb = str(sys.argv[4])
> >> > >> >>> >> > models = float(sys.argv[5])
> >> > >> >>> >> >
> >> > >> >>> >> > #*****************************************
> >> > >> >>> >> >
> >> > >> >>> >> > # the spring constant to use, it doesnt really matter
> >> > >> >>> >> > k=100
> >> > >> >>> >> > # the target resolution for the representation, this is
> >> used to
> >> > >> >>> specify
> >> > >> >>> >> > how detailed
> >> > >> >>> >> > # the representation used should be
> >> > >> >>> >> > resolution=300
> >> > >> >>> >> > # the box to perform everything
> >> > >> >>> >> > bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
> >> > >> >>> >> > IMP.algebra.Vector3D(300,
> 300,
> >> > 300))
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >> > # this function creates the molecular hierarchies for the
> >> > various
> >> > >> >>> >> involved
> >> > >> >>> >> > proteins
> >> > >> >>> >> > def create_representation():
> >> > >> >>> >> > m= IMP.Model()
> >> > >> >>> >> > all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> >> > >> >>> >> > all.set_name("the universe")
> >> > >> >>> >> > # create a protein, represented as a set of connected
> >> balls
> >> > >> of
> >> > >> >>> >> > appropriate
> >> > >> >>> >> > # radii and number, chose by the resolution parameter
> >> and
> >> > the
> >> > >> >>> >> number of
> >> > >> >>> >> > # amino acids.
> >> > >> >>> >> >
> >> > >> >>> >> > def create_protein_from_pdbs(name, files):
> >> > >> >>> >> >
> >> > >> >>> >> > def create_from_pdb(file):
> >> > >> >>> >> > sls=IMP.SetLogState(IMP.NONE)
> >> > >> >>> >> > datadir = os.getcwd()
> >> > >> >>> >> > print datadir
> >> > >> >>> >> > t=IMP.atom.read_pdb( datadir+'/' + file, m,
> >> > >> >>> >> >
> IMP.atom.ATOMPDBSelector())
> >> > >> >>> >> > del sls
> >> > >> >>> >> > #IMP.atom.show_molecular_hierarchy(t)
> >> > >> >>> >> > c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> >> > >> >>> >> > IMP.atom.CHAIN_TYPE)[0])
> >> > >> >>> >> > if c.get_number_of_children()==0:
> >> > >> >>> >> > IMP.atom.show_molecular_hierarchy(t)
> >> > >> >>> >> > # there is no reason to use all atoms, just
> >> > >> approximate
> >> > >> >>> the
> >> > >> >>> >> > pdb shape instead
> >> > >> >>> >> > s=IMP.atom.create_simplified_along_backbone(c,
> >> > >> >>> >> >
> >> > >> >>> >> resolution/300.0)
> >> > >> >>> >> > IMP.atom.destroy(t)
> >> > >> >>> >> > # make the simplified structure rigid
> >> > >> >>> >> > rb=IMP.atom.create_rigid_body(s)
> >> > >> >>> >> > # rb=IMP.atom.create_rigid_body(c)
> >> > >> >>> >> > rb.set_coordinates_are_optimized(True)
> >> > >> >>> >> > return s
> >> > >> >>> >> > # return c
> >> > >> >>> >> >
> >> > >> >>> >> > h= create_from_pdb(files[0])
> >> > >> >>> >> > h.set_name(name)
> >> > >> >>> >> > all.add_child(h)
> >> > >> >>> >> >
> >> > >> >>> >> > create_protein_from_pdbs("A", [Firstpdb])
> >> > >> >>> >> > create_protein_from_pdbs("B", [Secondpdb])
> >> > >> >>> >> > create_protein_from_pdbs("C", [Thirdpdb])
> >> > >> >>> >> > create_protein_from_pdbs("D", [Fourthpdb])
> >> > >> >>> >> > #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
> >> > >> >>> >> > return (m, all)
> >> > >> >>> >> >
> >> > >> >>> >> > # create the needed restraints and add them to the model
> >> > >> >>> >> >
> >> > >> >>> >> > def create_restraints(m, all):
> >> > >> >>> >> > def add_connectivity_restraint(s):
> >> > >> >>> >> >
> >> > >> >>> >> > tr= IMP.core.TableRefiner()
> >> > >> >>> >> > rps=[]
> >> > >> >>> >> > for sc in s:
> >> > >> >>> >> > ps= sc.get_selected_particles()
> >> > >> >>> >> > rps.append(ps[0])
> >> > >> >>> >> > tr.add_particle(ps[0], ps)
> >> > >> >>> >> >
> >> > >> >>> >> > # duplicate the
> >> IMP.atom.create_connectivity_restraint
> >> > >> >>> >> > functionality
> >> > >> >>> >> >
> >> > >> >>> >> > score=
> >> > >> >>> >> >
> >> > >> >>> >>
> >> > >> >>>
> >> > >>
> >> >
> >>
> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
> >> > >> >>> >> >
> >> > >> >>> >> > r= IMP.core.MSConnectivityRestraint(m,score)
> >> > >> >>> >> >
> >> > >> >>> >> > iA = r.add_type([rps[0]])
> >> > >> >>> >> > iB = r.add_type([rps[1]])
> >> > >> >>> >> > iC = r.add_type([rps[2]])
> >> > >> >>> >> > iD = r.add_type([rps[3]])
> >> > >> >>> >> > n1 = r.add_composite([iA, iB, iC, iD])
> >> > >> >>> >> > n2 = r.add_composite([iA, iB], n1)
> >> > >> >>> >> > n3 = r.add_composite([iC, iD], n1)
> >> > >> >>> >> > n4 = r.add_composite([iB, iC, iD], n1)
> >> > >> >>> >> >
> >> > >> >>> >> > m.add_restraint(r)
> >> > >> >>> >> >
> >> > >> >>> >> > evr=IMP.atom.create_excluded_volume_restraint([all])
> >> > >> >>> >> > m.add_restraint(evr)
> >> > >> >>> >> > # a Selection allows for natural specification of what
> >> the
> >> > >> >>> >> restraints
> >> > >> >>> >> > act on
> >> > >> >>> >> > S= IMP.atom.Selection
> >> > >> >>> >> > sA=S(hierarchy=all, molecule="A")
> >> > >> >>> >> > sB=S(hierarchy=all, molecule="B")
> >> > >> >>> >> > sC=S(hierarchy=all, molecule="C")
> >> > >> >>> >> > sD=S(hierarchy=all, molecule="D")
> >> > >> >>> >> > add_connectivity_restraint([sA, sB, sC, sD])
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >> > # find acceptable conformations of the model
> >> > >> >>> >> > def get_conformations(m):
> >> > >> >>> >> > sampler= IMP.core.MCCGSampler(m)
> >> > >> >>> >> > sampler.set_bounding_box(bb)
> >> > >> >>> >> > # magic numbers, experiment with them and make them
> >> large
> >> > >> >>> enough for
> >> > >> >>> >> > things to work
> >> > >> >>> >> > sampler.set_number_of_conjugate_gradient_steps(100)
> >> > >> >>> >> > sampler.set_number_of_monte_carlo_steps(20)
> >> > >> >>> >> > sampler.set_number_of_attempts(models)
> >> > >> >>> >> > # We don't care to see the output from the sampler
> >> > >> >>> >> > sampler.set_log_level(IMP.SILENT)
> >> > >> >>> >> > # return the IMP.ConfigurationSet storing all the
> found
> >> > >> >>> >> configurations
> >> > >> >>> >> > that
> >> > >> >>> >> > # meet the various restraint maximum scores.
> >> > >> >>> >> > cs= sampler.create_sample()
> >> > >> >>> >> > return cs
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >> > # cluster the conformations and write them to a file
> >> > >> >>> >> > def analyze_conformations(cs, all, gs):
> >> > >> >>> >> > # we want to cluster the configurations to make them
> >> easier
> >> > >> to
> >> > >> >>> >> > understand
> >> > >> >>> >> > # in the case, the clustering is pretty meaningless
> >> > >> >>> >> > embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)),
> >> > >> >>> True)
> >> > >> >>> >> > cluster= IMP.statistics.create_lloyds_kmeans(embed,
> 10,
> >> > >> 10000)
> >> > >> >>> >> > # dump each cluster center to a file so it can be
> >> viewed.
> >> > >> >>> >> > for i in range(cluster.get_number_of_clusters()):
> >> > >> >>> >> > center= cluster.get_cluster_center(i)
> >> > >> >>> >> > cs.load_configuration(i)
> >> > >> >>> >> > w= IMP.display.PymolWriter("cluster.%d.pym"%i)
> >> > >> >>> >> > for g in gs:
> >> > >> >>> >> > w.add_geometry(g)
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >>
> >> > >> >>>
> >> > >>
> >> >
> >>
> #******************************************************************************************
> >> > >> >>> >> > # now do the actual work
> >> > >> >>> >> >
> >> > >> >>> >> > (m,all)= create_representation()
> >> > >> >>> >> > IMP.atom.show_molecular_hierarchy(all)
> >> > >> >>> >> > create_restraints(m, all)
> >> > >> >>> >> >
> >> > >> >>> >> > # in order to display the results, we need something that
> >> maps
> >> > >> the
> >> > >> >>> >> > particles onto
> >> > >> >>> >> > # geometric objets. The IMP.display.Geometry objects do
> this
> >> > >> >>> mapping.
> >> > >> >>> >> > # IMP.display.XYZRGeometry map an IMP.core.XYZR particle
> >> onto a
> >> > >> >>> sphere
> >> > >> >>> >> > gs=[]
> >> > >> >>> >> > for i in range(all.get_number_of_children()):
> >> > >> >>> >> > color= IMP.display.get_display_color(i)
> >> > >> >>> >> > n= all.get_child(i)
> >> > >> >>> >> > name= n.get_name()
> >> > >> >>> >> > g= IMP.atom.HierarchyGeometry(n)
> >> > >> >>> >> > g.set_color(color)
> >> > >> >>> >> > gs.append(g)
> >> > >> >>> >> >
> >> > >> >>> >> > cs= get_conformations(m)
> >> > >> >>> >> >
> >> > >> >>> >> > print "found", cs.get_number_of_configurations(),
> >> "solutions"
> >> > >> >>> >> >
> >> > >> >>> >> > ListScores = []
> >> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> >> > >> >>> >> > cs.load_configuration(i)
> >> > >> >>> >> > # print the configuration
> >> > >> >>> >> > print "solution number: ",i,"scored :",
> >> > m.evaluate(False)
> >> > >> >>> >> > ListScores.append(m.evaluate(False))
> >> > >> >>> >> >
> >> > >> >>> >> > f1 = open("out_scores.csv", "w")
> >> > >> >>> >> > f1.write("\n".join(map(lambda x: str(x), ListScores)))
> >> > >> >>> >> > f1.close()
> >> > >> >>> >> >
> >> > >> >>> >> > # for each of the configuration, dump it to a file to view
> >> in
> >> > >> pymol
> >> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> >> > >> >>> >> > JOSH = cs.load_configuration(i)
> >> > >> >>> >> > S= IMP.atom.Selection
> >> > >> >>> >> > h= IMP.atom.Hierarchy.get_children(cs)
> >> > >> >>> >> > tfn = IMP.create_temporary_file_name("josh%d"%i,
> ".rmf")
> >> > >> >>> >> > rh = RMF.create_rmf_file(tfn)
> >> > >> >>> >> >
> >> > >> >>> >> > # add the hierarchy to the file
> >> > >> >>> >> > IMP.rmf.add_hierarchies(rh, h)
> >> > >> >>> >> >
> >> > >> >>> >> > # add the current configuration to the file as frame 0
> >> > >> >>> >> > IMP.rmf.save_frame(rh)
> >> > >> >>> >> >
> >> > >> >>> >> > for g in gs:
> >> > >> >>> >> > w.add_geometry(g)
> >> > >> >>> >> >
> >> > >> >>> >> > analyze_conformations(cs, all, gs)
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >> > _______________________________________________
> >> > >> >>> >> > IMP-users mailing list
> >> > >> >>> >> > IMP-users(a)salilab.org
> >> > >> >>> >> > https://salilab.org/mailman/listinfo/imp-users
> >> > >> >>> >> >
> >> > >> >>> >> >
> >> > >> >>> >>
> >> > >> >>> >>
> >> > >> >>> >> --
> >> > >> >>> >> Barak
> >> > >> >>> >>
1
0
03 Jul '14
oh so there is something in the .rmf file, looks a bit garbled though ...
is this normal ?
https://gist.github.com/mysticvision/271d973806603967fd31
On 3 July 2014 13:44, <imp-users-request(a)salilab.org> wrote:
> Send IMP-users mailing list submissions to
> imp-users(a)salilab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://salilab.org/mailman/listinfo/imp-users
> or, via email, send a message with subject or body 'help' to
> imp-users-request(a)salilab.org
>
> You can reach the person managing the list at
> imp-users-owner(a)salilab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IMP-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Josh Bullock)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 3 Jul 2014 13:44:22 +0100
> From: Josh Bullock <jma.bullock(a)gmail.com>
> To: imp-users(a)salilab.org
> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak Raveh)
> Message-ID:
> <CAHh_40_zsUCt4=
> nZbvDRd0owHzz_v_DHEiB-R+Em3ggDScS2zg(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> aha okay, so now i'm generating .rmf files however when trying to open them
> in chimera I get the following error:
>
> "Invalid handle returned from H5Fopen(name.c_str(), H5F_ACC_RDONLY, plist)"
> in file "
>
> I'm not sure whether this is because I've created empty .rmf files or
> something else is wrong ...
>
> the code for making the rmf files:
>
> for i in range(0, cs.get_number_of_configurations()):
> cs.load_configuration(i)
> h = IMP.atom.Hierarchy.get_children(all)
> tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> print "file is", tfn
> rh = RMF.create_rmf_file(tfn)
>
> # add the hierarchy to the file
> IMP.rmf.add_hierarchies(rh, h)
>
> # add the current configuration to the file as frame 0
> IMP.rmf.save_frame(rh)
>
>
> On 3 July 2014 00:20, <imp-users-request(a)salilab.org> wrote:
>
> > Send IMP-users mailing list submissions to
> > imp-users(a)salilab.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > https://salilab.org/mailman/listinfo/imp-users
> > or, via email, send a message with subject or body 'help' to
> > imp-users-request(a)salilab.org
> >
> > You can reach the person managing the list at
> > imp-users-owner(a)salilab.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of IMP-users digest..."
> >
> >
> > Today's Topics:
> >
> > 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Wed, 2 Jul 2014 16:20:19 -0700
> > From: Barak Raveh <barak.raveh(a)gmail.com>
> > To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> > Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> > Message-ID:
> > <
> > CAHp+_Uoq-HAyca9AX_pFcEje32ke3J3KuKZWYfuj+M8SZWUkCw(a)mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Hi Josh,
> >
> > An IMP model contains a list of particles that are tightly associated
> with
> > it (a particle does not exist outside the context of a model). Given the
> > disclaimer that I have never used ConfigurationSet, my understanding from
> > its documentation is that when you load a configuration, the values of
> the
> > particles within the model are updated accordingly. If I understand your
> > code correctly, 'all' is the root of the hierarchy in your model, so it
> is
> > 'all' that you should add to the rmf. The values of 'all' and all of its
> > children are supposed to update when you load a configuration,
> > automatically.
> >
> > All that being said said - use this advice at own risk, perhaps someone
> > could advise you better. Let me know if you have more questions.
> >
> > Barak
> >
> >
> > On Wed, Jul 2, 2014 at 3:42 PM, Josh Bullock <jma.bullock(a)gmail.com>
> > wrote:
> >
> > >
> > >
> > > Conceptually I do ( i think ... ) but not practically. I'm hoping to
> view
> > > each of the models i created - with MSrestraints - separately as an
> .rmf
> > in
> > > chimera, just so i can see what i'm making !
> > >
> > > so i have created my models using:
> > >
> > > cs= get_conformations(m)
> > >
> > > do i have to assign each model to a particle before i can write it to
> an
> > > .rmf ? Or is each model already a particle with hierarchy ?
> > >
> > > -------------------------------------------
> > >
> > > for i in range(0, cs.get_number_of_configurations()):
> > > cs.load_configuration(i)
> > > h = IMP.atom.Hierarchy(m) # <------- how do i call the hierarchy
> > of
> > > the current loaded configuration ?
> > > c = p.get_children(h)
> > > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> > > rh = RMF.create_rmf_file(tfn)
> > >
> > > # add the hierarchy to the file
> > > IMP.rmf.add_hierarchies(rh, h)
> > >
> > > # add the current configuration to the file as frame 0
> > > IMP.rmf.save_frame(rh)
> > >
> > > On 2 July 2014 23:03, <imp-users-request(a)salilab.org> wrote:
> > >
> > >> Send IMP-users mailing list submissions to
> > >> imp-users(a)salilab.org
> > >>
> > >> To subscribe or unsubscribe via the World Wide Web, visit
> > >> https://salilab.org/mailman/listinfo/imp-users
> > >> or, via email, send a message with subject or body 'help' to
> > >> imp-users-request(a)salilab.org
> > >>
> > >> You can reach the person managing the list at
> > >> imp-users-owner(a)salilab.org
> > >>
> > >> When replying, please edit your Subject line so it is more specific
> > >> than "Re: Contents of IMP-users digest..."
> > >>
> > >>
> > >> Today's Topics:
> > >>
> > >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> > >>
> > >>
> > >> ----------------------------------------------------------------------
> > >>
> > >> Message: 1
> > >> Date: Wed, 2 Jul 2014 15:03:19 -0700
> > >>
> > >> From: Barak Raveh <barak.raveh(a)gmail.com>
> > >> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> > >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> > >> Message-ID:
> > >> <CAHp+_UqO8rXRMsUSndbg-c0jyDxnswDe9aFKvW889gGMU=
> > >> 4MMQ(a)mail.gmail.com>
> > >> Content-Type: text/plain; charset="utf-8"
> > >>
> > >>
> > >> * I meant
> > >>
> > >> h = IMP.atom.Hierarchy(p)
> > >> c = p.get_children(h)
> > >>
> > >> this assumes that particle p was already decorated as Hierarchy (let
> me
> > >> know if you are not familiar with decorators, Hierarchy, or Particle).
> > >>
> > >>
> > >>
> > >> On Wed, Jul 2, 2014 at 3:02 PM, Barak Raveh <barak.raveh(a)gmail.com>
> > >> wrote:
> > >>
> > >> > Hi Josh,
> > >> >
> > >> > I think get_children() is only a member function of Hierarchy, so
> you
> > >> > should do something like
> > >> >
> > >> > IMP.atom.Hierarchy(p)
> > >> > c = p.get_children()
> > >> >
> > >> > 'cs' seems to be a ConfigurationSet object - are you sure that you
> > >> expect
> > >> > it to have children?
> > >> >
> > >> > What do you want to do?
> > >> >
> > >> > Cheers,
> > >> > Barak
> > >> >
> > >> > On Wed, Jul 2, 2014 at 1:42 PM, Josh Bullock <jma.bullock(a)gmail.com
> >
> > >> > wrote:
> > >> >
> > >> >> ah sorry ! this line gives me the error
> > >> >>
> > >> >> h= IMP.atom.Hierarchy.get_children(cs)
> > >> >>
> > >> >> thanks
> > >> >>
> > >> >> josh
> > >> >>
> > >> >> On 2 July 2014 17:45, <imp-users-request(a)salilab.org> wrote:
> > >> >>
> > >> >>> Send IMP-users mailing list submissions to
> > >> >>> imp-users(a)salilab.org
> > >> >>>
> > >> >>> To subscribe or unsubscribe via the World Wide Web, visit
> > >> >>> https://salilab.org/mailman/listinfo/imp-users
> > >> >>> or, via email, send a message with subject or body 'help' to
> > >> >>> imp-users-request(a)salilab.org
> > >> >>>
> > >> >>> You can reach the person managing the list at
> > >> >>> imp-users-owner(a)salilab.org
> > >> >>>
> > >> >>> When replying, please edit your Subject line so it is more
> specific
> > >> >>> than "Re: Contents of IMP-users digest..."
> > >> >>>
> > >> >>>
> > >> >>> Today's Topics:
> > >> >>>
> > >> >>> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Barak
> > Raveh)
> > >> >>>
> > >> >>>
> > >> >>>
> > ----------------------------------------------------------------------
> > >> >>>
> > >> >>> Message: 1
> > >> >>> Date: Wed, 2 Jul 2014 09:45:30 -0700
> > >> >>> From: Barak Raveh <barak.raveh(a)gmail.com>
> > >> >>> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> > >> >>> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak
> > Raveh)
> > >> >>> Message-ID:
> > >> >>> <CAHp+_Uo19VasJDJYi+2CoUUu=
> > >> >>> u_6duKCraVetU4dW45+oDhTAw(a)mail.gmail.com>
> > >> >>> Content-Type: text/plain; charset="utf-8"
> > >> >>>
> > >> >>> Which lines throws the error?
> > >> >>>
> > >> >>>
> > >> >>> On Wed, Jul 2, 2014 at 4:56 AM, Josh Bullock <
> jma.bullock(a)gmail.com
> > >
> > >> >>> wrote:
> > >> >>>
> > >> >>> > Hi Barek,
> > >> >>> >
> > >> >>> > So I'm not giving hierarchy.get_children the correct input:
> > >> >>> >
> > >> >>> > TypeError: unbound method get_children() must be called with
> > >> Hierarchy
> > >> >>> > instance as first argument (got ConfigurationSet instance
> instead)
> > >> >>> >
> > >> >>> > I'm not sure which argument is the hierarchy instance.
> > >> >>> >
> > >> >>> > Thanks,
> > >> >>> >
> > >> >>> > Josh
> > >> >>> >
> > >> >>> > -------------------------------------------------
> > >> >>> >
> > >> >>> > cs= get_conformations(m)
> > >> >>>
> > >> >>> >
> > >> >>> > for i in range(0, cs.get_number_of_configurations()):
> > >> >>> > JOSH = cs.load_configuration(i)
> > >> >>> > S= IMP.atom.Selection
> > >> >>> > h= IMP.atom.Hierarchy.get_children(cs)
> > >> >>> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> > >> >>> > rh = RMF.create_rmf_file(tfn)
> > >> >>> >
> > >> >>> > On 1 July 2014 17:31, <imp-users-request(a)salilab.org> wrote:
> > >> >>> >
> > >> >>> >> Send IMP-users mailing list submissions to
> > >> >>> >> imp-users(a)salilab.org
> > >> >>> >>
> > >> >>> >> To subscribe or unsubscribe via the World Wide Web, visit
> > >> >>> >> https://salilab.org/mailman/listinfo/imp-users
> > >> >>> >> or, via email, send a message with subject or body 'help' to
> > >> >>> >> imp-users-request(a)salilab.org
> > >> >>> >>
> > >> >>> >> You can reach the person managing the list at
> > >> >>> >> imp-users-owner(a)salilab.org
> > >> >>> >>
> > >> >>> >> When replying, please edit your Subject line so it is more
> > specific
> > >> >>> >> than "Re: Contents of IMP-users digest..."
> > >> >>> >>
> > >> >>> >>
> > >> >>> >> Today's Topics:
> > >> >>> >>
> > >> >>> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> > >> >>> >>
> > >> >>> >>
> > >> >>> >>
> > >> ----------------------------------------------------------------------
> > >> >>> >>
> > >> >>> >> Message: 1
> > >> >>> >> Date: Tue, 1 Jul 2014 09:31:33 -0700
> > >> >>> >> From: Barak Raveh <barak.raveh(a)gmail.com>
> > >> >>> >> To: Help and discussion for users of IMP <
> imp-users(a)salilab.org>
> > >> >>> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> > >> >>> >> Message-ID:
> > >> >>> >> <CAHp+_UowiBwJozbwOfi8yFEVt7Z8o2tEZ=
> > >> >>> >> LvYPnJh-LjpC2cSA(a)mail.gmail.com>
> > >> >>> >> Content-Type: text/plain; charset="utf-8"
> > >> >>>
> > >> >>> >>
> > >> >>> >> Hi Josh, from a very superficial look, your code to write the
> RMF
> > >> >>> files
> > >> >>> >> seems fine - do you get an output RMF file? Could you load it
> in
> > >> >>> Chimera?
> > >> >>> >>
> > >> >>> >>
> > >> >>> >> On Tue, Jul 1, 2014 at 2:40 AM, Josh Bullock <
> > >> jma.bullock(a)gmail.com>
> > >> >>> >> wrote:
> > >> >>> >>
> > >> >>> >> > Hello,
> > >> >>> >> >
> > >> >>> >> > I'm relatively new to all this so please let me know if i'm
> > >> making
> > >> >>> any
> > >> >>> >> > obvious errors ...
> > >> >>> >> >
> > >> >>> >> > Essentially all i'm trying to do is generate an ensemble of
> > >> models
> > >> >>> made
> > >> >>> >> > from four subunits - constrained by MS connectivity
> restraints.
> > >> The
> > >> >>> >> models
> > >> >>> >> > get scored but nothing seems to write to the pymol file.
> > Ideally
> > >> i'd
> > >> >>> >> like
> > >> >>> >> > to write to an .rmf but i haven't worked that one out either
> > ...
> > >> >>> >> >
> > >> >>> >> > Is this a reasonable way to go about my problem ?
> > >> >>> >> >
> > >> >>> >> > Many thanks,
> > >> >>> >> >
> > >> >>> >> > Josh
> > >> >>> >> >
> > >> >>> >> > -------------------------------------------
> > >> >>> >> >
> > >> >>> >> > import IMP
> > >> >>> >> > import IMP.atom
> > >> >>> >> > import IMP.rmf
> > >> >>> >> > import inspect
> > >> >>> >> > import IMP.container
> > >> >>> >> > import IMP.display
> > >> >>> >> > import IMP.statistics
> > >> >>> >> > #import IMP.example
> > >> >>> >> > import sys, math, os, optparse
> > >> >>> >> > import RMF
> > >> >>> >> >
> > >> >>> >> > from optparse import OptionParser
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >> > # Convert the arguments into strings and number
> > >> >>> >> > Firstpdb = str(sys.argv[1])
> > >> >>> >> > Secondpdb = str(sys.argv[2])
> > >> >>> >> > Thirdpdb = str(sys.argv[3])
> > >> >>> >> > Fourthpdb = str(sys.argv[4])
> > >> >>> >> > models = float(sys.argv[5])
> > >> >>> >> >
> > >> >>> >> > #*****************************************
> > >> >>> >> >
> > >> >>> >> > # the spring constant to use, it doesnt really matter
> > >> >>> >> > k=100
> > >> >>> >> > # the target resolution for the representation, this is used
> to
> > >> >>> specify
> > >> >>> >> > how detailed
> > >> >>> >> > # the representation used should be
> > >> >>> >> > resolution=300
> > >> >>> >> > # the box to perform everything
> > >> >>> >> > bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
> > >> >>> >> > IMP.algebra.Vector3D(300, 300,
> > 300))
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >> > # this function creates the molecular hierarchies for the
> > various
> > >> >>> >> involved
> > >> >>> >> > proteins
> > >> >>> >> > def create_representation():
> > >> >>> >> > m= IMP.Model()
> > >> >>> >> > all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> > >> >>> >> > all.set_name("the universe")
> > >> >>> >> > # create a protein, represented as a set of connected
> balls
> > >> of
> > >> >>> >> > appropriate
> > >> >>> >> > # radii and number, chose by the resolution parameter and
> > the
> > >> >>> >> number of
> > >> >>> >> > # amino acids.
> > >> >>> >> >
> > >> >>> >> > def create_protein_from_pdbs(name, files):
> > >> >>> >> >
> > >> >>> >> > def create_from_pdb(file):
> > >> >>> >> > sls=IMP.SetLogState(IMP.NONE)
> > >> >>> >> > datadir = os.getcwd()
> > >> >>> >> > print datadir
> > >> >>> >> > t=IMP.atom.read_pdb( datadir+'/' + file, m,
> > >> >>> >> > IMP.atom.ATOMPDBSelector())
> > >> >>> >> > del sls
> > >> >>> >> > #IMP.atom.show_molecular_hierarchy(t)
> > >> >>> >> > c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> > >> >>> >> > IMP.atom.CHAIN_TYPE)[0])
> > >> >>> >> > if c.get_number_of_children()==0:
> > >> >>> >> > IMP.atom.show_molecular_hierarchy(t)
> > >> >>> >> > # there is no reason to use all atoms, just
> > >> approximate
> > >> >>> the
> > >> >>> >> > pdb shape instead
> > >> >>> >> > s=IMP.atom.create_simplified_along_backbone(c,
> > >> >>> >> >
> > >> >>> >> resolution/300.0)
> > >> >>> >> > IMP.atom.destroy(t)
> > >> >>> >> > # make the simplified structure rigid
> > >> >>> >> > rb=IMP.atom.create_rigid_body(s)
> > >> >>> >> > # rb=IMP.atom.create_rigid_body(c)
> > >> >>> >> > rb.set_coordinates_are_optimized(True)
> > >> >>> >> > return s
> > >> >>> >> > # return c
> > >> >>> >> >
> > >> >>> >> > h= create_from_pdb(files[0])
> > >> >>> >> > h.set_name(name)
> > >> >>> >> > all.add_child(h)
> > >> >>> >> >
> > >> >>> >> > create_protein_from_pdbs("A", [Firstpdb])
> > >> >>> >> > create_protein_from_pdbs("B", [Secondpdb])
> > >> >>> >> > create_protein_from_pdbs("C", [Thirdpdb])
> > >> >>> >> > create_protein_from_pdbs("D", [Fourthpdb])
> > >> >>> >> > #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
> > >> >>> >> > return (m, all)
> > >> >>> >> >
> > >> >>> >> > # create the needed restraints and add them to the model
> > >> >>> >> >
> > >> >>> >> > def create_restraints(m, all):
> > >> >>> >> > def add_connectivity_restraint(s):
> > >> >>> >> >
> > >> >>> >> > tr= IMP.core.TableRefiner()
> > >> >>> >> > rps=[]
> > >> >>> >> > for sc in s:
> > >> >>> >> > ps= sc.get_selected_particles()
> > >> >>> >> > rps.append(ps[0])
> > >> >>> >> > tr.add_particle(ps[0], ps)
> > >> >>> >> >
> > >> >>> >> > # duplicate the
> IMP.atom.create_connectivity_restraint
> > >> >>> >> > functionality
> > >> >>> >> >
> > >> >>> >> > score=
> > >> >>> >> >
> > >> >>> >>
> > >> >>>
> > >>
> >
> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
> > >> >>> >> >
> > >> >>> >> > r= IMP.core.MSConnectivityRestraint(m,score)
> > >> >>> >> >
> > >> >>> >> > iA = r.add_type([rps[0]])
> > >> >>> >> > iB = r.add_type([rps[1]])
> > >> >>> >> > iC = r.add_type([rps[2]])
> > >> >>> >> > iD = r.add_type([rps[3]])
> > >> >>> >> > n1 = r.add_composite([iA, iB, iC, iD])
> > >> >>> >> > n2 = r.add_composite([iA, iB], n1)
> > >> >>> >> > n3 = r.add_composite([iC, iD], n1)
> > >> >>> >> > n4 = r.add_composite([iB, iC, iD], n1)
> > >> >>> >> >
> > >> >>> >> > m.add_restraint(r)
> > >> >>> >> >
> > >> >>> >> > evr=IMP.atom.create_excluded_volume_restraint([all])
> > >> >>> >> > m.add_restraint(evr)
> > >> >>> >> > # a Selection allows for natural specification of what
> the
> > >> >>> >> restraints
> > >> >>> >> > act on
> > >> >>> >> > S= IMP.atom.Selection
> > >> >>> >> > sA=S(hierarchy=all, molecule="A")
> > >> >>> >> > sB=S(hierarchy=all, molecule="B")
> > >> >>> >> > sC=S(hierarchy=all, molecule="C")
> > >> >>> >> > sD=S(hierarchy=all, molecule="D")
> > >> >>> >> > add_connectivity_restraint([sA, sB, sC, sD])
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >> > # find acceptable conformations of the model
> > >> >>> >> > def get_conformations(m):
> > >> >>> >> > sampler= IMP.core.MCCGSampler(m)
> > >> >>> >> > sampler.set_bounding_box(bb)
> > >> >>> >> > # magic numbers, experiment with them and make them large
> > >> >>> enough for
> > >> >>> >> > things to work
> > >> >>> >> > sampler.set_number_of_conjugate_gradient_steps(100)
> > >> >>> >> > sampler.set_number_of_monte_carlo_steps(20)
> > >> >>> >> > sampler.set_number_of_attempts(models)
> > >> >>> >> > # We don't care to see the output from the sampler
> > >> >>> >> > sampler.set_log_level(IMP.SILENT)
> > >> >>> >> > # return the IMP.ConfigurationSet storing all the found
> > >> >>> >> configurations
> > >> >>> >> > that
> > >> >>> >> > # meet the various restraint maximum scores.
> > >> >>> >> > cs= sampler.create_sample()
> > >> >>> >> > return cs
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >> > # cluster the conformations and write them to a file
> > >> >>> >> > def analyze_conformations(cs, all, gs):
> > >> >>> >> > # we want to cluster the configurations to make them
> easier
> > >> to
> > >> >>> >> > understand
> > >> >>> >> > # in the case, the clustering is pretty meaningless
> > >> >>> >> > embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,
> > >> >>> >> >
> > >> >>> >> >
> > IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)),
> > >> >>> True)
> > >> >>> >> > cluster= IMP.statistics.create_lloyds_kmeans(embed, 10,
> > >> 10000)
> > >> >>> >> > # dump each cluster center to a file so it can be viewed.
> > >> >>> >> > for i in range(cluster.get_number_of_clusters()):
> > >> >>> >> > center= cluster.get_cluster_center(i)
> > >> >>> >> > cs.load_configuration(i)
> > >> >>> >> > w= IMP.display.PymolWriter("cluster.%d.pym"%i)
> > >> >>> >> > for g in gs:
> > >> >>> >> > w.add_geometry(g)
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >>
> > >> >>>
> > >>
> >
> #******************************************************************************************
> > >> >>> >> > # now do the actual work
> > >> >>> >> >
> > >> >>> >> > (m,all)= create_representation()
> > >> >>> >> > IMP.atom.show_molecular_hierarchy(all)
> > >> >>> >> > create_restraints(m, all)
> > >> >>> >> >
> > >> >>> >> > # in order to display the results, we need something that
> maps
> > >> the
> > >> >>> >> > particles onto
> > >> >>> >> > # geometric objets. The IMP.display.Geometry objects do this
> > >> >>> mapping.
> > >> >>> >> > # IMP.display.XYZRGeometry map an IMP.core.XYZR particle
> onto a
> > >> >>> sphere
> > >> >>> >> > gs=[]
> > >> >>> >> > for i in range(all.get_number_of_children()):
> > >> >>> >> > color= IMP.display.get_display_color(i)
> > >> >>> >> > n= all.get_child(i)
> > >> >>> >> > name= n.get_name()
> > >> >>> >> > g= IMP.atom.HierarchyGeometry(n)
> > >> >>> >> > g.set_color(color)
> > >> >>> >> > gs.append(g)
> > >> >>> >> >
> > >> >>> >> > cs= get_conformations(m)
> > >> >>> >> >
> > >> >>> >> > print "found", cs.get_number_of_configurations(), "solutions"
> > >> >>> >> >
> > >> >>> >> > ListScores = []
> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> > >> >>> >> > cs.load_configuration(i)
> > >> >>> >> > # print the configuration
> > >> >>> >> > print "solution number: ",i,"scored :",
> > m.evaluate(False)
> > >> >>> >> > ListScores.append(m.evaluate(False))
> > >> >>> >> >
> > >> >>> >> > f1 = open("out_scores.csv", "w")
> > >> >>> >> > f1.write("\n".join(map(lambda x: str(x), ListScores)))
> > >> >>> >> > f1.close()
> > >> >>> >> >
> > >> >>> >> > # for each of the configuration, dump it to a file to view in
> > >> pymol
> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> > >> >>> >> > JOSH = cs.load_configuration(i)
> > >> >>> >> > S= IMP.atom.Selection
> > >> >>> >> > h= IMP.atom.Hierarchy.get_children(cs)
> > >> >>> >> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> > >> >>> >> > rh = RMF.create_rmf_file(tfn)
> > >> >>> >> >
> > >> >>> >> > # add the hierarchy to the file
> > >> >>> >> > IMP.rmf.add_hierarchies(rh, h)
> > >> >>> >> >
> > >> >>> >> > # add the current configuration to the file as frame 0
> > >> >>> >> > IMP.rmf.save_frame(rh)
> > >> >>> >> >
> > >> >>> >> > for g in gs:
> > >> >>> >> > w.add_geometry(g)
> > >> >>> >> >
> > >> >>> >> > analyze_conformations(cs, all, gs)
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >> > _______________________________________________
> > >> >>> >> > IMP-users mailing list
> > >> >>> >> > IMP-users(a)salilab.org
> > >> >>> >> > https://salilab.org/mailman/listinfo/imp-users
> > >> >>> >> >
> > >> >>> >> >
> > >> >>> >>
> > >> >>> >>
> > >> >>> >> --
> > >> >>> >> Barak
> > >> >>> >>
2
1
aha okay, so now i'm generating .rmf files however when trying to open them
in chimera I get the following error:
"Invalid handle returned from H5Fopen(name.c_str(), H5F_ACC_RDONLY, plist)"
in file "
I'm not sure whether this is because I've created empty .rmf files or
something else is wrong ...
the code for making the rmf files:
for i in range(0, cs.get_number_of_configurations()):
cs.load_configuration(i)
h = IMP.atom.Hierarchy.get_children(all)
tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
print "file is", tfn
rh = RMF.create_rmf_file(tfn)
# add the hierarchy to the file
IMP.rmf.add_hierarchies(rh, h)
# add the current configuration to the file as frame 0
IMP.rmf.save_frame(rh)
On 3 July 2014 00:20, <imp-users-request(a)salilab.org> wrote:
> Send IMP-users mailing list submissions to
> imp-users(a)salilab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://salilab.org/mailman/listinfo/imp-users
> or, via email, send a message with subject or body 'help' to
> imp-users-request(a)salilab.org
>
> You can reach the person managing the list at
> imp-users-owner(a)salilab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IMP-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 2 Jul 2014 16:20:19 -0700
> From: Barak Raveh <barak.raveh(a)gmail.com>
> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> Message-ID:
> <
> CAHp+_Uoq-HAyca9AX_pFcEje32ke3J3KuKZWYfuj+M8SZWUkCw(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Josh,
>
> An IMP model contains a list of particles that are tightly associated with
> it (a particle does not exist outside the context of a model). Given the
> disclaimer that I have never used ConfigurationSet, my understanding from
> its documentation is that when you load a configuration, the values of the
> particles within the model are updated accordingly. If I understand your
> code correctly, 'all' is the root of the hierarchy in your model, so it is
> 'all' that you should add to the rmf. The values of 'all' and all of its
> children are supposed to update when you load a configuration,
> automatically.
>
> All that being said said - use this advice at own risk, perhaps someone
> could advise you better. Let me know if you have more questions.
>
> Barak
>
>
> On Wed, Jul 2, 2014 at 3:42 PM, Josh Bullock <jma.bullock(a)gmail.com>
> wrote:
>
> >
> >
> > Conceptually I do ( i think ... ) but not practically. I'm hoping to view
> > each of the models i created - with MSrestraints - separately as an .rmf
> in
> > chimera, just so i can see what i'm making !
> >
> > so i have created my models using:
> >
> > cs= get_conformations(m)
> >
> > do i have to assign each model to a particle before i can write it to an
> > .rmf ? Or is each model already a particle with hierarchy ?
> >
> > -------------------------------------------
> >
> > for i in range(0, cs.get_number_of_configurations()):
> > cs.load_configuration(i)
> > h = IMP.atom.Hierarchy(m) # <------- how do i call the hierarchy
> of
> > the current loaded configuration ?
> > c = p.get_children(h)
> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> > rh = RMF.create_rmf_file(tfn)
> >
> > # add the hierarchy to the file
> > IMP.rmf.add_hierarchies(rh, h)
> >
> > # add the current configuration to the file as frame 0
> > IMP.rmf.save_frame(rh)
> >
> > On 2 July 2014 23:03, <imp-users-request(a)salilab.org> wrote:
> >
> >> Send IMP-users mailing list submissions to
> >> imp-users(a)salilab.org
> >>
> >> To subscribe or unsubscribe via the World Wide Web, visit
> >> https://salilab.org/mailman/listinfo/imp-users
> >> or, via email, send a message with subject or body 'help' to
> >> imp-users-request(a)salilab.org
> >>
> >> You can reach the person managing the list at
> >> imp-users-owner(a)salilab.org
> >>
> >> When replying, please edit your Subject line so it is more specific
> >> than "Re: Contents of IMP-users digest..."
> >>
> >>
> >> Today's Topics:
> >>
> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> >>
> >>
> >> ----------------------------------------------------------------------
> >>
> >> Message: 1
> >> Date: Wed, 2 Jul 2014 15:03:19 -0700
> >>
> >> From: Barak Raveh <barak.raveh(a)gmail.com>
> >> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> >> Message-ID:
> >> <CAHp+_UqO8rXRMsUSndbg-c0jyDxnswDe9aFKvW889gGMU=
> >> 4MMQ(a)mail.gmail.com>
> >> Content-Type: text/plain; charset="utf-8"
> >>
> >>
> >> * I meant
> >>
> >> h = IMP.atom.Hierarchy(p)
> >> c = p.get_children(h)
> >>
> >> this assumes that particle p was already decorated as Hierarchy (let me
> >> know if you are not familiar with decorators, Hierarchy, or Particle).
> >>
> >>
> >>
> >> On Wed, Jul 2, 2014 at 3:02 PM, Barak Raveh <barak.raveh(a)gmail.com>
> >> wrote:
> >>
> >> > Hi Josh,
> >> >
> >> > I think get_children() is only a member function of Hierarchy, so you
> >> > should do something like
> >> >
> >> > IMP.atom.Hierarchy(p)
> >> > c = p.get_children()
> >> >
> >> > 'cs' seems to be a ConfigurationSet object - are you sure that you
> >> expect
> >> > it to have children?
> >> >
> >> > What do you want to do?
> >> >
> >> > Cheers,
> >> > Barak
> >> >
> >> > On Wed, Jul 2, 2014 at 1:42 PM, Josh Bullock <jma.bullock(a)gmail.com>
> >> > wrote:
> >> >
> >> >> ah sorry ! this line gives me the error
> >> >>
> >> >> h= IMP.atom.Hierarchy.get_children(cs)
> >> >>
> >> >> thanks
> >> >>
> >> >> josh
> >> >>
> >> >> On 2 July 2014 17:45, <imp-users-request(a)salilab.org> wrote:
> >> >>
> >> >>> Send IMP-users mailing list submissions to
> >> >>> imp-users(a)salilab.org
> >> >>>
> >> >>> To subscribe or unsubscribe via the World Wide Web, visit
> >> >>> https://salilab.org/mailman/listinfo/imp-users
> >> >>> or, via email, send a message with subject or body 'help' to
> >> >>> imp-users-request(a)salilab.org
> >> >>>
> >> >>> You can reach the person managing the list at
> >> >>> imp-users-owner(a)salilab.org
> >> >>>
> >> >>> When replying, please edit your Subject line so it is more specific
> >> >>> than "Re: Contents of IMP-users digest..."
> >> >>>
> >> >>>
> >> >>> Today's Topics:
> >> >>>
> >> >>> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Barak
> Raveh)
> >> >>>
> >> >>>
> >> >>>
> ----------------------------------------------------------------------
> >> >>>
> >> >>> Message: 1
> >> >>> Date: Wed, 2 Jul 2014 09:45:30 -0700
> >> >>> From: Barak Raveh <barak.raveh(a)gmail.com>
> >> >>> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> >> >>> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak
> Raveh)
> >> >>> Message-ID:
> >> >>> <CAHp+_Uo19VasJDJYi+2CoUUu=
> >> >>> u_6duKCraVetU4dW45+oDhTAw(a)mail.gmail.com>
> >> >>> Content-Type: text/plain; charset="utf-8"
> >> >>>
> >> >>> Which lines throws the error?
> >> >>>
> >> >>>
> >> >>> On Wed, Jul 2, 2014 at 4:56 AM, Josh Bullock <jma.bullock(a)gmail.com
> >
> >> >>> wrote:
> >> >>>
> >> >>> > Hi Barek,
> >> >>> >
> >> >>> > So I'm not giving hierarchy.get_children the correct input:
> >> >>> >
> >> >>> > TypeError: unbound method get_children() must be called with
> >> Hierarchy
> >> >>> > instance as first argument (got ConfigurationSet instance instead)
> >> >>> >
> >> >>> > I'm not sure which argument is the hierarchy instance.
> >> >>> >
> >> >>> > Thanks,
> >> >>> >
> >> >>> > Josh
> >> >>> >
> >> >>> > -------------------------------------------------
> >> >>> >
> >> >>> > cs= get_conformations(m)
> >> >>>
> >> >>> >
> >> >>> > for i in range(0, cs.get_number_of_configurations()):
> >> >>> > JOSH = cs.load_configuration(i)
> >> >>> > S= IMP.atom.Selection
> >> >>> > h= IMP.atom.Hierarchy.get_children(cs)
> >> >>> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> >> >>> > rh = RMF.create_rmf_file(tfn)
> >> >>> >
> >> >>> > On 1 July 2014 17:31, <imp-users-request(a)salilab.org> wrote:
> >> >>> >
> >> >>> >> Send IMP-users mailing list submissions to
> >> >>> >> imp-users(a)salilab.org
> >> >>> >>
> >> >>> >> To subscribe or unsubscribe via the World Wide Web, visit
> >> >>> >> https://salilab.org/mailman/listinfo/imp-users
> >> >>> >> or, via email, send a message with subject or body 'help' to
> >> >>> >> imp-users-request(a)salilab.org
> >> >>> >>
> >> >>> >> You can reach the person managing the list at
> >> >>> >> imp-users-owner(a)salilab.org
> >> >>> >>
> >> >>> >> When replying, please edit your Subject line so it is more
> specific
> >> >>> >> than "Re: Contents of IMP-users digest..."
> >> >>> >>
> >> >>> >>
> >> >>> >> Today's Topics:
> >> >>> >>
> >> >>> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> >> >>> >>
> >> >>> >>
> >> >>> >>
> >> ----------------------------------------------------------------------
> >> >>> >>
> >> >>> >> Message: 1
> >> >>> >> Date: Tue, 1 Jul 2014 09:31:33 -0700
> >> >>> >> From: Barak Raveh <barak.raveh(a)gmail.com>
> >> >>> >> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> >> >>> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> >> >>> >> Message-ID:
> >> >>> >> <CAHp+_UowiBwJozbwOfi8yFEVt7Z8o2tEZ=
> >> >>> >> LvYPnJh-LjpC2cSA(a)mail.gmail.com>
> >> >>> >> Content-Type: text/plain; charset="utf-8"
> >> >>>
> >> >>> >>
> >> >>> >> Hi Josh, from a very superficial look, your code to write the RMF
> >> >>> files
> >> >>> >> seems fine - do you get an output RMF file? Could you load it in
> >> >>> Chimera?
> >> >>> >>
> >> >>> >>
> >> >>> >> On Tue, Jul 1, 2014 at 2:40 AM, Josh Bullock <
> >> jma.bullock(a)gmail.com>
> >> >>> >> wrote:
> >> >>> >>
> >> >>> >> > Hello,
> >> >>> >> >
> >> >>> >> > I'm relatively new to all this so please let me know if i'm
> >> making
> >> >>> any
> >> >>> >> > obvious errors ...
> >> >>> >> >
> >> >>> >> > Essentially all i'm trying to do is generate an ensemble of
> >> models
> >> >>> made
> >> >>> >> > from four subunits - constrained by MS connectivity restraints.
> >> The
> >> >>> >> models
> >> >>> >> > get scored but nothing seems to write to the pymol file.
> Ideally
> >> i'd
> >> >>> >> like
> >> >>> >> > to write to an .rmf but i haven't worked that one out either
> ...
> >> >>> >> >
> >> >>> >> > Is this a reasonable way to go about my problem ?
> >> >>> >> >
> >> >>> >> > Many thanks,
> >> >>> >> >
> >> >>> >> > Josh
> >> >>> >> >
> >> >>> >> > -------------------------------------------
> >> >>> >> >
> >> >>> >> > import IMP
> >> >>> >> > import IMP.atom
> >> >>> >> > import IMP.rmf
> >> >>> >> > import inspect
> >> >>> >> > import IMP.container
> >> >>> >> > import IMP.display
> >> >>> >> > import IMP.statistics
> >> >>> >> > #import IMP.example
> >> >>> >> > import sys, math, os, optparse
> >> >>> >> > import RMF
> >> >>> >> >
> >> >>> >> > from optparse import OptionParser
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > # Convert the arguments into strings and number
> >> >>> >> > Firstpdb = str(sys.argv[1])
> >> >>> >> > Secondpdb = str(sys.argv[2])
> >> >>> >> > Thirdpdb = str(sys.argv[3])
> >> >>> >> > Fourthpdb = str(sys.argv[4])
> >> >>> >> > models = float(sys.argv[5])
> >> >>> >> >
> >> >>> >> > #*****************************************
> >> >>> >> >
> >> >>> >> > # the spring constant to use, it doesnt really matter
> >> >>> >> > k=100
> >> >>> >> > # the target resolution for the representation, this is used to
> >> >>> specify
> >> >>> >> > how detailed
> >> >>> >> > # the representation used should be
> >> >>> >> > resolution=300
> >> >>> >> > # the box to perform everything
> >> >>> >> > bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
> >> >>> >> > IMP.algebra.Vector3D(300, 300,
> 300))
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > # this function creates the molecular hierarchies for the
> various
> >> >>> >> involved
> >> >>> >> > proteins
> >> >>> >> > def create_representation():
> >> >>> >> > m= IMP.Model()
> >> >>> >> > all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> >> >>> >> > all.set_name("the universe")
> >> >>> >> > # create a protein, represented as a set of connected balls
> >> of
> >> >>> >> > appropriate
> >> >>> >> > # radii and number, chose by the resolution parameter and
> the
> >> >>> >> number of
> >> >>> >> > # amino acids.
> >> >>> >> >
> >> >>> >> > def create_protein_from_pdbs(name, files):
> >> >>> >> >
> >> >>> >> > def create_from_pdb(file):
> >> >>> >> > sls=IMP.SetLogState(IMP.NONE)
> >> >>> >> > datadir = os.getcwd()
> >> >>> >> > print datadir
> >> >>> >> > t=IMP.atom.read_pdb( datadir+'/' + file, m,
> >> >>> >> > IMP.atom.ATOMPDBSelector())
> >> >>> >> > del sls
> >> >>> >> > #IMP.atom.show_molecular_hierarchy(t)
> >> >>> >> > c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> >> >>> >> > IMP.atom.CHAIN_TYPE)[0])
> >> >>> >> > if c.get_number_of_children()==0:
> >> >>> >> > IMP.atom.show_molecular_hierarchy(t)
> >> >>> >> > # there is no reason to use all atoms, just
> >> approximate
> >> >>> the
> >> >>> >> > pdb shape instead
> >> >>> >> > s=IMP.atom.create_simplified_along_backbone(c,
> >> >>> >> >
> >> >>> >> resolution/300.0)
> >> >>> >> > IMP.atom.destroy(t)
> >> >>> >> > # make the simplified structure rigid
> >> >>> >> > rb=IMP.atom.create_rigid_body(s)
> >> >>> >> > # rb=IMP.atom.create_rigid_body(c)
> >> >>> >> > rb.set_coordinates_are_optimized(True)
> >> >>> >> > return s
> >> >>> >> > # return c
> >> >>> >> >
> >> >>> >> > h= create_from_pdb(files[0])
> >> >>> >> > h.set_name(name)
> >> >>> >> > all.add_child(h)
> >> >>> >> >
> >> >>> >> > create_protein_from_pdbs("A", [Firstpdb])
> >> >>> >> > create_protein_from_pdbs("B", [Secondpdb])
> >> >>> >> > create_protein_from_pdbs("C", [Thirdpdb])
> >> >>> >> > create_protein_from_pdbs("D", [Fourthpdb])
> >> >>> >> > #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
> >> >>> >> > return (m, all)
> >> >>> >> >
> >> >>> >> > # create the needed restraints and add them to the model
> >> >>> >> >
> >> >>> >> > def create_restraints(m, all):
> >> >>> >> > def add_connectivity_restraint(s):
> >> >>> >> >
> >> >>> >> > tr= IMP.core.TableRefiner()
> >> >>> >> > rps=[]
> >> >>> >> > for sc in s:
> >> >>> >> > ps= sc.get_selected_particles()
> >> >>> >> > rps.append(ps[0])
> >> >>> >> > tr.add_particle(ps[0], ps)
> >> >>> >> >
> >> >>> >> > # duplicate the IMP.atom.create_connectivity_restraint
> >> >>> >> > functionality
> >> >>> >> >
> >> >>> >> > score=
> >> >>> >> >
> >> >>> >>
> >> >>>
> >>
> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
> >> >>> >> >
> >> >>> >> > r= IMP.core.MSConnectivityRestraint(m,score)
> >> >>> >> >
> >> >>> >> > iA = r.add_type([rps[0]])
> >> >>> >> > iB = r.add_type([rps[1]])
> >> >>> >> > iC = r.add_type([rps[2]])
> >> >>> >> > iD = r.add_type([rps[3]])
> >> >>> >> > n1 = r.add_composite([iA, iB, iC, iD])
> >> >>> >> > n2 = r.add_composite([iA, iB], n1)
> >> >>> >> > n3 = r.add_composite([iC, iD], n1)
> >> >>> >> > n4 = r.add_composite([iB, iC, iD], n1)
> >> >>> >> >
> >> >>> >> > m.add_restraint(r)
> >> >>> >> >
> >> >>> >> > evr=IMP.atom.create_excluded_volume_restraint([all])
> >> >>> >> > m.add_restraint(evr)
> >> >>> >> > # a Selection allows for natural specification of what the
> >> >>> >> restraints
> >> >>> >> > act on
> >> >>> >> > S= IMP.atom.Selection
> >> >>> >> > sA=S(hierarchy=all, molecule="A")
> >> >>> >> > sB=S(hierarchy=all, molecule="B")
> >> >>> >> > sC=S(hierarchy=all, molecule="C")
> >> >>> >> > sD=S(hierarchy=all, molecule="D")
> >> >>> >> > add_connectivity_restraint([sA, sB, sC, sD])
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > # find acceptable conformations of the model
> >> >>> >> > def get_conformations(m):
> >> >>> >> > sampler= IMP.core.MCCGSampler(m)
> >> >>> >> > sampler.set_bounding_box(bb)
> >> >>> >> > # magic numbers, experiment with them and make them large
> >> >>> enough for
> >> >>> >> > things to work
> >> >>> >> > sampler.set_number_of_conjugate_gradient_steps(100)
> >> >>> >> > sampler.set_number_of_monte_carlo_steps(20)
> >> >>> >> > sampler.set_number_of_attempts(models)
> >> >>> >> > # We don't care to see the output from the sampler
> >> >>> >> > sampler.set_log_level(IMP.SILENT)
> >> >>> >> > # return the IMP.ConfigurationSet storing all the found
> >> >>> >> configurations
> >> >>> >> > that
> >> >>> >> > # meet the various restraint maximum scores.
> >> >>> >> > cs= sampler.create_sample()
> >> >>> >> > return cs
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > # cluster the conformations and write them to a file
> >> >>> >> > def analyze_conformations(cs, all, gs):
> >> >>> >> > # we want to cluster the configurations to make them easier
> >> to
> >> >>> >> > understand
> >> >>> >> > # in the case, the clustering is pretty meaningless
> >> >>> >> > embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,
> >> >>> >> >
> >> >>> >> >
> IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)),
> >> >>> True)
> >> >>> >> > cluster= IMP.statistics.create_lloyds_kmeans(embed, 10,
> >> 10000)
> >> >>> >> > # dump each cluster center to a file so it can be viewed.
> >> >>> >> > for i in range(cluster.get_number_of_clusters()):
> >> >>> >> > center= cluster.get_cluster_center(i)
> >> >>> >> > cs.load_configuration(i)
> >> >>> >> > w= IMP.display.PymolWriter("cluster.%d.pym"%i)
> >> >>> >> > for g in gs:
> >> >>> >> > w.add_geometry(g)
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >>
> >> >>>
> >>
> #******************************************************************************************
> >> >>> >> > # now do the actual work
> >> >>> >> >
> >> >>> >> > (m,all)= create_representation()
> >> >>> >> > IMP.atom.show_molecular_hierarchy(all)
> >> >>> >> > create_restraints(m, all)
> >> >>> >> >
> >> >>> >> > # in order to display the results, we need something that maps
> >> the
> >> >>> >> > particles onto
> >> >>> >> > # geometric objets. The IMP.display.Geometry objects do this
> >> >>> mapping.
> >> >>> >> > # IMP.display.XYZRGeometry map an IMP.core.XYZR particle onto a
> >> >>> sphere
> >> >>> >> > gs=[]
> >> >>> >> > for i in range(all.get_number_of_children()):
> >> >>> >> > color= IMP.display.get_display_color(i)
> >> >>> >> > n= all.get_child(i)
> >> >>> >> > name= n.get_name()
> >> >>> >> > g= IMP.atom.HierarchyGeometry(n)
> >> >>> >> > g.set_color(color)
> >> >>> >> > gs.append(g)
> >> >>> >> >
> >> >>> >> > cs= get_conformations(m)
> >> >>> >> >
> >> >>> >> > print "found", cs.get_number_of_configurations(), "solutions"
> >> >>> >> >
> >> >>> >> > ListScores = []
> >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> >> >>> >> > cs.load_configuration(i)
> >> >>> >> > # print the configuration
> >> >>> >> > print "solution number: ",i,"scored :",
> m.evaluate(False)
> >> >>> >> > ListScores.append(m.evaluate(False))
> >> >>> >> >
> >> >>> >> > f1 = open("out_scores.csv", "w")
> >> >>> >> > f1.write("\n".join(map(lambda x: str(x), ListScores)))
> >> >>> >> > f1.close()
> >> >>> >> >
> >> >>> >> > # for each of the configuration, dump it to a file to view in
> >> pymol
> >> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> >> >>> >> > JOSH = cs.load_configuration(i)
> >> >>> >> > S= IMP.atom.Selection
> >> >>> >> > h= IMP.atom.Hierarchy.get_children(cs)
> >> >>> >> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> >> >>> >> > rh = RMF.create_rmf_file(tfn)
> >> >>> >> >
> >> >>> >> > # add the hierarchy to the file
> >> >>> >> > IMP.rmf.add_hierarchies(rh, h)
> >> >>> >> >
> >> >>> >> > # add the current configuration to the file as frame 0
> >> >>> >> > IMP.rmf.save_frame(rh)
> >> >>> >> >
> >> >>> >> > for g in gs:
> >> >>> >> > w.add_geometry(g)
> >> >>> >> >
> >> >>> >> > analyze_conformations(cs, all, gs)
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > _______________________________________________
> >> >>> >> > IMP-users mailing list
> >> >>> >> > IMP-users(a)salilab.org
> >> >>> >> > https://salilab.org/mailman/listinfo/imp-users
> >> >>> >> >
> >> >>> >> >
> >> >>> >>
> >> >>> >>
> >> >>> >> --
> >> >>> >> Barak
> >> >>> >>
1
0
Conceptually I do ( i think ... ) but not practically. I'm hoping to view
each of the models i created - with MSrestraints - separately as an .rmf in
chimera, just so i can see what i'm making !
so i have created my models using:
cs= get_conformations(m)
do i have to assign each model to a particle before i can write it to an
.rmf ? Or is each model already a particle with hierarchy ?
-------------------------------------------
for i in range(0, cs.get_number_of_configurations()):
cs.load_configuration(i)
h = IMP.atom.Hierarchy(m) # <------- how do i call the hierarchy of
the current loaded configuration ?
c = p.get_children(h)
tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
rh = RMF.create_rmf_file(tfn)
# add the hierarchy to the file
IMP.rmf.add_hierarchies(rh, h)
# add the current configuration to the file as frame 0
IMP.rmf.save_frame(rh)
On 2 July 2014 23:03, <imp-users-request(a)salilab.org> wrote:
> Send IMP-users mailing list submissions to
> imp-users(a)salilab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://salilab.org/mailman/listinfo/imp-users
> or, via email, send a message with subject or body 'help' to
> imp-users-request(a)salilab.org
>
> You can reach the person managing the list at
> imp-users-owner(a)salilab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IMP-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 2 Jul 2014 15:03:19 -0700
> From: Barak Raveh <barak.raveh(a)gmail.com>
> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> Message-ID:
> <CAHp+_UqO8rXRMsUSndbg-c0jyDxnswDe9aFKvW889gGMU=
> 4MMQ(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> * I meant
>
> h = IMP.atom.Hierarchy(p)
> c = p.get_children(h)
>
> this assumes that particle p was already decorated as Hierarchy (let me
> know if you are not familiar with decorators, Hierarchy, or Particle).
>
>
>
> On Wed, Jul 2, 2014 at 3:02 PM, Barak Raveh <barak.raveh(a)gmail.com> wrote:
>
> > Hi Josh,
> >
> > I think get_children() is only a member function of Hierarchy, so you
> > should do something like
> >
> > IMP.atom.Hierarchy(p)
> > c = p.get_children()
> >
> > 'cs' seems to be a ConfigurationSet object - are you sure that you expect
> > it to have children?
> >
> > What do you want to do?
> >
> > Cheers,
> > Barak
> >
> > On Wed, Jul 2, 2014 at 1:42 PM, Josh Bullock <jma.bullock(a)gmail.com>
> > wrote:
> >
> >> ah sorry ! this line gives me the error
> >>
> >> h= IMP.atom.Hierarchy.get_children(cs)
> >>
> >> thanks
> >>
> >> josh
> >>
> >> On 2 July 2014 17:45, <imp-users-request(a)salilab.org> wrote:
> >>
> >>> Send IMP-users mailing list submissions to
> >>> imp-users(a)salilab.org
> >>>
> >>> To subscribe or unsubscribe via the World Wide Web, visit
> >>> https://salilab.org/mailman/listinfo/imp-users
> >>> or, via email, send a message with subject or body 'help' to
> >>> imp-users-request(a)salilab.org
> >>>
> >>> You can reach the person managing the list at
> >>> imp-users-owner(a)salilab.org
> >>>
> >>> When replying, please edit your Subject line so it is more specific
> >>> than "Re: Contents of IMP-users digest..."
> >>>
> >>>
> >>> Today's Topics:
> >>>
> >>> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Barak Raveh)
> >>>
> >>>
> >>> ----------------------------------------------------------------------
> >>>
> >>> Message: 1
> >>> Date: Wed, 2 Jul 2014 09:45:30 -0700
> >>> From: Barak Raveh <barak.raveh(a)gmail.com>
> >>> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> >>> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak Raveh)
> >>> Message-ID:
> >>> <CAHp+_Uo19VasJDJYi+2CoUUu=
> >>> u_6duKCraVetU4dW45+oDhTAw(a)mail.gmail.com>
> >>> Content-Type: text/plain; charset="utf-8"
> >>>
> >>> Which lines throws the error?
> >>>
> >>>
> >>> On Wed, Jul 2, 2014 at 4:56 AM, Josh Bullock <jma.bullock(a)gmail.com>
> >>> wrote:
> >>>
> >>> > Hi Barek,
> >>> >
> >>> > So I'm not giving hierarchy.get_children the correct input:
> >>> >
> >>> > TypeError: unbound method get_children() must be called with
> Hierarchy
> >>> > instance as first argument (got ConfigurationSet instance instead)
> >>> >
> >>> > I'm not sure which argument is the hierarchy instance.
> >>> >
> >>> > Thanks,
> >>> >
> >>> > Josh
> >>> >
> >>> > -------------------------------------------------
> >>> >
> >>> > cs= get_conformations(m)
> >>>
> >>> >
> >>> > for i in range(0, cs.get_number_of_configurations()):
> >>> > JOSH = cs.load_configuration(i)
> >>> > S= IMP.atom.Selection
> >>> > h= IMP.atom.Hierarchy.get_children(cs)
> >>> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> >>> > rh = RMF.create_rmf_file(tfn)
> >>> >
> >>> > On 1 July 2014 17:31, <imp-users-request(a)salilab.org> wrote:
> >>> >
> >>> >> Send IMP-users mailing list submissions to
> >>> >> imp-users(a)salilab.org
> >>> >>
> >>> >> To subscribe or unsubscribe via the World Wide Web, visit
> >>> >> https://salilab.org/mailman/listinfo/imp-users
> >>> >> or, via email, send a message with subject or body 'help' to
> >>> >> imp-users-request(a)salilab.org
> >>> >>
> >>> >> You can reach the person managing the list at
> >>> >> imp-users-owner(a)salilab.org
> >>> >>
> >>> >> When replying, please edit your Subject line so it is more specific
> >>> >> than "Re: Contents of IMP-users digest..."
> >>> >>
> >>> >>
> >>> >> Today's Topics:
> >>> >>
> >>> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)
> >>> >>
> >>> >>
> >>> >>
> ----------------------------------------------------------------------
> >>> >>
> >>> >> Message: 1
> >>> >> Date: Tue, 1 Jul 2014 09:31:33 -0700
> >>> >> From: Barak Raveh <barak.raveh(a)gmail.com>
> >>> >> To: Help and discussion for users of IMP <imp-users(a)salilab.org>
> >>> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf
> >>> >> Message-ID:
> >>> >> <CAHp+_UowiBwJozbwOfi8yFEVt7Z8o2tEZ=
> >>> >> LvYPnJh-LjpC2cSA(a)mail.gmail.com>
> >>> >> Content-Type: text/plain; charset="utf-8"
> >>>
> >>> >>
> >>> >> Hi Josh, from a very superficial look, your code to write the RMF
> >>> files
> >>> >> seems fine - do you get an output RMF file? Could you load it in
> >>> Chimera?
> >>> >>
> >>> >>
> >>> >> On Tue, Jul 1, 2014 at 2:40 AM, Josh Bullock <jma.bullock(a)gmail.com
> >
> >>> >> wrote:
> >>> >>
> >>> >> > Hello,
> >>> >> >
> >>> >> > I'm relatively new to all this so please let me know if i'm making
> >>> any
> >>> >> > obvious errors ...
> >>> >> >
> >>> >> > Essentially all i'm trying to do is generate an ensemble of models
> >>> made
> >>> >> > from four subunits - constrained by MS connectivity restraints.
> The
> >>> >> models
> >>> >> > get scored but nothing seems to write to the pymol file. Ideally
> i'd
> >>> >> like
> >>> >> > to write to an .rmf but i haven't worked that one out either ...
> >>> >> >
> >>> >> > Is this a reasonable way to go about my problem ?
> >>> >> >
> >>> >> > Many thanks,
> >>> >> >
> >>> >> > Josh
> >>> >> >
> >>> >> > -------------------------------------------
> >>> >> >
> >>> >> > import IMP
> >>> >> > import IMP.atom
> >>> >> > import IMP.rmf
> >>> >> > import inspect
> >>> >> > import IMP.container
> >>> >> > import IMP.display
> >>> >> > import IMP.statistics
> >>> >> > #import IMP.example
> >>> >> > import sys, math, os, optparse
> >>> >> > import RMF
> >>> >> >
> >>> >> > from optparse import OptionParser
> >>> >> >
> >>> >> >
> >>> >> > # Convert the arguments into strings and number
> >>> >> > Firstpdb = str(sys.argv[1])
> >>> >> > Secondpdb = str(sys.argv[2])
> >>> >> > Thirdpdb = str(sys.argv[3])
> >>> >> > Fourthpdb = str(sys.argv[4])
> >>> >> > models = float(sys.argv[5])
> >>> >> >
> >>> >> > #*****************************************
> >>> >> >
> >>> >> > # the spring constant to use, it doesnt really matter
> >>> >> > k=100
> >>> >> > # the target resolution for the representation, this is used to
> >>> specify
> >>> >> > how detailed
> >>> >> > # the representation used should be
> >>> >> > resolution=300
> >>> >> > # the box to perform everything
> >>> >> > bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),
> >>> >> > IMP.algebra.Vector3D(300, 300, 300))
> >>> >> >
> >>> >> >
> >>> >> > # this function creates the molecular hierarchies for the various
> >>> >> involved
> >>> >> > proteins
> >>> >> > def create_representation():
> >>> >> > m= IMP.Model()
> >>> >> > all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))
> >>> >> > all.set_name("the universe")
> >>> >> > # create a protein, represented as a set of connected balls of
> >>> >> > appropriate
> >>> >> > # radii and number, chose by the resolution parameter and the
> >>> >> number of
> >>> >> > # amino acids.
> >>> >> >
> >>> >> > def create_protein_from_pdbs(name, files):
> >>> >> >
> >>> >> > def create_from_pdb(file):
> >>> >> > sls=IMP.SetLogState(IMP.NONE)
> >>> >> > datadir = os.getcwd()
> >>> >> > print datadir
> >>> >> > t=IMP.atom.read_pdb( datadir+'/' + file, m,
> >>> >> > IMP.atom.ATOMPDBSelector())
> >>> >> > del sls
> >>> >> > #IMP.atom.show_molecular_hierarchy(t)
> >>> >> > c=IMP.atom.Chain(IMP.atom.get_by_type(t,
> >>> >> > IMP.atom.CHAIN_TYPE)[0])
> >>> >> > if c.get_number_of_children()==0:
> >>> >> > IMP.atom.show_molecular_hierarchy(t)
> >>> >> > # there is no reason to use all atoms, just
> approximate
> >>> the
> >>> >> > pdb shape instead
> >>> >> > s=IMP.atom.create_simplified_along_backbone(c,
> >>> >> >
> >>> >> resolution/300.0)
> >>> >> > IMP.atom.destroy(t)
> >>> >> > # make the simplified structure rigid
> >>> >> > rb=IMP.atom.create_rigid_body(s)
> >>> >> > # rb=IMP.atom.create_rigid_body(c)
> >>> >> > rb.set_coordinates_are_optimized(True)
> >>> >> > return s
> >>> >> > # return c
> >>> >> >
> >>> >> > h= create_from_pdb(files[0])
> >>> >> > h.set_name(name)
> >>> >> > all.add_child(h)
> >>> >> >
> >>> >> > create_protein_from_pdbs("A", [Firstpdb])
> >>> >> > create_protein_from_pdbs("B", [Secondpdb])
> >>> >> > create_protein_from_pdbs("C", [Thirdpdb])
> >>> >> > create_protein_from_pdbs("D", [Fourthpdb])
> >>> >> > #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])
> >>> >> > return (m, all)
> >>> >> >
> >>> >> > # create the needed restraints and add them to the model
> >>> >> >
> >>> >> > def create_restraints(m, all):
> >>> >> > def add_connectivity_restraint(s):
> >>> >> >
> >>> >> > tr= IMP.core.TableRefiner()
> >>> >> > rps=[]
> >>> >> > for sc in s:
> >>> >> > ps= sc.get_selected_particles()
> >>> >> > rps.append(ps[0])
> >>> >> > tr.add_particle(ps[0], ps)
> >>> >> >
> >>> >> > # duplicate the IMP.atom.create_connectivity_restraint
> >>> >> > functionality
> >>> >> >
> >>> >> > score=
> >>> >> >
> >>> >>
> >>>
> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)
> >>> >> >
> >>> >> > r= IMP.core.MSConnectivityRestraint(m,score)
> >>> >> >
> >>> >> > iA = r.add_type([rps[0]])
> >>> >> > iB = r.add_type([rps[1]])
> >>> >> > iC = r.add_type([rps[2]])
> >>> >> > iD = r.add_type([rps[3]])
> >>> >> > n1 = r.add_composite([iA, iB, iC, iD])
> >>> >> > n2 = r.add_composite([iA, iB], n1)
> >>> >> > n3 = r.add_composite([iC, iD], n1)
> >>> >> > n4 = r.add_composite([iB, iC, iD], n1)
> >>> >> >
> >>> >> > m.add_restraint(r)
> >>> >> >
> >>> >> > evr=IMP.atom.create_excluded_volume_restraint([all])
> >>> >> > m.add_restraint(evr)
> >>> >> > # a Selection allows for natural specification of what the
> >>> >> restraints
> >>> >> > act on
> >>> >> > S= IMP.atom.Selection
> >>> >> > sA=S(hierarchy=all, molecule="A")
> >>> >> > sB=S(hierarchy=all, molecule="B")
> >>> >> > sC=S(hierarchy=all, molecule="C")
> >>> >> > sD=S(hierarchy=all, molecule="D")
> >>> >> > add_connectivity_restraint([sA, sB, sC, sD])
> >>> >> >
> >>> >> >
> >>> >> > # find acceptable conformations of the model
> >>> >> > def get_conformations(m):
> >>> >> > sampler= IMP.core.MCCGSampler(m)
> >>> >> > sampler.set_bounding_box(bb)
> >>> >> > # magic numbers, experiment with them and make them large
> >>> enough for
> >>> >> > things to work
> >>> >> > sampler.set_number_of_conjugate_gradient_steps(100)
> >>> >> > sampler.set_number_of_monte_carlo_steps(20)
> >>> >> > sampler.set_number_of_attempts(models)
> >>> >> > # We don't care to see the output from the sampler
> >>> >> > sampler.set_log_level(IMP.SILENT)
> >>> >> > # return the IMP.ConfigurationSet storing all the found
> >>> >> configurations
> >>> >> > that
> >>> >> > # meet the various restraint maximum scores.
> >>> >> > cs= sampler.create_sample()
> >>> >> > return cs
> >>> >> >
> >>> >> >
> >>> >> > # cluster the conformations and write them to a file
> >>> >> > def analyze_conformations(cs, all, gs):
> >>> >> > # we want to cluster the configurations to make them easier to
> >>> >> > understand
> >>> >> > # in the case, the clustering is pretty meaningless
> >>> >> > embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,
> >>> >> >
> >>> >> > IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)),
> >>> True)
> >>> >> > cluster= IMP.statistics.create_lloyds_kmeans(embed, 10, 10000)
> >>> >> > # dump each cluster center to a file so it can be viewed.
> >>> >> > for i in range(cluster.get_number_of_clusters()):
> >>> >> > center= cluster.get_cluster_center(i)
> >>> >> > cs.load_configuration(i)
> >>> >> > w= IMP.display.PymolWriter("cluster.%d.pym"%i)
> >>> >> > for g in gs:
> >>> >> > w.add_geometry(g)
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >>
> >>>
> #******************************************************************************************
> >>> >> > # now do the actual work
> >>> >> >
> >>> >> > (m,all)= create_representation()
> >>> >> > IMP.atom.show_molecular_hierarchy(all)
> >>> >> > create_restraints(m, all)
> >>> >> >
> >>> >> > # in order to display the results, we need something that maps the
> >>> >> > particles onto
> >>> >> > # geometric objets. The IMP.display.Geometry objects do this
> >>> mapping.
> >>> >> > # IMP.display.XYZRGeometry map an IMP.core.XYZR particle onto a
> >>> sphere
> >>> >> > gs=[]
> >>> >> > for i in range(all.get_number_of_children()):
> >>> >> > color= IMP.display.get_display_color(i)
> >>> >> > n= all.get_child(i)
> >>> >> > name= n.get_name()
> >>> >> > g= IMP.atom.HierarchyGeometry(n)
> >>> >> > g.set_color(color)
> >>> >> > gs.append(g)
> >>> >> >
> >>> >> > cs= get_conformations(m)
> >>> >> >
> >>> >> > print "found", cs.get_number_of_configurations(), "solutions"
> >>> >> >
> >>> >> > ListScores = []
> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> >>> >> > cs.load_configuration(i)
> >>> >> > # print the configuration
> >>> >> > print "solution number: ",i,"scored :", m.evaluate(False)
> >>> >> > ListScores.append(m.evaluate(False))
> >>> >> >
> >>> >> > f1 = open("out_scores.csv", "w")
> >>> >> > f1.write("\n".join(map(lambda x: str(x), ListScores)))
> >>> >> > f1.close()
> >>> >> >
> >>> >> > # for each of the configuration, dump it to a file to view in
> pymol
> >>> >> > for i in range(0, cs.get_number_of_configurations()):
> >>> >> > JOSH = cs.load_configuration(i)
> >>> >> > S= IMP.atom.Selection
> >>> >> > h= IMP.atom.Hierarchy.get_children(cs)
> >>> >> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")
> >>> >> > rh = RMF.create_rmf_file(tfn)
> >>> >> >
> >>> >> > # add the hierarchy to the file
> >>> >> > IMP.rmf.add_hierarchies(rh, h)
> >>> >> >
> >>> >> > # add the current configuration to the file as frame 0
> >>> >> > IMP.rmf.save_frame(rh)
> >>> >> >
> >>> >> > for g in gs:
> >>> >> > w.add_geometry(g)
> >>> >> >
> >>> >> > analyze_conformations(cs, all, gs)
> >>> >> >
> >>> >> >
> >>> >> > _______________________________________________
> >>> >> > IMP-users mailing list
> >>> >> > IMP-users(a)salilab.org
> >>> >> > https://salilab.org/mailman/listinfo/imp-users
> >>> >> >
> >>> >> >
> >>> >>
> >>> >>
> >>> >> --
> >>> >> Barak
> >>> >>
2
1