我正在尝试对使用一种新的测序方法准备的DNA读数进行多路分解。为完成此任务而设计的Python脚本抛出了一个错误,我不确定如何解决:
File "demultiplex3.1.py", line 693, in <module>
bc_dict = parse_bc(opts.barcode, Flowcell, Lane)
File "demultiplex3.1.py", line 315, in parse_bc
bc_dict[bc_instance.get_seq()] = bc_instance
File "demultiplex3.1.py", line 266, in get_seq
R1_start = (self.Wobble_R1, self.Barcode_R1 + 'Y' + self.enz_remnant_R1)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'我尝试使用PyCharm 2016.1.4以及在我的大学的研究计算集群上运行它,并且在两个平台上都收到了相同的错误。
以下是产生错误的代码行:
693-697行
bc_dict = parse_bc(opts.barcode, Flowcell, Lane)
if not os.path.exists(opts.outputdir):
os.mkdir(opts.outputdir)
opts.output = tempfile.mkdtemp(prefix='seq', dir=opts.outputdir)
if os.path.exists(opts.output):第314-316行
if bc_instance.Flowcell == fc and bc_instance.Lane == ln:
bc_dict[bc_instance.get_seq()] = bc_instance
return bc_dict第262-269行
def get_seq(self):
"""Return sequence to search on left and right read"""
# design of Read_1 is NNN|BARCODE|CONTROL-NT|ENZ-REMNANT
# CONTROL-NT for R1 is either C or T, put Y as control nucleotide
R1_start = (self.Wobble_R1, self.Barcode_R1 + 'Y' + self.enz_remnant_R1)
# CONTROL-NT for R2 is either G or A, put R as control nucleotide
R2_start = (self.Wobble_R2, self.Barcode_R2 + 'Y' + self.enz_remnant_R2)
return (R1_start, R2_start)我不是代码的作者,在解决Python编码中的错误时,我是个新手。多路分解脚本被设计为基于在样品的实验室制备过程中附着的条形码适配器将样品名称附加到片段上,然后剥离条形码适配器序列,以便只在fastq文件中保留样品标签和片段。
发布于 2019-04-05 05:15:40
R1_start = (self.Wobble_R1, self.Barcode_R1 + 'Y' + self.enz_remnant_R1)错误
+不支持的操作数类型:NoneType和str“
表示代码试图在A为None且B为字符串的情况下执行A + B,这是一个非法操作。它不能是第二个+,因为它的左操作数(self.Barcode_R1 + 'Y'的结果)显然不是None。它一定是左边的+。
因此,self.Barcode_R1必须为None。您需要回溯并弄清楚该变量是什么,以及它的值是从哪里获得的。
https://stackoverflow.com/questions/55524939
复制相似问题