예제 #1
0
molecule_list = []
# read all the molecules in a directory and adds them to a list
molecule_list = glob.glob(os.getcwd() + '/*.pdb')
mds.enableDiagnosticOutput()  # enable verbose output
for index in molecule_list:
    print "start of molecule: " + os.path.basename(index)
    ligand = []
    chain = []
    lig_name = []
    pdb_file = open(index, 'r')
    basic_info()
    sys.stdout.flush()

    # read molecule from file  do operation on molecule object
    mol = mds.readMolecule(index)
    mds.addHydrogens(mol)  # add hydrogens to molecule object
    if len(ligand) == None:
        continue

    a = 0
    for a in range(len(ligand)):
        if len(chain[a]) != 1:
            print "chain name is not character"
            chain[a] = chain[a][0]
        if len(ligand[a]) < 3:
            print " Ligand name is less than 3 characters"
            ligand[a] = ' ' + ligand[a]
        ligand_molecule = mds.extractLigand(mol, ligand[a], chain[a])

        if ligand_molecule == None:
            print "ligand_molecule is none(not present)"
예제 #2
0
import sys
import mds
import glob
import shutil
molecule_list = []
# read all the molecules in a directory and adds them to a list
molecule_list = glob.glob(os.getcwd() + '/*.pdb')
mds.enableDiagnosticOutput()  # enable verbose output
for index in molecule_list:
    print "start of molecule: " + os.path.basename(index)
    sys.stdout.flush()
    # read molecule from file  do operation on molecule object
    mol = mds.readMolecule(index)
    print ">> ADD HYDROGEN"
    sys.stdout.flush()
    mds.addHydrogens(mol)  # add hydrogens to molecule object
    print "<< ADD HYDROGEN"
    sys.stdout.flush()

    print ">> Retain chain "
    sys.stdout.flush()
    chain_ids = []
    chain_ids = mds.getChainIds(mol)  # get chain ids from a protein - molecule
    print "chains present in pdb:" + str(chain_ids)
    if len(chain_ids) == 1:
        # if only one chain is present
        mds.retainOnlyChainAndGroup(mol, chain_ids[0], [])
        print "retained chain :" + chain_ids[0]
    else:
        # retains chain A and all groups
        mds.retainOnlyChainAndGroup(mol, "A", [])