我对 phyloseq 比较陌生,我很难获得一个相对丰富的 otu-table 可以接受输入到siamcat R 代码进行元分析。
# this works: from qza to phyloseq object
ps<-qza_to_phyloseq(
features="all-table.qza",
tree="rooted-tree.qza",
taxonomy = "all-taxonomy.qza",
metadata = "metafinal.tsv"
)
# import metadata
metadata <- read_tsv("metafinal.tsv")
# 30 overlap of the metadata-sample_id with ps, 115 only in metadata
gplots::venn(list(metadata=metadata$sample_id, features=sample_names(ps))
# works: from phyloseq object to relative abundance otu table
table(tax_table(ps)[, "Phylum"])
ps_rel_abund <- transform_sample_counts(ps, function(x){x / sum(x)})
ps_phylum_rel <- tax_glom(ps_rel_abund, "Phylum")
taxa_names(ps_phylum_rel) <- tax_table(ps_phylum_rel)[, "Phylum"]
rel_table <- as(otu_table(ps_phylum_rel), "matrix")
# column names and sample_id are 100% the same
colnames(rel_table)
metadata$sample_id
# 100% overlap:
gplots::venn(list(metadata=metadata$sample_id, featuretable=colnames(rel_table)))
# check that metadata and feature agree
stopifnot(all(colnames(rel_table) == metadata$sample_id))
在这里我收到一条错误消息: all(colnames(rel_table) == metadata$sample_id) is not TRUE 并且以下siamcat 代码根本不起作用。
我的metadata[1:5, 1:5]
:sample_id absolute_filepath study Experiment_acce… study_title
1 SRR8547628 $PWD/Chen_2020_da… Chen… SRX5349649 c… 2 SRR8547629 $PWD/Chen_2020_da… Chen… SRX5349648 c… 3 SRR8547630 $PWD/Chen_202647_da… C… 4 SRR8547631 $PWD/Chen_2020_da... Chen... SRX5349646 解剖 c... 5 SRR8547632 $PWD/Chen_2020_da... Chen... SRX5349645 解剖 c...</p>
my rel-table[1:5, 1:5]
: SRR5092146 SRR5092147 SRR5092148 SRR5092149 Phragmoplastophyta 0 0.0000000 0.00000000 0.000000000 Vertebrata 0 0.0000000 0.00000000 0.000000000 Apicomplexa 0 0.0000000 0.00000000 0.000000000 Ascomycota 0 0.0000000 0.00000000 0.000000000 Campilobacterota 0 0.2465222 0.01166882 0.004337051 SRR5092150 Phragmoplastophyta 0.00000000 Vertebrata 0.00000000 Apicomplexa 0.00000000 Ascomycota 0.00000000 Campilobacterota 0.02106281
nrow(metadata)
= 154
ncol(rel_table)
= 154
请问,为什么不工作?我现在尝试了几个星期,但我无法让代码正常运行......
感谢您的时间和帮助。