ensemble_hic/analysis_functions.py
def write_VMD_script(ensemble_pdb_file, bead_radii, output_file):
    """Writes a VMD script to show structures

    This writes a VMD script loading a structure ensemble PDB file, setting
    bead radii to given values and showing the structures as a chain of beads.

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

    :param bead_radii: bead radii
    :type bead_radii: list-like of floats, length: # beads

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

    lines = ['color Display Background white',
             'menu main on',
             'menu graphics on',
             'mol load pdb {}'.format(ensemble_pdb_file),
             'mol color Index',
             'mol delrep 0 0',
             'mol representation VDW',
             'mol addrep 0'
            ]

    radii_set = set(bead_radii)
    for br in radii_set:
        p1 = 'set sel [atomselect top "index '
        p2 = ''
        for i, r in enumerate(bead_radii):
            if r == br:
                p2 += '{} '.format(i)
        p3 = '"]'
        lines.append(p1 + p2[:-1] + p3)
        lines.append('$sel set radius {}'.format(br))
    with open(output_file,'w') as opf:
        [opf.write(line + '\n') for line in lines]
Writes a VMD script to show structures

    This writes a VMD script loading a structure ensemble PDB file, setting
    bead radii to given values and showing the structures as a chain of beads.

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

    :param bead_radii: bead radii
    :type bead_radii: list-like of floats, length: # beads

    :param output_file: output file name
    :type output_file: str
    
Writes a VMD script to show structures
This writes a VMD script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
Writes a VMD script to show structures This writes a VMD script loading a structure ensemble PDB file setting bead radii to given values and showing the structures as a chain of beads .
def write_VMD_script(ensemble_pdb_file, bead_radii, output_file):
    lines = ['color Display Background white',
             'menu main on',
             'menu graphics on',
             'mol load pdb {}'.format(ensemble_pdb_file),
             'mol color Index',
             'mol delrep 0 0',
             'mol representation VDW',
             'mol addrep 0'
            ]
    radii_set = set(bead_radii)
    for br in radii_set:
        p1 = 'set sel [atomselect top "index '
        p2 = ''
        for i, r in enumerate(bead_radii):
            if r == br:
                p2 += '{} '.format(i)
        p3 = '"]'
        lines.append(p1 + p2[:-1] + p3)
        lines.append('$sel set radius {}'.format(br))
    with open(output_file,'w') as opf:
        [opf.write(line + '\n') for line in lines]
def write_VMD_script ( ensemble_pdb_file , bead_radii , output_file ) : lines = [ 'color Display Background white' , 'menu main on' , 'menu graphics on' , 'mol load pdb {}' . format ( ensemble_pdb_file ) , 'mol color Index' , 'mol delrep 0 0' , 'mol representation VDW' , 'mol addrep 0' ] radii_set = set ( bead_radii ) for br in radii_set : p1 = 'set sel [atomselect top "index ' p2 = '' for i , r in enumerate ( bead_radii ) : if r == br : p2 += '{} ' . format ( i ) p3 = '"]' lines . append ( p1 + p2 [ : - 1 ] + p3 ) lines . append ( '$sel set radius {}' . format ( br ) ) with open ( output_file , 'w' ) as opf : [ opf . write ( line + '\n' ) for line in lines ]
Writes a VMD script to show structures
This writes a VMD script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
Writes a VMD script to show structures This writes a VMD script loading a structure ensemble PDB file setting bead radii to given values and showing the structures as a chain of beads .
"""Writes a VMD script to show structures

    This writes a VMD script loading a structure ensemble PDB file, setting
    bead radii to given values and showing the structures as a chain of beads.

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

    :param bead_radii: bead radii
    :type bead_radii: list-like of floats, length: # beads

    :param output_file: output file name
    :type output_file: str
    """
ensemble_pdb_file
path to PDB file
path to PDB file
bead_radii
None
output_file
output file name
output file name