From 38605676e454ac81e64205037431959e822ea724 Mon Sep 17 00:00:00 2001 From: Bo Li Date: Tue, 15 Feb 2022 14:18:42 -0500 Subject: [PATCH] Fixed a bug when loading feature names and also limit plot xaxis to at most 50 read counts per umi --- filter_chimeric_reads | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/filter_chimeric_reads b/filter_chimeric_reads index 20702ac..2c92b9c 100755 --- a/filter_chimeric_reads +++ b/filter_chimeric_reads @@ -33,14 +33,15 @@ def generate_umi_count_plot(count_vec, count_threshold, output_file): background = plt.bar(count_vec.index[~idx], count_vec.values[~idx], linewidth = 0, color = 'blue') signal = plt.bar(count_vec.index[idx], count_vec.values[idx], linewidth = 0, color = 'red') plt.legend([background, signal], ["background", "signal"], loc = 'upper right') - plt.xlim(0, count_vec.index.max() + 1) + plt.xlim(0, min(count_vec.index.max() + 1, 50)) plt.xlabel('UMI with certain number of reads') plt.ylabel('Number of UMIs') plt.savefig(output_file, dpi = 500) plt.close() def load_feature_names(feature_file): - return pd.read_csv(feature_file, header = None, index_col = 0, squeeze = True).values + df = pd.read_csv(feature_file, header = None, index_col = 0) + return df[df.columns[0]].values def write_csv(new_barcodes, feature_names, tot_umis, output_file): with open(output_file, 'w') as fout: