def load_mtz(filename,
             prefix='',
             maptypes='FoFc 2FoFc',
             multistate=0,
             quiet=1):
    '''
DESCRIPTION

    Load a MTZ file as two map objects (FoFc, 2FoFc)

    This only works with the incentive PyMOL product!

USAGE

    load_mtz filename [, prefix [, maptypes ]]
    '''
    from pymol import headering

    multistate, quiet = int(multistate), int(quiet)

    header = headering.MTZHeader(filename)

    for coltype in ('F', 'P'):
        if not header.getColumnsOfType(coltype):
            print(' Error: could not find %s type column' % coltype)
            raise CmdException

    if not prefix:
        prefix = os.path.basename(filename).rsplit('.', 1)[0]

    for maptype in maptypes.split():
        F, P, prg = header.guessCols(maptype)
        if None in (F, P):
            print(' Warning: No %s map' % (maptype))
            continue

        name = prefix + '.' + maptype
        if not multistate:
            cmd.delete(name)

        cmd.map_generate(name, filename, F, P, 'None', 0, 0, quiet)
        if name not in cmd.get_names('objects'):
            print(' Error: Loading %s map failed.' % (maptype))
            print(
                ' This PyMOL version might not be capable of loading MTZ files'
            )
            raise CmdException
Exemple #2
0
def load_mtz(filename, prefix='', maptypes='FoFc 2FoFc', multistate=0, quiet=1):
    '''
DESCRIPTION

    Load a MTZ file as two map objects (FoFc, 2FoFc)

    This only works with the incentive PyMOL product!

USAGE

    load_mtz filename [, prefix [, maptypes ]]
    '''
    from pymol import headering

    multistate, quiet = int(multistate), int(quiet)

    header = headering.MTZHeader(filename)

    for coltype in ('F', 'P'):
        if not header.getColumnsOfType(coltype):
            print ' Error: could not find %s type column' % coltype
            raise CmdException

    if not prefix:
        prefix = os.path.basename(filename).rsplit('.', 1)[0]

    for maptype in maptypes.split():
        F, P, prg = header.guessCols(maptype)
        if None in (F, P):
            print ' Warning: No %s map' % (maptype)
            continue

        name = prefix + '.' + maptype
        if not multistate:
            cmd.delete(name)

        cmd.map_generate(name, filename, F, P, 'None', 0, 0, quiet)
        if name not in cmd.get_names('objects'):
            print ' Error: Loading %s map failed.' % (maptype)
            print ' This PyMOL version might not be capable of loading MTZ files'
            raise CmdException
def load_mtz(filename, prefix="", maptypes="FoFc 2FoFc", multistate=0, quiet=1):
    """
DESCRIPTION

    Load a MTZ file as two map objects (FoFc, 2FoFc)

    This only works with the incentive PyMOL product!

USAGE

    load_mtz filename [, prefix [, maptypes ]]
    """
    from pymol import headering

    multistate, quiet = int(multistate), int(quiet)

    header = headering.MTZHeader(filename)

    for coltype in ("F", "P"):
        if not header.getColumnsOfType(coltype):
            print " Error: could not find %s type column" % coltype
            raise CmdException

    if not prefix:
        prefix = os.path.basename(filename).rsplit(".", 1)[0]

    for maptype in maptypes.split():
        F, P, prg = header.guessCols(maptype)
        if None in (F, P):
            print " Warning: No %s map" % (maptype)
            continue

        name = prefix + "." + maptype
        if not multistate:
            cmd.delete(name)

        cmd.map_generate(name, filename, F, P, "None", 0, 0, quiet)
        if name not in cmd.get_names("objects"):
            print " Error: Loading %s map failed." % (maptype)
            print " This PyMOL version might not be capable of loading MTZ files"
            raise CmdException