首页 > 解决方案 > 通过 bash 脚本运行 python 脚本会导致意外输出

问题描述

我正在尝试使用一种名为质粒查找器的软件,但遇到了一些困难。质粒查找器使用两个数据库,但是当我尝试使用 bash 脚本在多个文件上批量运行质粒查找器时,它无法使用革兰氏阳性数据库。

我尝试重新安装数据库,在 Docker 中运行脚本,而不是每次运行脚本时都执行 Docker 实例,更改数据库文件名以强制脚本使用 gram positive 数据库。

#!/bin/bash

# runs plasmidFinder on each fasta file in current directory

for FILE in `ls` ;
 do
    mkdir $FILE.output
    sudo docker run --rm -it -v $PLASMID_DB:/database -v $(pwd):/workdir plasmidfinder -i $FILE -o $FILE.output -x
 done

是的,我意识到对于 FILE in ls; 不是好的 bash 编码实践,但我的主要优先事项是让脚本工作:)

以下是我按顺序运行质粒查找器时发生的情况。

{'plasmidfinder': {'results': {'Enterobacteriaceae': {'enterobacteriaceae': 'No '
                                                                            'hit '
                                                                            'found'},
                               'Gram Positive': {'gram_positive': 'No hit '
                                                                  'found'}},
                   'run_info': {'date': '08.05.2019', 'time': '17:58:06'},
                   'user_input': {'file_format': 'fasta',
                                  'filename(s)': ['file1.fasta'],
                                  'method': 'blast'}}}

当我通过我提供的 bash 脚本运行质粒查找器时,会发生以下情况。

{'plasmidfinder': {'results': {'Enterobacteriaceae': {'enterobacteriaceae': 'No '
                                                                            'hit '
                                                                            'found'},                               
                   'run_info': {'date': '08.05.2019', 'time': '17:58:06'},
                   'user_input': {'file_format': 'fasta',
                                  'filename(s)': ['file1.fasta'],
                                  'method': 'blast'}}}

注意这里的第二个例子中没有使用 gram positive 数据库。

我的 bash 脚本有问题吗?我该如何解决这个问题?

谢谢!

标签: bash

解决方案


推荐阅读