Skip to content

Commit

Permalink
resolves pandas aggregation warnings (#628)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Smith <[email protected]>
  • Loading branch information
TomSmithCGAT and Tom Smith authored Mar 20, 2024
1 parent d2acc3d commit 7e799bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions umi_tools/dedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def aggregateStatsDF(stats_df):

grouped = stats_df.groupby("UMI")

agg_dict = {'counts': [np.median, len, np.sum]}
agg_dict = {'counts': ['median', len, 'sum']}
agg_df = grouped.agg(agg_dict)

agg_df.columns = ['median_counts', 'times_observed', 'total_counts']
Expand Down Expand Up @@ -444,8 +444,10 @@ def tallyCounts(binned_cluster, max_edit_distance):
columns=["unique", "unique_null", options.method,
"%s_null" % options.method, "edit_distance"])

edit_distance_df['edit_distance'] = edit_distance_df['edit_distance'].astype(str)

# TS - set lowest bin (-1) to "Single_UMI"
edit_distance_df['edit_distance'][0] = "Single_UMI"
edit_distance_df.loc[0, 'edit_distance'] = "Single_UMI"

edit_distance_df.to_csv(options.stats + "_edit_distance.tsv",
index=False, sep="\t")
Expand Down

0 comments on commit 7e799bc

Please sign in to comment.