Skip to content

Commit

Permalink
fix: Handle zero-sum samples in generate_taxa_test_pair
Browse files Browse the repository at this point in the history
- Add check for samples with zero total counts after filtering
- Remove zero-sum samples before running linda analysis
- Prevent NA values during TSS normalization
- Related to Issue #69
  • Loading branch information
cafferychen777 committed Nov 8, 2024
1 parent fd0f8a6 commit b0afb6c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/generate_taxa_test_pair.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ generate_taxa_test_pair <-
feature.dat.type <- "proportion"
}

# Add this check before linda analysis
if (any(colSums(otu_tax_agg_filter) == 0)) {
keep_samples <- colSums(otu_tax_agg_filter) > 0
otu_tax_agg_filter <- otu_tax_agg_filter[, keep_samples]
meta_tab <- meta_tab[keep_samples, ]
}

# Perform linear mixed model analysis using LInDA
# If the original model fails, a simpler model is used as a fallback
linda.obj <- tryCatch({
Expand Down

0 comments on commit b0afb6c

Please sign in to comment.