FredHutch / gimap

This is under development R package for calculating genetic interactions
https://fredhutch.github.io/gimap/
0 stars 0 forks source link

Testing #19

Closed howardbaek closed 2 months ago

howardbaek commented 3 months ago

Build unit tests using testthat.

Test setup_data():

howardbaek commented 2 months ago

I am seeing a bug in the example for setup_data(). When I run this line, https://github.com/FredHutch/gimap/blob/19-testing/R/00-setup_data.R#L14, I get this error message:

Error in setup_data(data) : 
  the number of rows in the sample metadata is not equal to the number of columns in the counts
howardbaek commented 2 months ago

@cansavvy @kweav I believe this error is caused by this line: https://github.com/FredHutch/gimap/blob/7432345997be23dc735d8d12ffd1db43dc3b2d2d/R/00-setup_data.R#L53

kweav commented 2 months ago

@howardbaek I think it's a combination of the line you've linked above, and this line: https://github.com/FredHutch/gimap/blob/19594160a24d5fb4c0f0bff976cf9444629dd3ab/R/00-setup_data.R#L41

The way I view sample_metadata, it's the metadata for the samples or the columns for the count data. Because the example in the example_data() header isn't providing a sample_metadata, the code creates ones, but it's equal to the number of rows, not the number of columns

kweav commented 2 months ago

The params in the setup_data header match my expectations for those variables (e.g., this line for sample_metadata https://github.com/FredHutch/gimap/blob/7432345997be23dc735d8d12ffd1db43dc3b2d2d/R/00-setup_data.R#L6)

howardbaek commented 2 months ago

Then, should we fix the example for setup_data()?

kweav commented 2 months ago

I'll file a PR with a fix for the example to include the required arguments, and fix the line that sets the sample_metadata in case it's null since that one isn't currently required. Thanks for pointing this issue out!