Skip to content

Commit ae3a2df

Browse files
authored
BUG: Empty samples (#167)
1 parent e7a22cb commit ae3a2df

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

q2_dada2/_denoise.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,13 @@ def _denoise_helper(biom_fp, track_fp, hashed_feature_ids, retain_all_samples,
172172
# Reintroduce empty samples dropped by dada2.
173173
table_cols = table.ids(axis='observation')
174174
table_rows = list(set(df.index) - set(table.ids()))
175-
table_to_add = biom.Table(np.zeros((len(table_cols), len(table_rows))),
176-
table_cols, table_rows,
177-
type="OTU table")
178-
table = table.concat(table_to_add)
179-
# This is necissary (instead of just not reintroducing above)
175+
176+
# We only want to do this if something was actually dropped
177+
if table_rows:
178+
table_to_add = biom.Table(np.zeros((len(table_cols), len(table_rows))),
179+
table_cols, table_rows, type="OTU table")
180+
table = table.concat(table_to_add)
181+
# This is necessary (instead of just not reintroducing above)
180182
# dada2 will discard samples which are empty after filtering
181183
# but will keep samples that are empty after merging
182184
# so there are potentially samples removed here that were not

0 commit comments

Comments
 (0)