我刚开始抨击,我已经被一个简单的 if;then 语句卡住了一段时间。我使用 bash 运行用 python 编写的 QIIME 命令。这些命令允许我处理微生物 DNA。从测序的原始数据集中,我首先必须检查它们是否与 QIIME 可以处理的格式匹配,然后才能继续执行其余命令。
module load QIIME/1.9.1-foss-2016a-Python-2.7.11
echo 'checking mapping file and demultiplexing'
validate_mapping_file.py -m $PWD/map.tsv -o $PWD/mapcheck > tmp.txt
n_words=`wc -w tmp.txt`
echo "n_words:"$n_words
if [ n_words = '9 temp.txt' ];then
split_libraries_fastq.py -i $PWD/forward_reads.fastq.gz -b $PWD/barcodes.fastq.gz -m $PWD/map.tsv -o $PWD/demultiplexed
else
echo 'Error(s) in map'
exit 1
fi
如果地图很好,我希望得到以下输出(9 个字):
No errors or warnings were found in mapping file.
如果不好(16个字):
Errors and/or warnings detected in mapping file. Please check the log and html file for details.
我想使用此输出来调节以下命令 split_libraries_fastq.py。
我尝试了许多不同版本的 if;then 语句,寻求帮助,但似乎没有任何效果。你们中的任何人都知道为什么不运行“then”命令?我也通过集群运行它。
这是我的地图很好时的输出,第二个命令没有运行:
checking mapping file and demultiplexing
n_words:9 tmp.txt
Error(s) in map
谢谢