Open ying14 opened 7 months ago
Super helpful Ying Hello ...thanks, exactly the right answer, Edge case we need to take care of. Best wishes Susan
A quinta, 18/04/2024, 20:16, Ying Taur @.***> escreveu:
Hi, long-term phyloseq user and fan. When running merge_phyloseq(), an error occurs if the merged sample data only has one column:
data(GlobalPatterns)phy1 <- subset_samples(GlobalPatterns,SampleType=="Soil")phy2 <- subset_samples(GlobalPatterns,SampleType=="Ocean") sample_data(phy1) <- sample_data(phy1)[,"SampleType"] sample_data(phy2) <- sample_data(phy2)[,"SampleType"] merge_phyloseq(phy1,phy2)
> Error in access(object, "sam_data", errorIfNULL) : #> sam_data slot is empty.
The issue seems to be related to a specific step in the internal function merge_phyloseq_pair(), where one-column data frames are incorrectly simplified into vectors.
I believe this might be the fix: within the setMethod("merge_phyloseq_pair", signature("sample_data", "sample_data") function, change newx <- newx[,names(newx)!="X0"] to newx <- newx[,names(newx)!="X0",drop=FALSE].
— Reply to this email directly, view it on GitHub https://github.com/joey711/phyloseq/issues/1744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJFZPIRRZUYYLX2VVW2POLY6ALZRAVCNFSM6AAAAABGN4ED2CVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TCMZYGI4DINY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Great.... thank you Susan!
Hi, long-term
phyloseq
user and fan. When runningmerge_phyloseq()
, an error occurs if the merged sample data only has one column:The issue seems to be related to a specific step in the internal function
merge_phyloseq_pair()
, where one-column data frames are incorrectly simplified into vectors.I believe this might be the fix: within the
setMethod("merge_phyloseq_pair", signature("sample_data", "sample_data")
function, changenewx <- newx[,names(newx)!="X0"]
tonewx <- newx[,names(newx)!="X0",drop=FALSE]
.