Beispiel #1
0
def finalSummary(amoptd):
    """Print a final summary of the job"""

    mrbump_data = amoptd['mrbump_results']
    if not mrbump_data:
        return "Could not find any MRBUMP results in directory: {0}!".format(
            amoptd['mrbump_dir'])

    if 'ensembles_data' in amoptd and not (amoptd['ideal_helices']
                                           or amoptd['homologs']
                                           or amoptd['single_model_mode']):
        results = []
        # Merge dictionaries together
        ensembles_data = amoptd['ensembles_data']
        for mrb in mrbump_data:
            d = copy.copy(mrb)
            for ed in ensembles_data:
                if ed['name'] == d['ensemble_name']:
                    d.update(ed)
                    results.append(d)
        keys = ['ensemble_name', 'Solution_Type', 'MR_program']
        keys += _resultsKeys(results)
        keys += ['subcluster_num_models', 'num_residues']
    else:
        results = mrbump_data
        keys = ['name', 'Solution_Type', 'MR_program']
        keys += _resultsKeys(results)

    resultsTable = []
    resultsTable.append(keys)
    for result in results:
        resultLine = []
        for k in keys:
            resultLine.append(result[k])
        resultsTable.append(resultLine)

    # Format the results
    table = printTable.Table()
    summary = table.pprint_table(resultsTable)

    r = "\n\nOverall Summary:\n\n"
    r += summary
    if len(results) and "MR_directory" in results[0]:
        r += '\nBest Molecular Replacement results so far are in:\n\n'
        r += str(results[0]["MR_directory"])
        r += '\n\n'
    return r
Beispiel #2
0
def ensemble_summary(ensembles_data):
    """Print a summary of the ensembling process
    
    Parameters
    ----------
    ensembles_data : list, tuple
       A list of ensembles' data dictionaries

    Returns
    -------
    str

    """

    tableFormat = printTable.Table()

    d = collate_cluster_data(ensembles_data)
    clusters = d['clusters']
    num_clusters = len(clusters)

    rstr = "\n"
    rstr += "Ensemble Results\n"
    rstr += "----------------\n\n"
    rstr += "Cluster method: {0}\n".format(d['cluster_method'])
    rstr += "Cluster score type: {0}\n".format(d['cluster_score_type'])
    rstr += "Number of clusters: {0}\n".format(num_clusters)
    rstr += "Truncation method: {0}\n".format(d['truncation_method'])
    rstr += "Percent truncation: {0}\n".format(d['percent_truncation'])
    rstr += "Side-chain treatments: {0}\n".format(d['side_chain_treatments'])

    for cluster_num in sorted(clusters.keys()):
        rstr += "\n"
        rstr += "Cluster {0}\n".format(cluster_num)
        rstr += "Number of models: {0}\n".format(
            clusters[cluster_num]['cluster_num_models'])
        rstr += "Cluster centroid: {0}\n".format(
            clusters[cluster_num]['cluster_centroid'])
        rstr += "\n"
        tdata = cluster_table_data(
            clusters, cluster_num, d['side_chain_treatments'])
        rstr += tableFormat.pprint_table(tdata)

    rstr += "\nGenerated {0} ensembles\n\n".format(len(ensembles_data))

    return rstr
Beispiel #3
0
 def summaryString(self):
     """Return a string suitable for printing the sorted results"""
     resultsTable = self.results_table(self.results)
     # Format the results
     table = printTable.Table()
     summary = table.pprint_table(resultsTable)
     r = "\n\nOverall Summary:\n\n"
     r += summary
     # Hack need to think of a better way to do this when there are no valid results
     top = self.results[0]
     k = None
     for p in ['Search_directory', 'MR_directory']:
         if p in top.keys():
             k = p
     assert k, "Missing search directory key in results dictionary"
     if top[k]:
         r += '\nBest Molecular Replacement results so far are in:\n\n'
         r += top[k]
     r += '\n\n'
     return r