Skip to content

Commit

Permalink
resolves pandas aggregation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Smith committed Mar 4, 2024
1 parent cac1f00 commit d4bf10c
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 d4bf10c

Please sign in to comment.