def sequential_cohort_test_raw_values(cohs, plot=False):
    'Sequentially compare raw gene-level calls for the given tumor types.'
    c_results = []
    for coh in cohs:
        c_results += raw_value_comparison(coh, plot=plot)
    df_r = pd.DataFrame(c_results, columns=['Cohort', 'Direction', 'Gene', 'Difference'])
    gcount = Counter(df_r['Gene'])
    pos_gcount = Counter(df_r[(df_r['Direction'] == 'Pos')]['Gene'])
    neg_gcount = Counter(df_r[(df_r['Direction'] == 'Neg')]['Gene'])
    df = pd.DataFrame([gcount[x] for x in gcount], index=gcount.keys(), columns=['Count'])
    df['Count_pos'] = [(pos_gcount[x] if (x in pos_gcount) else 0) for x in gcount]
    df['Count_neg'] = [(neg_gcount[x] if (x in neg_gcount) else 0) for x in gcount]
    if plot:
        plt.plot(np.sort([gcount[x] for x in gcount])[::(- 1)], 'b-')
        plt.xlabel('Gene by Rank', fontsize=16)
        plt.ylabel('Number of Occurences', fontsize=16)
        sns.despine()
        plt.savefig('GeneDevianceDropoff.pdf')
        plt.savefig('GeneDevianceDropoff.png')
        df_r.to_csv('./genehists/LargestDifferences.tsv', sep='\t', index=False)
        df.to_csv('./genehists/LargestDifferenceGenes_ByCount.tsv', sep='\t', index=True)
Sequentially compare raw gene-level calls for the given tumor types.
def sequential_cohort_test_raw_values(cohs, plot=False):
    
    c_results = []
    for coh in cohs:
        c_results += raw_value_comparison(coh, plot=plot)
    df_r = pd.DataFrame(c_results, columns=['Cohort', 'Direction', 'Gene', 'Difference'])
    gcount = Counter(df_r['Gene'])
    pos_gcount = Counter(df_r[(df_r['Direction'] == 'Pos')]['Gene'])
    neg_gcount = Counter(df_r[(df_r['Direction'] == 'Neg')]['Gene'])
    df = pd.DataFrame([gcount[x] for x in gcount], index=gcount.keys(), columns=['Count'])
    df['Count_pos'] = [(pos_gcount[x] if (x in pos_gcount) else 0) for x in gcount]
    df['Count_neg'] = [(neg_gcount[x] if (x in neg_gcount) else 0) for x in gcount]
    if plot:
        plt.plot(np.sort([gcount[x] for x in gcount])[::(- 1)], 'b-')
        plt.xlabel('Gene by Rank', fontsize=16)
        plt.ylabel('Number of Occurences', fontsize=16)
        sns.despine()
        plt.savefig('GeneDevianceDropoff.pdf')
        plt.savefig('GeneDevianceDropoff.png')
        df_r.to_csv('./genehists/LargestDifferences.tsv', sep='\t', index=False)
        df.to_csv('./genehists/LargestDifferenceGenes_ByCount.tsv', sep='\t', index=True)