ensemble_hic/analysis_functions.py
def write_pymol_script(ensemble_pdb_file, bead_radii, output_file,
                       repr='spheres', grid=False):
    """Writes a PyMol script to show structures

    This writes a PyMol script loading a structure ensemble PDB file, setting
    bead radii to given values and showing the structures as a chain of beads.
    .. warning:: I'm not sure whether this works (I mostly use VMD)

    :param ensemble_pdb_file: path to PDB file
    :type ensemble_pdb_file: str

    :param bead_radii: bead radii
    :type bead_radii: :class:`numpy.ndarray`

    :param output_file: output file name
    :type output_file: str

    :param repr: representation to use
    :type repr: str, either 'spheres', 'cartoon', or 'ribbon'

    :param grid: if True, show as grid
    :type grid: bool
    """

    epf = ensemble_pdb_file
    fname = epf[-epf[::-1].find('/'):epf.find('.pdb')]
    lines = ['load {}'.format(ensemble_pdb_file),
             'hide all',
             'util.chainbow',
             'set cartoon_trace_atoms=1',
             'set ribbon_trace_atoms=1',
            ]
    if repr == 'spheres':
        for i, r in enumerate(bead_radii):
            lines.append('set sphere_scale={}, resi {}'.format(r / 4.0, i))
    elif repr == 'cartoon':
        lines.append('as cartoon')
    elif repr == 'ribbon':
        lines.append('as ribbon')
    if grid:
        lines.append('set grid_mode=1')
        lines.append('hide {}'.format(fname))

    with open(output_file,'w') as opf:
        [opf.write(line + '\n') for line in lines]
Writes a PyMol script to show structures

    This writes a PyMol script loading a structure ensemble PDB file, setting
    bead radii to given values and showing the structures as a chain of beads.
    .. warning:: I'm not sure whether this works (I mostly use VMD)

    :param ensemble_pdb_file: path to PDB file
    :type ensemble_pdb_file: str

    :param bead_radii: bead radii
    :type bead_radii: :class:`numpy.ndarray`

    :param output_file: output file name
    :type output_file: str

    :param repr: representation to use
    :type repr: str, either 'spheres', 'cartoon', or 'ribbon'

    :param grid: if True, show as grid
    :type grid: bool
    
Writes a PyMol script to show structures
This writes a PyMol script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
warning:: I'm not sure whether this works (I mostly use VMD)
Writes a PyMol script to show structures This writes a PyMol script loading a structure ensemble PDB file setting bead radii to given values and showing the structures as a chain of beads . warning :: I ' m not sure whether this works ( I mostly use VMD )
def write_pymol_script(ensemble_pdb_file, bead_radii, output_file,
                       repr='spheres', grid=False):
    epf = ensemble_pdb_file
    fname = epf[-epf[::-1].find('/'):epf.find('.pdb')]
    lines = ['load {}'.format(ensemble_pdb_file),
             'hide all',
             'util.chainbow',
             'set cartoon_trace_atoms=1',
             'set ribbon_trace_atoms=1',
            ]
    if repr == 'spheres':
        for i, r in enumerate(bead_radii):
            lines.append('set sphere_scale={}, resi {}'.format(r / 4.0, i))
    elif repr == 'cartoon':
        lines.append('as cartoon')
    elif repr == 'ribbon':
        lines.append('as ribbon')
    if grid:
        lines.append('set grid_mode=1')
        lines.append('hide {}'.format(fname))
    with open(output_file,'w') as opf:
        [opf.write(line + '\n') for line in lines]
def write_pymol_script ( ensemble_pdb_file , bead_radii , output_file , repr = 'spheres' , grid = False ) : epf = ensemble_pdb_file fname = epf [ - epf [ : : - 1 ] . find ( '/' ) : epf . find ( '.pdb' ) ] lines = [ 'load {}' . format ( ensemble_pdb_file ) , 'hide all' , 'util.chainbow' , 'set cartoon_trace_atoms=1' , 'set ribbon_trace_atoms=1' , ] if repr == 'spheres' : for i , r in enumerate ( bead_radii ) : lines . append ( 'set sphere_scale={}, resi {}' . format ( r / 4.0 , i ) ) elif repr == 'cartoon' : lines . append ( 'as cartoon' ) elif repr == 'ribbon' : lines . append ( 'as ribbon' ) if grid : lines . append ( 'set grid_mode=1' ) lines . append ( 'hide {}' . format ( fname ) ) with open ( output_file , 'w' ) as opf : [ opf . write ( line + '\n' ) for line in lines ]
Writes a PyMol script to show structures
This writes a PyMol script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
Writes a PyMol script to show structures This writes a PyMol script loading a structure ensemble PDB file setting bead radii to given values and showing the structures as a chain of beads .
"""Writes a PyMol script to show structures

    This writes a PyMol script loading a structure ensemble PDB file, setting
    bead radii to given values and showing the structures as a chain of beads.
    .. warning:: I'm not sure whether this works (I mostly use VMD)

    :param ensemble_pdb_file: path to PDB file
    :type ensemble_pdb_file: str

    :param bead_radii: bead radii
    :type bead_radii: :class:`numpy.ndarray`

    :param output_file: output file name
    :type output_file: str

    :param repr: representation to use
    :type repr: str, either 'spheres', 'cartoon', or 'ribbon'

    :param grid: if True, show as grid
    :type grid: bool
    """
ensemble_pdb_file
path to PDB file
path to PDB file
bead_radii
None
output_file
output file name
output file name
repr
representation to use
representation to use
grid
if True, show as grid
if True show as grid