我对Nextflow中的Python脚本有问题,我的目标是用Python脚本编写一个文件,并将其与Nextflow一起保存在publishdir中(以及在其他过程中使用此文件之后)。 我在nextflow中的流程如下(这些文件是以前定义的):
process writefile{
publishDir "${params.output_dir}/formatted", mode: 'copy'
input:
path file from change_file
output:
path "formattedfile.txt" into file_changed
script:
"""
file2formattedfile.py ${file} formattedfile.txt
"""
}
python脚本:(我简化了实际过程,但本质是这样的),我需要在nextflow中获得保存在输出文件中的文件
#!/usr/bin/env python3
import argparse
from sys import argv
def main():
input,output = argv[1:3]
out = open(output, "w")
#My real operations are here
out.write("Operations and text")
out.close()
if __name__ == "__main__":
main()
问题是文件不是保存在发布目录中,而是在nextflow的目录工作中,当我运行工作流时,流程完成,没有错误,但表示DataflowQueue(queue=[])
[e1/74e0ee] process > writefile (DataflowQueue(queue=[])) [100%] 1 of 1 ✔
谢谢
-----------更新-----------------
我将输入文件更改为文件()。nextflow.config文件:
params {
input_file = 'data/old_file.txt'
output_dir = 'output_new'
}
main.nf
change_file = file(params.input_file)
process writefile{
publishDir "${params.output_dir}/formatted", mode: 'copy'
input:
path file from change_file
output:
path "formattedfile.txt" into file_changed
script:
"""
file2formattedfile.py ${file} formattedfile.txt
"""
}
这更改了nextflow的输出,但我的输入文件不在发布目录中(但在目录工作中)
[7d/78559b] process > writefile (/home/myuser/Documentos/dir/pipeline_dir/data/old_file.txt) [100%] 1 of 1 ✔
writefile之后的这个路径是我输入文件的路径,我不知道为什么(这个目录中没有任何更改)
使用“更改文件”频道输入的内容似乎有问题。如果“嫦娥文件”应该是value channel,请考虑以下内容:
结果:
如果上述内容没有帮助,请说明“更改文件”频道是如何创建的
相关问题 更多 >
编程相关推荐