在执行量化(kallisto/salmon)后,我正在使用一些快速的 R 脚本来 cbind 文件。问题是,我收到一个 R 错误,说我的输入文件长度不同,所以 cbind() 不起作用。
这显然不是这种情况,它们都是 16887 行(用 bash wc 检查),并且在没有snakenmake 的 R 中工作得很好。
还值得一提的是,我确实得到了随机数样本(~ 1 到 4)的输出。
这是R代码:
sample <- read.table(snakemake@input[[1]], sep = "\t", header = TRUE)
if (!file.exists(snakemake@params[[1]])) {
merge <- data.frame(sample)
} else {
merge1 <- read.table(snakemake@params[[1]], sep = "\t", header = TRUE)
merge <- cbind(merge1, sample[,2, drop=F])
}
write.table(merge, snakemake@params[[1]], sep = "\t", quote = F, row.names = F)
file.create(snakemake@output[[1]])
Run Code Online (Sandbox Code Playgroud)
而蛇形规则:
rule merge_quantif:
input:
QUANTIF+"/{sample}/quantif.txt"
output:
QUANTIF+"/{sample}/merge.done"
params:
QUANTIF+"/all_sample_quantified.txt"
script:
"Tools/merge_quantif.R"
Run Code Online (Sandbox Code Playgroud)
我的文件是这样的: …