Nextflow脚本块导入Python模块q2_predict_dysbiosis失败求助
Nextflow脚本无法导入本地Python模块问题
我的问题与Stack Overflow上两个同类问题情况一致,使用的是某仓库中的q2_predict_dysbiosis代码(该模块无安装说明,本地直接运行正常,但在Nextflow脚本中无法被找到)。
我的Nextflow代码
process q2_predict_dysbiosis { publishDir 'results', mode: 'copy' input: path abundance_file path species_abundance_file path stratified_pathways_table path unstratified_pathways_table output: path "${abundance_file.baseName}_q2pd.tsv" script: """ #!/usr/bin/env python from q2_predict_dysbiosis import calculate_index import pandas as pd pd.set_option('display.max_rows', None) taxa = pd.read_csv("${species_abundance_file}", sep="\\t", index_col=0) paths_strat = pd.read_csv("${stratified_pathways_table}", sep="\\t", index_col=0) paths_unstrat = pd.read_csv("${unstratified_pathways_table}", sep="\\t", index_col=0) score_df = calculate_index(taxa, paths_strat, paths_unstrat) score_df.to_csv("${abundance_file.baseName}_q2pd.tsv", sep="\\t", float_format="%.2f") """ }
错误信息
Caused by: Process `q2_predict_dysbiosis (1)` terminated with an error exit status (1) Command executed: #!/usr/bin/env python from q2_predict_dysbiosis import calculate_index import pandas as pd pd.set_option('display.max_rows', None) taxa = pd.read_csv("abundance1-taxonomy_table.txt", sep="\t", index_col=0) paths_strat = pd.read_csv("pathways_stratified.txt", sep="\t", index_col=0) paths_unstrat = pd.read_csv("pathways_unstratified.txt", sep="\t", index_col=0) score_df = calculate_index(taxa, paths_strat, paths_unstrat) score_df.to_csv("abundance1_q2pd.tsv", sep="\t", float_format="%.2f") Command exit status: 1 Command output: (empty) Command error: Traceback (most recent call last): File ".command.sh", line 3, in <module> from q2_predict_dysbiosis import calculate_index ModuleNotFoundError: No module named 'q2_predict_dysbiosis'
已尝试的解决操作
- 在script.nf所在目录创建
bin/目录,将q2_predict_dysbiosis.py放入其中,无效果 - 修改shebang声明,无效果
我已经参考Nextflow官方文档中依赖管理的说明操作,但问题仍未解决。希望保留当前的代码块形式,不单独运行外部script.py文件。
内容的提问来源于stack exchange,提问作者user28257266
相关产品推荐
相关产品推荐

