Skip to contents

lifecycle-experimental

Creates a cross-tabulation (contingency table) comparing two taxonomic ranks from a phyloseq object. Useful for comparing taxonomic assignments from different databases, algorithms, or taxonomic levels.

Usage

tc_df_pq(physeq, rank_1 = "Family", rank_2 = "Class", ...)

Arguments

physeq

(required) A phyloseq-class object obtained using the phyloseq package.

rank_1

(character, default "Family") The name of the first taxonomic rank (column in tax_table slot) for the cross-tabulation rows.

rank_2

(character, default "Class") The name of the second taxonomic rank (column in tax_table slot) for the cross-tabulation columns.

...

Additional arguments passed to gtsummary::tbl_cross().

Value

A gtsummary tbl_cross object displaying the cross-tabulation of the two taxonomic ranks.

Author

Adrien Taudière

Examples

tc_df_pq(data_fungi_mini)
Class
Total
Agaricomycetes Atractiellomycetes Tremellomycetes Unknown
Family




    Aporpiaceae 1 0 0 0 1
    Atractiellales_fam_Incertae_sedis 0 1 0 0 1
    Auriculariaceae 2 0 0 0 2
    Cantharellales_fam_Incertae_sedis 1 0 0 0 1
    Corticiaceae 1 0 0 0 1
    Entolomataceae 1 0 0 0 1
    Exidiaceae 3 0 0 0 3
    Hericiaceae 1 0 0 0 1
    Hymenochaetales_fam_Incertae_sedis 1 0 0 0 1
    Hyphodermataceae 2 0 0 0 2
    Lyophyllaceae 4 0 0 0 4
    Peniophoraceae 1 0 0 0 1
    Phanerochaetaceae 1 0 0 0 1
    Polyporaceae 5 0 0 0 5
    Pterulaceae 1 0 0 0 1
    Russulales_fam_Incertae_sedis 1 0 0 0 1
    Schizoporaceae 4 0 0 0 4
    Steccherinaceae 1 0 0 0 1
    Stereaceae 6 0 0 0 6
    Tricholomataceae 1 0 0 0 1
    Unknown 3 0 2 1 6
Total 41 1 2 1 45
tc_df_pq(data_fungi_mini, rank_1 = "Order", rank_2 = "Family")
Family
Total
Aporpiaceae Atractiellales_fam_Incertae_sedis Auriculariaceae Cantharellales_fam_Incertae_sedis Corticiaceae Entolomataceae Exidiaceae Hericiaceae Hymenochaetales_fam_Incertae_sedis Hyphodermataceae Lyophyllaceae Peniophoraceae Phanerochaetaceae Polyporaceae Pterulaceae Russulales_fam_Incertae_sedis Schizoporaceae Steccherinaceae Stereaceae Tricholomataceae Unknown
Order





















    Agaricales 0 0 0 0 0 1 0 0 0 0 4 0 0 0 1 0 0 0 0 1 0 7
    Atractiellales 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
    Auriculariales 1 0 2 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6
    Cantharellales 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
    Corticiales 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
    Hymenochaetales 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4 0 0 0 0 5
    Polyporales 0 0 0 0 0 0 0 0 0 2 0 0 1 5 0 0 0 1 0 0 2 11
    Russulales 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 6 0 0 9
    Tremellales 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
    Unknown 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3
Total 1 1 2 1 1 1 3 1 1 2 4 1 1 5 1 1 4 1 6 1 6 45
if (FALSE) { # \dontrun{ # Compare taxonomic assignments from different methods ref_fasta <- system.file("extdata", "mini_UNITE_fungi.fasta.gz", package = "MiscMetabar", mustWork = TRUE ) data_fungi_mini2 <- data_fungi_mini |> add_new_taxonomy_pq(ref_fasta, suffix = "_sintax", method = "sintax") |> add_new_taxonomy_pq(ref_fasta, suffix = "_lca", method = "lca") tc_df_pq(data_fungi_mini2, rank_1 = "Class_lca", rank_2 = "Class_sintax") } # }