Tests if a list of tables contains correct information on MOTU abundances, MOTU characteristics, PCR characteristics, and sample characteristics to be classed as a metabarlist object.
check_metabarlist(metabarlist)check_metabarlist returns TRUE if metabarlist fulfills of conditions to be of class metabarlist` (see details). If not, the function throws a stop.
The function check_metabarlist checks if metabarlist has all the properties required to be a well formed metabarlist object:
metabarlist should be a list with four tables named
`reads`, `motus`, `pcrs` and `samples`.
the `reads` table should be a numeric matrix.
the `motus`, `pcrs` and `samples` tables should be data frames.
the `reads` table row names should be exactly the same as row names in the `pcrs` table.
the `reads` table column names should be exactly the same as row names in the `motus` table.
the `pcrs` table should contain the mandatory columns required, i.e. `sample_id`, `type` and `control_type`.
values in `type` should be properly defined: they can only be `sample` or `control`.
values in `control_type` should be properly defined: they can only be `sequencing`, `pcr`, `extraction`, `positive`, (or NA for samples).
The function will stop if these basic criteria are not met.
check_metabarlist also issues warnings if tables lack columns which are non-mandatory for the metabaR package to run, but that are mandatory (or have a mandatory format) for specific functions (e.g., ggpcrplate)
the column `sequence` for the `motus` table.
the columns `tag_fwd`, `tag_rev`, `primer_fwd`, `primer_rev`, `plate_no`, `plate_col`, and `plate_row` for the `pcrs` table.
In addition, the function issues a warning if any PCR or MOTU has a total count of 0 across the entire dataset.
data(soil_euk)
check_metabarlist(soil_euk)
#> Warning: Some PCRs in soil_euk have a number of reads of zero in table `reads`!
#> [1] TRUE