我的脚本创建了一个清单文档,其中包含我的 fastq 数据的文件路径,以便上传到 qiime2。输入是样本名称的文本文件和包含 fastq 文件的目录。然后我使用
python ./manifest_single.py --input-dir seqs
运行 shell 文件。输入文本文件示例:
SRR123456 SRR123457 SRR123458...
下面是我的shell文件
#!/local/cluster/bin/python3
# assign a variable to the file of interest
file_name = "seq.by.sys_accession.txt"
dir = "/filepath/seqs"
# open the file with a file handle
read_SRR = open(file_name, "r")
# obtain a list of lines in your file
allLines_list = read_SRR.readlines()
# create output file
outFile = "manifest.txt"
read_outFile = open(outFile, "w")
read_outFile.write(f"sample-id\tabsolute-filepath\n")
# loop over the body of data lines until the end of the file
for rawLine in allLines_list:
line = rawLine.strip()
print(f"|{line}|")
with open(outFile, "a") as f:
read_outFile.write(f"{line}\t{dir}/{line}.R1.fastq.gz\n")
outFile.close()
read_SRR.close()
但我一直收到错误消息
[name@congo metagenome-analysis]$ python ./manifest_single.py --input-dir seqs
File "./manifest_single.py", line 17
read_outFile.write(f"sample-id\tabsolute-filepath\n")
^
SyntaxError: invalid syntax
我用文字“制表符”更改了
\t
和\n
。我已经三次检查了我的输入文件结构和内容。