计算每个样品中的最高分类单元

发布于 2025-01-30 19:31:33 字数 79 浏览 3 评论 0原文

我需要计算我的Thyloseq对象的每个样本中的前6个分类单元。看来这应该是一个简单的请求...但是我无法找到这样做的方法!

谢谢

I need to calculate the top 6 taxa in each individual sample of my phyloseq object. It seems like it should be a simple request...but I have not been able to find a way to do this!

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南街女流氓 2025-02-06 19:31:33

也许类似:

library(phyloseq)
library(tidyverse)
library(speedyseq)
as_tibble(p) |> 
  rename(Sample=.sample, ASV=.otu, Abundance=.abundance) |> 
  select(Sample, Abundance, ASV, Phylum, Class, Order, Family, Genus) |> 
  group_by(Sample) |> 
  slice_max(Abundance, n=6) |> 
  ungroup()

p是您的Thyloseq对象,带有OTU表和分类表。

对于SpeedySeq,请参见 https://github.com/mikemc/mikemc/speedyseq

Maybe something like:

library(phyloseq)
library(tidyverse)
library(speedyseq)
as_tibble(p) |> 
  rename(Sample=.sample, ASV=.otu, Abundance=.abundance) |> 
  select(Sample, Abundance, ASV, Phylum, Class, Order, Family, Genus) |> 
  group_by(Sample) |> 
  slice_max(Abundance, n=6) |> 
  ungroup()

Where p is your phyloseq object with OTU table and Taxonomy table.

For speedyseq, see https://github.com/mikemc/speedyseq

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文