コード例 #1
0
def groups_from_folder(path, filename_templates, groupname_template="(*)", load=True):
    """Load a bunch of pdb files. Put them in groups with names taken from
    the filename, name each object groupname.molecule. Return a dictionary
    mapping group names to group objects.
    ARGUMENTS:
    Path in which the pdb files are stored
    List of regular expressions that the filenames must match.
    Template for the names of the groups. When creating a group name for a
        file, the group name will be this template with each instance of '(*)'
        replaced by a group from the regular expression, the first instance
        replaced with the first group, etc. Defaults to '(*)'"""
    dictionary = biodata.file_dict(path, filename_templates, groupname_template)
    for key, value in dictionary.iteritems():
        dictionary[key] = Group(key)
        if load:
            cmd.load(value, key + ".molecule")
            cmd.disable(key)
    return dictionary
import os
import sys
sys.path.append(os.getcwd()+'/calculator modules')
sys.path.append(os.getcwd()+'/pymol modules')

from useful import one_letter
from useful import CIDict
import csv
import warnings
import numpy as np
from Bio.PDB import PDBParser
from biodata import file_dict
import ezb

structure_files = file_dict('structures with 1qd5', ['aligned_(.*).pdb'])
parser = PDBParser()

with warnings.catch_warnings():
    warnings.simplefilter('ignore')
    structures = [(name, parser.get_structure(name, path)) \
                  for name, path in structure_files.items()]
    structures = CIDict(structures)

with open('cored 1 selections with 1qd5.csv', 'rb') as f:
    reader = csv.reader(f)
    inclusive_selections = ezb.selections_by_resi(reader)
    
with open('beta_selections.csv', 'rb') as f:
    reader = csv.reader(f)
    beta_selections = ezb.selections_by_resi(reader)