コード例 #1
0
    def __init__(self, cmembers_file, alpha):

        # Most attributes are unused
        self.num_merges = 0
        self.merge_order = []

        self.pplinks_file = None
        self.score_cutoff = None
        self.cmembers_file = cmembers_file

        self.alpha = alpha
        self.beta = None
        self.rtol = None
        self.weight_range = itermerge.ITM_WEIGHTS_MEMBERS

        self.min_pc_count = None
        self.min_pp_count = None
        self.shuffle = False

        self.clusters = None
        self.G = None
        self.proteins = None
        self.SPL = None

        self.p2c_counts = None

        self.adb = AssociationDatabase.load(cmembers_file)
        self.pp_edges = None
        self._initialize_clusters()
コード例 #2
0
def complex(cmembers_file, output_file, complex_id):

    adb = AssociationDatabase.load(cmembers_file)
    if output_file == '-':
        fp = sys.stdout
    else:
        fp = open(output_file, 'w')

    cls = adb[complex_id]
    cls.write_line2(fp)
コード例 #3
0
def p2c(cmembers_file, output_file):

    p2c_counts = defaultdict(int)
    adb = AssociationDatabase.load(cmembers_file)
    for evd in adb.associations():
        for p in evd.proteins:
            if evd.proteins[p][1] > 0.0:
                p2c_counts[p] += 1
    items = sorted(p2c_counts.iteritems(), key=itemgetter(1, 0))
    with open(output_file, 'w') as fp:
        for i, row in enumerate(items):
            fp.write('{}\t{}\t{}\n'.format(i, *row))
コード例 #4
0
    def __init__(self,
                 pplinks_file,
                 cmembers_file,
                 alpha,
                 beta,
                 rtol,
                 score_cutoff=0.21,
                 weight_range=ITM_WEIGHTS_MEMBERS,
                 initial_merge_order=None,
                 min_pc_count=1,
                 min_pp_count=1,
                 shuffle=False):

        self.num_merges = 0
        self.merge_order = []

        self.pplinks_file = pplinks_file
        self.score_cutoff = score_cutoff
        self.cmembers_file = cmembers_file

        self.alpha = alpha
        self.beta = beta
        self.rtol = AssocCluster.rtol = rtol
        self.weight_range = AssocCluster.weight_range = weight_range

        self.min_pc_count = min_pc_count
        self.min_pp_count = min_pp_count
        self.shuffle = shuffle

        self.clusters = None
        self.G = None
        self.proteins = None
        self.SPL = None

        self.p2c_counts = None

        self.adb = AssociationDatabase.load(cmembers_file)
        self.pp_edges = infflow.load_pp_edges(self.pplinks_file,
                                              self.score_cutoff)
        self._set_minimum_counts()
        if self.beta >= 1.0:
            self._find_beta()
        self._get_pp_solver()
        self._initialize_clusters(initial_merge_order)
コード例 #5
0
def pubmed(cmembers_file, stats_file):

    adb = AssociationDatabase.load(cmembers_file)
    with open(stats_file, 'w') as fp:
        adb.write_pubmed_stats(fp)
コード例 #6
0
def details(cmembers_file, output_file):

    adb = AssociationDatabase.load(cmembers_file)
    with open(output_file, 'w') as fp:
        adb.write_details(fp)