DEP包LFQ工作流报错:'words'应包含多个元素的解决咨询
解决DEP包LFQ函数报错:'words' should contain more than one element
问题原因
你的comparison_table中Reverse和Potential.contaminant列全是空字符串,而DEP包的LFQ函数默认会基于这两列过滤反向序列和污染蛋白。当过滤逻辑找不到任何有效匹配关键词时,就会触发该报错。
解决方案
方案1:直接关闭自动过滤
LFQ函数提供了filter参数,默认值为c("Reverse", "Potential.contaminant")。将该参数设为NULL即可跳过自动过滤步骤:
library(DEP) data_results <- LFQ(comparison_table, expdesign, type = "all", control = NULL, test = NULL, name = "description", ids = "Protein.IDs", alpha = 0.05, lfc = 1, filter = NULL)
方案2:预处理数据后保留过滤逻辑
如果后续需要过滤反向序列或污染蛋白,可以先将空字符串替换为NA,让过滤逻辑能正确识别无标记的条目:
# 预处理空字符串为NA comparison_table$Reverse[comparison_table$Reverse == ""] <- NA comparison_table$Potential.contaminant[comparison_table$Potential.contaminant == ""] <- NA # 重新运行LFQ data_results <- LFQ(comparison_table, expdesign, type = "all", control = NULL, test = NULL, name = "description", ids = "Protein.IDs", alpha = 0.05, lfc = 1)
内容的提问来源于stack exchange,提问作者Ayman R
相关产品推荐
相关产品推荐

