Open marwa38 opened 1 year ago
update: I used mp_rrarefy(raresize = 3073) but still getting the error Error in if (obj %>% rowSums %>% var != 0 && !force) { :
missing value where TRUE/FALSE needed
ps.prev <- readRDS("ps.prev.f3.rds")
ps.prev.intes <- subset_samples(ps.prev, Sample == "intestine")
ps.prev.intes <- prune_taxa(taxa_sums(ps.prev.intes) > 0, ps.prev.intes)
summary(sample_sums(ps.prev.intes))
mpse <- ps.prev.intes %>% as.MPSE()
mpse %<>% mp_rrarefy(raresize = 3073)
mpse %<>%
mp_cal_rarecurve(
.abundance = RareAbundance,
chunks = 400
)
Error in if (obj %>% rowSums %>% var != 0 && !force) { :
missing value where TRUE/FALSE needed
mpse %>% print(width=180)
any advice on this please? @xiangpin
Please let me know of any more info required from me @xiangpin
Sorry, I can not generate the same error without your input. Would you mind seeding the input object to me? Or you can set force = TRUE
in mp_cal_rarecurve
since you rarefy your samples to the first quartile, which causes the sum reads of each sample still is unequal. You can refer to the following codes.
> data(mouse.time.mpse)
> mouse.time.mpse
# A MPSE-tibble (MPSE object) abstraction: 4,142 × 11
# OTU=218 | Samples=19 | Assays=Abundance | Taxonomy=Kingdom, Phylum, Class, Order, Family, Genus, Species
OTU Sample Abundance time Kingdom Phylum Class Order Family Genus Species
<chr> <chr> <int> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 OTU_1 F3D0 579 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
2 OTU_2 F3D0 345 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
3 OTU_3 F3D0 449 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
4 OTU_4 F3D0 430 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
5 OTU_5 F3D0 154 Early k__Bac… p__Ba… c__B… o__B… f__Ba… g__B… s__un_…
6 OTU_6 F3D0 470 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
7 OTU_7 F3D0 282 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
8 OTU_8 F3D0 184 Early k__Bac… p__Ba… c__B… o__B… f__Ri… g__A… s__un_…
9 OTU_9 F3D0 45 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
10 OTU_10 F3D0 158 Early k__Bac… p__Ba… c__B… o__B… f__Mu… g__u… s__un_…
# … with 4,132 more rows
# ℹ Use `print(n = ...)` to see more rows
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% colSums %>% quantile()
0% 25% 50% 75% 100%
2518.0 4048.0 5017.0 6603.5 16835.0
> mouse.time.mpse %>% mp_rrarefy(.abundance=Abundance, raresize=4048) %>% mp_cal_rarecurve(.abundance=RareAbundance, force=T)
# A MPSE-tibble (MPSE object) abstraction: 4,142 × 13
# OTU=218 | Samples=19 | Assays=Abundance, RareAbundance | Taxonomy=Kingdom, Phylum, Class, Order, Family, Genus, Species
OTU Sample Abund…¹ RareA…² time RareAb…³ Kingdom Phylum Class Order Family
<chr> <chr> <int> <int> <chr> <list> <chr> <chr> <chr> <chr> <chr>
1 OTU_1 F3D0 579 343 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
2 OTU_2 F3D0 345 204 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
3 OTU_3 F3D0 449 291 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
4 OTU_4 F3D0 430 277 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
5 OTU_5 F3D0 154 85 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Ba…
6 OTU_6 F3D0 470 290 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
7 OTU_7 F3D0 282 179 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
8 OTU_8 F3D0 184 117 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Ri…
9 OTU_9 F3D0 45 27 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
10 OTU_… F3D0 158 100 Early <tibble> k__Bac… p__Ba… c__B… o__B… f__Mu…
# … with 4,132 more rows, 2 more variables: Genus <chr>, Species <chr>, and
# abbreviated variable names ¹Abundance, ²RareAbundance,
# ³RareAbundanceRarecurve
# ℹ Use `print(n = ...)` to see more rows.
sorry, I thought I attached it earlier Kindly find attached one of my phyloseq object ps.prev.rooted.zip
I want to rarefy my samples to the first quartile. i don't understand how
mp_cal_rarecurve()
works with this?I tried to do the rarefaction before converting my phyloseq to mpse but I could not go futher the downstream analysis from there as I get an error