Skip to content

Commit

Permalink
BUG: Empty samples (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oddant1 authored Aug 8, 2024
1 parent e7a22cb commit ae3a2df
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions q2_dada2/_denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,13 @@ def _denoise_helper(biom_fp, track_fp, hashed_feature_ids, retain_all_samples,
# Reintroduce empty samples dropped by dada2.
table_cols = table.ids(axis='observation')
table_rows = list(set(df.index) - set(table.ids()))
table_to_add = biom.Table(np.zeros((len(table_cols), len(table_rows))),
table_cols, table_rows,
type="OTU table")
table = table.concat(table_to_add)
# This is necissary (instead of just not reintroducing above)

# We only want to do this if something was actually dropped
if table_rows:
table_to_add = biom.Table(np.zeros((len(table_cols), len(table_rows))),
table_cols, table_rows, type="OTU table")
table = table.concat(table_to_add)
# This is necessary (instead of just not reintroducing above)
# dada2 will discard samples which are empty after filtering
# but will keep samples that are empty after merging
# so there are potentially samples removed here that were not
Expand Down

0 comments on commit ae3a2df

Please sign in to comment.