コード例 #1
0
    def __init__(self,
                 common_positions,
                 numbering_schemes,
                 segments,
                 difference_matrix,
                 protein_set,
                 cutoff=40):

        self.cutoff = cutoff
        self.common_gn = common_positions
        self.schemes = numbering_schemes
        self.segments = segments
        self.diff_matrix = difference_matrix
        self.signature_matrix_filtered = OrderedDict()
        self.signature_consensus = OrderedDict()
        self.protein_set = protein_set
        self.relevant_gn = OrderedDict([(x[0], OrderedDict())
                                        for x in self.schemes])
        self.relevant_segments = OrderedDict()
        self.scored_proteins = []
        self.protein_report = OrderedDict()
        self.protein_signatures = OrderedDict()

        self.find_relevant_gns()

        self.residue_to_feat = dict([(x, set()) for x in AMINO_ACIDS.keys()])
        for fidx, feat in enumerate(AMINO_ACID_GROUPS.items()):
            for res in feat[1].split(','):
                self.residue_to_feat[res].add(fidx)
コード例 #2
0
def prepare_aa_group_preference():

    pref_dict = {}
    lengths = {}
    for row, group in enumerate(AMINO_ACID_GROUPS.items()):
        tmp_len = len(group[1])
        try:
            lengths[tmp_len].append(row)
        except KeyError:
            lengths[tmp_len] = [
                row,
            ]
    l_heap = sorted(lengths.keys())
    while l_heap:
        tmp = l_heap.pop()
        for feat_row in lengths[tmp]:
            pref_dict[feat_row] = []
            for pref_feat in l_heap:
                pref_dict[feat_row].extend(lengths[pref_feat])
    return pref_dict