I am new to R and would like to import the taxonomy profile table of MetaPhlAn3 into the R package phyloseq to make use of the package decontam.
Therefore I merged several metaphlan analyses with the metaphlan internal command "merge_table". Then I imported the data into R using the read.table command:
merged_metaphlan <- read.table("/media/sf_projects/microbiome/Analysis_of_microbiome/WiP/KneadData/firsttry/Validation_Samples_PL018/PL0183103_5/subsamples/visualization/merged_subsamples_samples_1,2,5.txt", header = TRUE)
After that, I wanted to assign this to an otu_table and consequently load this into the phyloseq-class object:
otu_table(merged_metaphlan, taxa_are_rows = TRUE)
But it seems that phyloseq expects a matrix. Since the MetaPhlAn tabel comes with characters (the clade names and the according relative abundances), I receive the following error:
Error in validObject(.Object) : invalid class “otu_table” object: Non-numeric matrix provided as OTU table. Abundance is expected to be numeric.
Is there a way to directly import MetaPhlAn tables into phyloseq? Or do I need a work around, and if so, how can I do it?