I'm new to R and have trouble importing data to decontam as phyloseq objects. The OTU table and taxonomy is in .txt and the metadata in an excel file. Could someone help?
Can you provide the code that you used or the error that you got, please?
I am alsy new to are and have troubles importing the MetaPhlAn3 output table as a phyloseq object to use that for the R package decontam. 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
otu_table(merged_metaphlan, taxa_are_rows = TRUE)
and I receive:
Error in validObject(.Object) : invalid class “otu_table” object:
Non-numeric matrix provided as OTU table.
Abundance is expected to be numeric.
What am I doing wrong?
Your data merged_metaphlan contains columns that are character or factor, i.e., not all the columns are numbers.
Can you provide a quick overview of the table here, by doing:
Though I would advise you to add a new post with this issue, because it is not related with the question on this post.
Thanks a lot for the prompt answer!
Here is an overview of the object merged_metaphlan
clade_name NCBI_tax_id X1 X2 X5 1 UNKNOWN -1 53.48292000 63.13894000 0.00000 2 k__Bacteria 2 44.73274078 36.56062797 99.81208 3 k__Bacteria|p__Actinobacteria 2|201174 38.79252825
32.01578501 0.00000 4 k__Bacteria|p__Actinobacteria|c__Actinobacteria 2|201174|1760 38.79252825 32.01578501 0.00000
If i can't use characters, do I need to abbreviate the clade name with numbers and link the real clade name to the numbers in another file?
Or is there another possibility of a work around?
Either way, I will also post this as a new issue :)
Login before adding your answer.
Use of this site constitutes acceptance of our User Agreement and Privacy