Skip to content

new tests - #30

Merged
jibarozzo merged 22 commits into
developfrom
checks
Sep 3, 2025
Merged

jibarozzo merged 22 commits into
developfrom
checks

Conversation

@Gian77

@Gian77 Gian77 commented May 23, 2025

Copy link
Copy Markdown
Collaborator

I added the two checks for the multi_rarefy() and the do_phyloseq(). I tested thm locally and they seem to work. I used the test_phyloseq dataset for the test because the esophagous is really too small.

@jibarozzo

Copy link
Copy Markdown
Collaborator

Checks are not passing. This branch seems to be out of date compared to develop.

@jibarozzo

Copy link
Copy Markdown
Collaborator

rarefied_physeq <- do_phyloseq(physeq = GlobalPatterns, otu_rare=rarefied_data )
head(otu_table(rarefied_physeq))
Error in otu_table(rarefied_physeq) : could not find function "otu_table"
Calls: head
Execution halted

@Gian77

Gian77 commented May 28, 2025

Copy link
Copy Markdown
Collaborator Author

What should I do here next @jibarozzo @B-Kristy ?

@jibarozzo

Copy link
Copy Markdown
Collaborator

The errors in the check point to: https://github.com/germs-lab/BRCore/actions/runs/15202638884/job/42759431560?pr=30

[ FAIL 2 | WARN 0 | SKIP 0 | PASS 52 ]

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-do_phyloseq.R:15:5'): phyloseq object correctly created ──────
all(read_counts == read_counts[1]) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
── Failure ('test-multi_rarefy.R:12:5'): rarefaction worked correctly ──────────
all(rowSums(otu_table_rare) == rowSums(otu_table_rare)[1]) is not TRUE

`actual`:   FALSE
`expected`: TRUE 

I am currently working on another where I think I inherited these error. Let's see what the tests say.

@jibarozzo

jibarozzo commented May 28, 2025

Copy link
Copy Markdown
Collaborator

@Gian77

This is what you need to do. In your do_phyloseq.R update this:

Option 1

#' @examples
#' \dontrun{
#' # Load example data
#' data(GlobalPatterns, package = "phyloseq")
#'
	@@ -23,6 +24,7 @@
#' 
#' rarefied_physeq <- do_phyloseq(physeq = GlobalPatterns, otu_rare=rarefied_data )
#' head(otu_table(rarefied_physeq))
#' }

Note that I am calling \dontrun{} on the example this prevents the example from running.

**Option 2**
#' @examples
#' library(phyloseq)
#' # Load example data
#' data(GlobalPatterns, package = "phyloseq")
#'
	@@ -23,6 +24,7 @@
#' 
#' rarefied_physeq <- do_phyloseq(physeq = GlobalPatterns, otu_rare=rarefied_data )
#' head(otu_table(rarefied_physeq))
#' 

You load phyloseq package so the example runs.

Then uodate the man pages, NAMESPACE, etc...

@Gian77

Gian77 commented May 29, 2025

Copy link
Copy Markdown
Collaborator Author

@jibarozzo now the error is different is at line 252

  > rarefied_physeq <- do_phyloseq(physeq = GlobalPatterns, otu_rare=rarefied_data )
  Error in h(simpleError(msg, call)) : 
    error in evaluating the argument 'samples' in selecting a method for function 'prune_samples': error in evaluating the argument 'object' in selecting a method for function 'otu_table': error in evaluating the argument 'taxa' in selecting a method for function 'prune_taxa': error in evaluating the argument 'object' in selecting a method for function 'otu_table': invalid class “otu_table” object: 
   OTU abundance data must have non-zero dimensions.
  Calls: do_phyloseq ... .nextMethod -> callNextMethod -> .nextMethod -> validObject
  Execution halted

it seems the rarefied_data is empty or something...

and at 227 there is this

❯ checking examples ... [53s/55s] ERROR
  Running examples in ‘BRCore-Ex.R’ failed
  The error most likely occurred in:

what is BRCore-Ex.R?

@jibarozzo

Copy link
Copy Markdown
Collaborator

BRCore-Ex.R a script that gets created when it runs the tests.

@Gian77

Gian77 commented May 29, 2025

Copy link
Copy Markdown
Collaborator Author

BRCore-Ex.R a script that gets created when it runs the tests.

ok, then I will just add the \dontrun{} and see if it goes through.

@Gian77

Gian77 commented Jun 13, 2025

Copy link
Copy Markdown
Collaborator Author

develop is much ahead than checks... Will try to resolve this and try again... ;)

Comment thread NAMESPACE Outdated
import(rlang)
import(tibble)
import(tidyr)
import(tidyverse)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are failing because you updated NAMESPACE but not DESCRIPTION. First update DESCRIPTION then NAMESPACE. Everything declared in the description must be declared in namespece, and vice versa.

Comment thread R/do_phyloseq.R

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you importing "furrr" and tidyverse"?

Comment thread NAMESPACE Outdated
export(is_hpc_environment)
export(multi_rarefy)
export(nmds_screen_parallel)
export(parallel_multi_rarefy)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this function?

…ts/Depends entries:

    'furrr', 'tidyverse'" introduced by undeclared exports and mismatch between NAMESPACE and DESCRIPTION.
@jibarozzo

Copy link
Copy Markdown
Collaborator

Submitted the requested changes. Let's see if tests pass. If they do, I'll merge tomorrow.

@jibarozzo jibarozzo added the enhancement New feature or request label Jun 13, 2025
@jibarozzo jibarozzo added this to the BRCore_v.0.03 release milestone Jun 13, 2025
@jibarozzo

Copy link
Copy Markdown
Collaborator

@Gian77 Once I solved the NAMESPACE and DESCRIPTION issues we encounter a new error. This time in the tests themselves.

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-do_phyloseq.R:15:5'): phyloseq object correctly created ──────
all(read_counts == read_counts[1]) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
── Failure ('test-multi_rarefy.R:12:5'): rarefaction worked correctly ──────────
all(rowSums(otu_table_rare) == rowSums(otu_table_rare)[1]) is not TRUE

`actual`:   FALSE
`expected`: TRUE 

Comment thread tests/testthat/test-do_phyloseq.R Outdated
read_counts <- sample_sums(test_phyloseq_rare)

# Test if all the samples have the same number of reads
expect_true(all(read_counts == read_counts[1]))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the source of error failure in Github actions. In local machine this works. @Gian77

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, locally works... Sorry to have do extra work to fix my push problems :D

@Gian77

Gian77 commented Jul 3, 2025

Copy link
Copy Markdown
Collaborator Author

Do you think we can reject this PR and close it so we can move forward? I am not sure why does not work...

@jibarozzo

Copy link
Copy Markdown
Collaborator

I'm jumping back on this this week. I've been out of office.

@jibarozzo

Copy link
Copy Markdown
Collaborator

ok, here we go

@Gian77

Gian77 commented Sep 3, 2025

Copy link
Copy Markdown
Collaborator Author

@jibarozzo why is failing on macos?

@jibarozzo

Copy link
Copy Markdown
Collaborator

@jibarozzo why is failing on macos?

According to Co-pilot: "The macOS failure likely arises due to implicit differences in R's handling of data structures or file reading between macOS and Ubuntu."

I'll implement some changes in the tests and see. Stay put

@Gian77

Gian77 commented Sep 3, 2025

Copy link
Copy Markdown
Collaborator Author

I am more than ready! @jibarozzo

@jibarozzo
jibarozzo merged commit 9f0871b into develop Sep 3, 2025
3 checks passed
@jibarozzo
jibarozzo deleted the checks branch September 3, 2025 17:26
@jibarozzo

jibarozzo commented Sep 3, 2025

Copy link
Copy Markdown
Collaborator

@Gian77 checks passed. checks branch pruned. Pull develop for now. I will update main to reflect changes and will let you know.

@Gian77

Gian77 commented Sep 3, 2025

Copy link
Copy Markdown
Collaborator Author

@jibarozzo This is great! Thank you. We can keep cranking then now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants