我试图在julia内部使用来自python的mappy包,但是我得到了这个错误: AttributeError("'PyCall.jlwrap‘对象没有’encode‘属性“)。我不明白这个错误。
下面是我的代码:
using PyCall
using FASTX
using CodecZlib
py"""
import mappy as mp
def aligner(name,preset,threads):
aligner = mp.Aligner(name,preset=preset,n_threads = threads)
return aligner
def mappy(seq,aligner):
try:
line = next(aligner.map(seq))
return False
except StopIteration:
return True
"""
aligner = py"aligner"("genome.idx","sr",4)
for record in FASTQ.Reader(GzipDecompressorStream(open("data_file.fastq.gz")))
check = py"mappy"(sequence(record),aligner)
end
close(reader)发布于 2021-07-31 20:18:35
问题出在发送到mappy的数据类型上。序列(记录)不是字符串类型,因此无法处理数据。我不知道为什么返回的错误是这个奇怪的错误。更正后的代码应为:
for record in FASTQ.Reader(GzipDecompressorStream(open("data_file.fastq.gz")))
seq = string(sequence(record))
check = py"mappy"(seq,aligner)
end
close(reader)https://stackoverflow.com/questions/68597735
复制相似问题