0

I am trying to make a script file to run a python script (from the QIIME pipeline) on multiple files without typing the script every time (I have roughly 150 files and more coming).

I use a virtualbox to run an ubuntu environment.

I started by creating a file "splitvm3.sh" using gedit

This file contains :

#!/bin/sh
# this is the script for the VM3 experiment ~/splitvm3.sh

split_libraries.py -m mappingVM3001.txt -b 0 -p -f DNA12115-001-L1-R1-ACGCTCGACA.fna -q DNA12115-001-L1-R1-ACGCTCGACA.qual -o split_library_output001

split_libraries.py -m mappingVM3002.txt -b 0 -p -f DNA12115-002-L1-R1-AGACGCACTC.fna -q DNA12115-002-L1-R1-AGACGCACTC.qual -o split_library_output002

then I used the command :

chmod +x ./splitvm3.sh

from the directory where my file is stored.

and finally I run the script by typing :

python splitvm3.sh

I have the error message :

SyntaxError: invalid syntax

Apparently it is pointing at line 4 of my file.

I totally lack the basic knowledge to understand what is going wrong. I started this whole ubuntu/python/QIIME thing 2 weeks ago and learning everything by myself. Every little bit of help would be greatly appreciated !

Seb

4

4 回答 4

0

The problem is that you are trying to run a shell script using the python interpreter. As true as it is that split_libraries.py is a python script, the script you are trying to is in fact a shell script.

You almost have it right you just have to execute the script like this:

sh splitvm3.sh

Or given that you have a shebang you could also just:

./splitvm3.sh
于 2013-08-08T00:22:02.107 回答
0

我不知道'split_libraries.py'怎么样

该脚本似乎写入了错误消息。

处理这个“第 4 行”并直接在您的终端中调用它。怎么了?你从哪里得到'...txt'文件?

输入文件之一是否格式错误或编码错误?

于 2013-07-25T13:25:21.920 回答
0

我知道这是一个老问题,这个问题现在可能已经解决了,但是错误来自文件中的多行。

Qiime 脚本可以处理多个文件,只要它们的格式正确。

尝试将“splitvm3.sh”文件保存为:

split_libraries.py -m mappingVM3001.txt -b 0 -p -f DNA12115-001-L1-R1-ACGCTCGACA.fna,DNA12115-002-L1-R1-AGACGCACTC.fna -q DNA12115-001-L1-R1-ACGCTCGACA.qual,DNA12115-002-L1-R1-AGACGCACTC.qual -o split_library_output

然后从存储 .fna 和 .qual 文件的同一目录运行:

python splitvm3.sh 
于 2017-01-09T13:18:47.667 回答
0

这是一个老问题,但我有实验室成员问过我这个问题,所以我想补充一点,我很幸运能在多个文件上运行 QIIME 脚本

find . -name "*.fastq" -exec qiimescriptname.py {} \;
或者,我在 bash 中运行 do 循环,例如:

for file in data/*; do usearch32 -fastq_filter "${file}" -fastq_maxee 0.5 -fastq_truncqual 19 -fastq_qmax 45 -fastaout "${file}.fasta"; done;

于 2017-02-23T23:05:32.157 回答