Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge_phyloseq deleting samples #1771

Open
efgellerson opened this issue Sep 18, 2024 · 1 comment
Open

merge_phyloseq deleting samples #1771

efgellerson opened this issue Sep 18, 2024 · 1 comment

Comments

@efgellerson
Copy link

Hi there,
I have run into a weird issue using phyloseq. I am working with two objects, ps1919 with 35 samples and ps1144 with 185 samples. When I merge the two, they are deleting 10 cases, since the new object (allps) has 210 samples instead of 220. Any ideas on this issue? I've checked the OTU tables for the samples that are being deleted, and they do have reads, so it's not like they're empty and deleting them. My code is below if that helps. Thanks!

ps1144 <- phyloseq(otu_table1144,sample_data(metadata1144), tax_table1144)
ps1919 <- phyloseq(otu_table1919,sample_data(metadata1919), tax_table1919)

dna <- Biostrings::DNAStringSet(taxa_names(ps1144))
names(dna) <- taxa_names(ps1144)
ps1144 <- merge_phyloseq(ps1144, dna)
taxa_names(ps1144) <- paste0("ASV", seq(ntaxa(ps1144)))
ps1144

dna <- Biostrings::DNAStringSet(taxa_names(ps1919))
names(dna) <- taxa_names(ps1919)
ps1919 <- merge_phyloseq(ps1919, dna)
taxa_names(ps1919) <- paste0("ASV", seq(ntaxa(ps1919)))
#after this point I check each of tables (metadata, OTU table, and taxa table, and the samples that are being deleted are all from ps1919, but they are in the tables with information)

allps <- merge_phyloseq(ps1144, ps1919)
#after merging here I do the same check and there are only 210 cases, and the 10 samples I'm trying to look at are gone! 
@G-gnome
Copy link

G-gnome commented Sep 20, 2024

I think that maybe the sample names may not be overlapping 100% between the phyloseq objects. Maybe check that they are the same between the objects for those that are being dropped?

sample_names(ps1144) sample_names(ps1919)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants