コード例 #1
0
ファイル: routines.py プロジェクト: crosvera/ProDy
def prody_biomol(opt):
    """Generate biomolecule coordinates based on command line arguments."""
        
    import prody
    LOGGER = prody.LOGGER
    prefix, biomol = opt.prefix, opt.biomol
    pdb, header = prody.parsePDB(opt.pdb, header=True)
    if not prefix:
        prefix = pdb.getTitle()
        
    biomols = prody.buildBiomolecules(header, pdb, biomol=biomol)
    if not isinstance(biomols, list):
        biomols = [biomols]
    
    for i, biomol in enumerate(biomols):
        if isinstance(biomol, prody.Atomic):
            outfn = '{0:s}_biomol_{1:d}.pdb'.format(prefix, i+1)
            LOGGER.info('Writing {0:s}'.format(outfn))
            prody.writePDB(outfn, biomol)
        elif isinstance(biomol, tuple):
            for j, part in enumerate(biomol):
                outfn = ('{0:s}_biomol_{1:d}_part_{2:d}.pdb'
                         .format(prefix, i+1, j+1))
                LOGGER.info('Writing {0:s}'.format(outfn))
                prody.writePDB(outfn, part)
コード例 #2
0
def prody_biomol(pdbname, **kwargs):
    """Generate biomolecule coordinates.

    :arg pdb:  PDB identifier or filename

    :arg prefix: prefix for output files, default is :file:`_biomol`

    :arg biomol: index of the biomolecule, by default all are generated"""

    import prody
    LOGGER = prody.LOGGER
    prefix, biomol = kwargs.get('prefix', None), kwargs.get('biomol')
    pdb, header = prody.parsePDB(pdbname, header=True)
    if not prefix:
        prefix = pdb.getTitle()

    biomols = prody.buildBiomolecules(header, pdb, biomol=biomol)
    if not isinstance(biomols, list):
        biomols = [biomols]

    for i, biomol in enumerate(biomols):
        if isinstance(biomol, prody.Atomic):
            outfn = '{0}_biomol_{1}.pdb'.format(prefix, i + 1)
            LOGGER.info('Writing {0}'.format(outfn))
            prody.writePDB(outfn, biomol)
        elif isinstance(biomol, tuple):
            for j, part in enumerate(biomol):
                outfn = ('{0}_biomol_{1}_part_{2}.pdb'.format(
                    prefix, i + 1, j + 1))
                LOGGER.info('Writing {0}'.format(outfn))
                prody.writePDB(outfn, part)
コード例 #3
0
ファイル: prody_biomol.py プロジェクト: anindita85/ProDy
def prody_biomol(pdbname,**kwargs):
    """Generate biomolecule coordinates.

    :arg pdb:  :term:`PDB` identifier or filename
    
    :arg prefix: prefix for output files, default is :file:`_biomol`
    
    :arg biomol: index of the biomolecule, by default all are generated"""
        
    import prody
    LOGGER = prody.LOGGER
    prefix, biomol = kwargs.get('prefix',None), kwargs.get('biomol')
    pdb, header = prody.parsePDB(pdbname, header=True)
    if not prefix:
        prefix = pdb.getTitle()
        
    biomols = prody.buildBiomolecules(header, pdb, biomol=biomol)
    if not isinstance(biomols, list):
        biomols = [biomols]
    
    for i, biomol in enumerate(biomols):
        if isinstance(biomol, prody.Atomic):
            outfn = '{0:s}_biomol_{1:d}.pdb'.format(prefix, i+1)
            LOGGER.info('Writing {0:s}'.format(outfn))
            prody.writePDB(outfn, biomol)
        elif isinstance(biomol, tuple):
            for j, part in enumerate(biomol):
                outfn = ('{0:s}_biomol_{1:d}_part_{2:d}.pdb'
                         .format(prefix, i+1, j+1))
                LOGGER.info('Writing {0:s}'.format(outfn))
                prody.writePDB(outfn, part)
コード例 #4
0
def prodyLoad(pdbname,biomt=False):
    #biomt?
    if len(pdbname) == 4: #PDBID
        prody.fetchPDB(pdbname.lower(), compressed=False)
        pdbname = pdbname.lower() + ".pdb"
    else :
        if pdbname[-4:] != ".pdb":
            pdbname += ".pdb"

    if biomt:
        mol,header = prody.parsePDB(pdbname, header=True)        
        if len(header['biomoltrans']):
            mol = prody.buildBiomolecules( header, mol)
    else:
        mol = prody.parsePDB(pdbname, header=False)
        
    na=mol.numAtoms()
    c=mol.getCoords()
    center_c = c - np.average(c,0)
    np.savetxt(pdb_directory+os.sep+pdbname+"_cl.txt",
               center_c, fmt='%f')
    return center_c