Entering edit mode
7.0 years ago
raplayer
▴
10
Sample merging a phyloseq object with merge_samples() hits an error but works for other objects But if I only take sample data from the phyloseq object by using sample_data() function on it, everything works fine...
So my sample data merges but my phyloseq object refuses to...
Information below:
> merge_samples(Trfclean, "timepoint")
Error in validObject(.Object) : invalid class “phyloseq” object:
Component sample names do not match.
Try sample_names()
> sample_variables(Trfclean)
[1] "X.SampleID" "InputFileName"
...
[15] "studyday" "timepoint"
...
[61] "Description"
> sample_names(sample_data(Trfclean))
[1] "6894" "6893" "6824" "6874" "6842" "6868" "6885" "6869" "6881" "6839"
[11] "6841" "6821" "6810" "6823" "6861" "6843" "6844" "6849" "6887" "6833"
[21] "6827" "6856" "6819" "6858" "6888" "6826" "6812" "6879" "6854" "6882"
[31] "6889" "6871" "6835" "6846" "6883" "6851" "6816" "6878" "6828" "6814"
[41] "6834" "6863" "6818" "6864" "6845" "6832" "6848" "6850" "6857" "6891"
[51] "6825" "6836" "6880" "6886" "6890" "6865" "6877" "6862" "6813" "6838"
[61] "6811" "6852" "6817" "6867" "6847" "6875" "6870" "6808" "6829" "6822"
[71] "6884" "6876" "6853" "6855" "6873" "6892" "6860" "6866" "6806" "6837"
[81] "6807" "6872" "6831" "6820" "6840"
> sample_names(otu_table(Trfclean))
[1] "6894" "6893" "6824" "6874" "6842" "6868" "6885" "6869" "6881" "6839"
[11] "6841" "6821" "6810" "6823" "6861" "6843" "6844" "6849" "6887" "6833"
[21] "6827" "6856" "6819" "6858" "6888" "6826" "6812" "6879" "6854" "6882"
[31] "6889" "6871" "6835" "6846" "6883" "6851" "6816" "6878" "6828" "6814"
[41] "6834" "6863" "6818" "6864" "6845" "6832" "6848" "6850" "6857" "6891"
[51] "6825" "6836" "6880" "6886" "6890" "6865" "6877" "6862" "6813" "6838"
[61] "6811" "6852" "6817" "6867" "6847" "6875" "6870" "6808" "6829" "6822"
[71] "6884" "6876" "6853" "6855" "6873" "6892" "6860" "6866" "6806" "6837"
[81] "6807" "6872" "6831" "6820" "6840"
> nrow(sample_data(Trfclean))
[1] 85
> ncol(otu_table(Trfclean))
[1] 85
You can see the sample IDs and number of rows and columns in the sample_data and otu_table are identical.