Ejemplo n.º 1
0
def score2C(sim, data_df):
    """
    this metric compares the sensitivity, specificity, precision of mutations
    classified as clonal vs subclonal. We take the convention that the clone
    with the largest phi is clonal and the rest is subclonal
    we take also the convention that subclonal are the positive examples, and
    clonal the negative ones.
    """
    sim_att = sim.U
    sim_clonal_idx = np.argmax(sim.phi)
    sim_binary = (sim_att != sim_clonal_idx).astype(int)
    return score2C_base(sim_binary, data_df.clonality_binary)
Ejemplo n.º 2
0
def score2C(sim, loci_table):
    """
    this metric compares the sensitivity, specificity, precision of mutations
    classified as clonal vs subclonal. We take the convention that the clone
    with the largest phi is clonal and the rest is subclonal
    we take also the convention that subclonal are the positive examples, and
    clonal the negative ones.
    """
    sim_att = sim.U
    sim_clonal_idx = np.argmax(sim.phi)
    sim_binary = (sim_att != sim_clonal_idx).astype(int)

    est_att = loci_table.cluster_id
    est_clonal_idx = np.argmax(pre_cluster_table.index.tolist())
    est_binary = (est_att != est_clonal_idx).astype(int)
    return score2C_base(sim_binary, est_binary)
def score2C(sim, data_df):
    """
    this metric compares the sensitivity, specificity, precision of mutations
    classified as clonal vs subclonal. We take the convention that the clone
    with the largest phi is clonal and the rest is subclonal
    we take also the convention that subclonal are the positive examples, and
    clonal the negative ones.
    """
    sim_att = sim.U
    sim_clonal_idx = np.argmax(sim.phi)
    sim_binary = (sim_att != sim_clonal_idx).astype(int)

    true_df = sim._get_data_df()
    ordered_loci_table = pd.merge(true_df, data_df, on='mutation_id')
    est_att = ordered_loci_table.cluster_id
    est_clonal_idx = data_df.groupby('cluster_id').vaf_purity.mean().idxmax()
    est_binary = (est_att != est_clonal_idx).astype(int)
    return score2C_base(sim_binary, est_binary)
Ejemplo n.º 4
0
def score2C(sim, loci_table, cluster_table):
    """
    this metric compares the sensitivity, specificity, precision of mutations
    classified as clonal vs subclonal. We take the convention that the clone
    with the largest phi is clonal and the rest is subclonal
    we take also the convention that subclonal are the positive examples, and
    clonal the negative ones.
    """
    sim_att = sim.U
    sim_clonal_idx = np.argmax(sim.phi)
    sim_binary = (sim_att != sim_clonal_idx).astype(int)

    true_df = sim._get_data_df()
    est_att = loci_table.Cluster_Assignment
    est_clonal_idx = cluster_table.sort_values(
        by='postDP_ccf_mean').iloc[-1]['Cluster_ID']
    est_binary = (est_att != est_clonal_idx).astype(int)
    return score2C_base(sim_binary, est_binary)
     ordered_table = pd.merge(pred_cluster_assign,
                              true_cluster_assign,
                              on='mutation_id',
                              how='inner')
     if len(true_cluster_assign) < 20000:
         row_list.append(
             score2A_base(ordered_table.true_cluster_id,
                          ordered_table.pred_cluster_id))
     else:
         row_list.append(np.nan)
     ordered_table = pd.merge(pred_subclonal,
                              true_subclonal,
                              on='mutation_id',
                              how='inner')
     auc, accuracy, sensitivity, specificity, precision = \
         score2C_base(ordered_table.true_subclonal,
                      ordered_table.pred_subclonal)
     for v in (auc, accuracy, sensitivity, specificity, precision):
         row_list.append(v)
 else:
     for i in range(6):
         row_list.append(np.nan)
 if pred_profile is not None:
     row_list.append(score_sig_1A_base(sig_profile_1A, pred_profile))
     row_list.append(score_sig_1B_base(sig_profile_1B, pred_profile))
     auc, accuracy, sensitivity, specificity, precision = \
         score_sig_1C_base(true_signatures_1C, pred_signatures)
     for v in (auc, accuracy, sensitivity, specificity, precision):
         row_list.append(v)
     if method == 'deconstructsigs':
         nb_rows = min(est_dist.shape[0], true_profile_1E.shape[0])
         score_sig_1D = score_sig_1D_base(