Compute accuracy metrics of multiple taxonomic assignations method using mock for multi-rank and multi assignation methods
Source:R/compare_taxo.R
tc_metrics_mock.RdCompute numerous metrics comparing the computed taxonomic assignation to a true assignation.
Note that to compute all metrics, one need to insert fake
taxa (by shuffling sequences and/or by adding external sequences). The user
must fake taxa using functions add_external_seq_pq(),
add_shuffle_seq_pq()) before taxonomic assignation.
Usage
tc_metrics_mock(
physeq,
ranks_df,
true_values_df,
fake_taxa = TRUE,
fake_pattern = c("^fake_", "^external_")
)Arguments
- physeq
(required) A
phyloseq-classobject obtained using thephyloseqpackage.- ranks_df
(required). A dataframe with at least one column (one database or one method) and a number of row equal to the column in true_values_df
- true_values_df
(required). A dataframe with the true taxonomic assignation. Note that the column names (names of taxonomic ranks) of the true_values_df defined the names present in the
tax_levelcolumn of the resulting dataframe.- fake_taxa
(logical, default TRUE) If TRUE, the fake_pattern vector is used to identify fake taxa, i.e. taxa who are not in the reference database (see
add_external_seq_pq()) or taxa with fake sequences (seeadd_shuffle_seq_pq()).- fake_pattern
(character vector, default c("^fake_", "^external_")) A vector of patterns used to identify the fake taxa using a regex search in their name.
Value
A long-format dataframe with 4 columns: (i) the name of the method_db
(ii) the name of the tax_level (taxonomic rank), (iii) the metrics (see
tc_metrics_mock_vec() for more details) and (iv) the values.
Examples
ranks_df <- data.frame(
silva = c("Phylum", "Class"),
unite = c("Phylum", "Class")
)
true_values_df <- data.frame(
Phylum = c("Basidiomycota", "Ascomycota"),
Class = c("Agaricomycetes", "Sordariomycetes")
)
tc_metrics_mock(data_fungi_mini, ranks_df, true_values_df)
#> 0fake taxa were found using pattern^fake_|^external_.
#> Error in validObject(.Object): invalid class “otu_table” object:
#> OTU abundance data must have non-zero dimensions.