我目前正在研究一个蛇形文件,该文件应该在 shell 命令期间产生一些输出,并将其中一些输出提取到另一个文本文件中。但是,我遇到了无法摆脱的错误。
代码:
REF = "./ref/HXB2.fasta"
SAMPLES1, ORI1, = glob_wildcards("./output/Test/KMT/{sample}-{r}.fastq.gz")
rule all:
input: expand("./output/Test/{sample}/{sample}-haplo-results.txt",sample=SAMPLES1)
rule loop:
input: bam = "./output/Test/{sample}.sorted.bam",
directory = "./output/Test/{sample}/"
output: temp = "./output/Test/{sample}/{sample}-haplo-temp.txt",
res = "./output/Test/{sample}/{sample}-haplo-results.txt",
fasta = "./output/Test/{sample}/quasispecies.fasta"
run:
import linecache
import re
shell("cd {input.directory}")
for i in range(14):
shell("haploclique-assembly -r {REF} -i {input.bam} -w -G &> {output.temp}")
with open(output.res,"a") as res:
with open(output.temp,"r") as temp:
for line in temp:
if re.search(r'Cliques', line):
str_list1 = re.findall(r'\d+',line)
elif re.search(r'Max',line):
str_list2 = re.findall(r'\d+',line)
res_list = str_list2 + str_list1
with open(output.fasta,"r") as temp2:
num_lines = len(temp2.readlines())/2
res_list.append(num_lines)
res.write("{0}/{1}/{2}/{3}/{4}\n".format(res_list[0],res_list[1],res_list[2],res_list[3],res_list[4]))
print("Done with %s - Iteration: %d" % (wildcards.sample, i+1))
错误信息:
*** glibc detected *** haploclique: free(): invalid pointer: 0x0000000001271a02 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x75be6)[0x7fab19166be6]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7fab1916b98c]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSs6assignERKSs+0x79)[0x7fab199d3c99]
haploclique(main+0x1493)[0x437a63]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7fab1910fead]
haploclique[0x4396e1]
======= Memory map: ========
00400000-004ca000 r-xp 00000000 00:42 447440 /home/mmeyer/Documents/Master/Git/haploclique/build/bin/haploclique
006c9000-006cb000 rw-p 000c9000 00:42 447440 /home/mmeyer/Documents/Master/Git/haploclique/build/bin/haploclique
006cb000-006cc000 rw-p 00000000 00:00 0
01249000-01566000 rw-p 00000000 00:00 0 [heap]
7fab14000000-7fab14021000 rw-p 00000000 00:00 0
7fab14021000-7fab18000000 ---p 00000000 00:00 0
7fab18abd000-7fab18acc000 r-xp 00000000 08:01 2359301 /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7fab18acc000-7fab18ccb000 ---p 0000f000 08:01 2359301 /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7fab18ccb000-7fab18ccc000 r--p 0000e000 08:01 2359301 /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7fab18ccc000-7fab18ccd000 rw-p 0000f000 08:01 2359301 /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7fab18ccd000-7fab18cd4000 r-xp 00000000 08:01 2372241 /lib/x86_64-linux-gnu/librt-2.13.so
7fab18cd4000-7fab18ed3000 ---p 00007000 08:01 2372241 /lib/x86_64-linux-gnu/librt-2.13.so
7fab18ed3000-7fab18ed4000 r--p 00006000 08:01 2372241 /lib/x86_64-linux-gnu/librt-2.13.so
7fab18ed4000-7fab18ed5000 rw-p 00007000 08:01 2372241 /lib/x86_64-linux-gnu/librt-2.13.so
7fab18ed5000-7fab18eec000 r-xp 00000000 08:01 2372242 /lib/x86_64-linux-gnu/libpthread-2.13.so
7fab18eec000-7fab190eb000 ---p 00017000 08:01 2372242 /lib/x86_64-linux-gnu/libpthread-2.13.so
7fab190eb000-7fab190ec000 r--p 00016000 08:01 2372242 /lib/x86_64-linux-gnu/libpthread-2.13.so
7fab190ec000-7fab190ed000 rw-p 00017000 08:01 2372242 /lib/x86_64-linux-gnu/libpthread-2.13.so
7fab190ed000-7fab190f1000 rw-p 00000000 00:00 0
7fab190f1000-7fab19272000 r-xp 00000000 08:01 2372227 /lib/x86_64-linux-gnu/libc-2.13.so
7fab19272000-7fab19472000 ---p 00181000 08:01 2372227 /lib/x86_64-linux-gnu/libc-2.13.so
7fab19472000-7fab19476000 r--p 00181000 08:01 2372227 /lib/x86_64-linux-gnu/libc-2.13.so
7fab19476000-7fab19477000 rw-p 00185000 08:01 2372227 /lib/x86_64-linux-gnu/libc-2.13.so
7fab19477000-7fab1947c000 rw-p 00000000 00:00 0
7fab1947c000-7fab19492000 r-xp 00000000 08:01 2362536 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fab19492000-7fab19691000 ---p 00016000 08:01 2362536 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fab19691000-7fab19692000 rw-p 00015000 08:01 2362536 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fab19692000-7fab19713000 r-xp 00000000 08:01 2372221 /lib/x86_64-linux-gnu/libm-2.13.so
7fab19713000-7fab19912000 ---p 00081000 08:01 2372221 /lib/x86_64-linux-gnu/libm-2.13.so
7fab19912000-7fab19913000 r--p 00080000 08:01 2372221 /lib/x86_64-linux-gnu/libm-2.13.so
7fab19913000-7fab19914000 rw-p 00081000 08:01 2372221 /lib/x86_64-linux-gnu/libm-2.13.so
7fab19914000-7fab199fe000 r-xp 00000000 08:01 3933030 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fab199fe000-7fab19bfe000 ---p 000ea000 08:01 3933030 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fab19bfe000-7fab19c06000 r--p 000ea000 08:01 3933030 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fab19c06000-7fab19c08000 rw-p 000f2000 08:01 3933030 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fab19c08000-7fab19c1d000 rw-p 00000000 00:00 0
7fab19c1d000-7fab19c33000 r-xp 00000000 08:01 2359447 /lib/x86_64-linux-gnu/libz.so.1.2.7
7fab19c33000-7fab19e32000 ---p 00016000 08:01 2359447 /lib/x86_64-linux-gnu/libz.so.1.2.7
7fab19e32000-7fab19e33000 r--p 00015000 08:01 2359447 /lib/x86_64-linux-gnu/libz.so.1.2.7
7fab19e33000-7fab19e34000 rw-p 00016000 08:01 2359447 /lib/x86_64-linux-gnu/libz.so.1.2.7
7fab19e34000-7fab19ea9000 r-xp 00000000 00:42 259337 /home/mmeyer/Documents/Master/Git/haploclique/build/lib/libbamtools-haploclique.so.2.1.0
7fab19ea9000-7fab1a0a9000 ---p 00075000 00:42 259337 /home/mmeyer/Documents/Master/Git/haploclique/build/lib/libbamtools-haploclique.so.2.1.0
7fab1a0a9000-7fab1a0ac000 rw-p 00075000 00:42 259337 /home/mmeyer/Documents/Master/Git/haploclique/build/lib/libbamtools-haploclique.so.2.1.0
7fab1a0ac000-7fab1a166000 r-xp 00000000 08:01 3981454 /usr/lib/libboost_unit_test_framework.so.1.49.0
7fab1a166000-7fab1a366000 ---p 000ba000 08:01 3981454 /usr/lib/libboost_unit_test_framework.so.1.49.0
7fab1a366000-7fab1a36d000 rw-p 000ba000 08:01 3981454 /usr/lib/libboost_unit_test_framework.so.1.49.0
7fab1a36d000-7fab1a36e000 rw-p 00000000 00:00 0
7fab1a36e000-7fab1a386000 r-xp 00000000 08:01 3933049 /usr/lib/libboost_iostreams.so.1.49.0
7fab1a386000-7fab1a585000 ---p 00018000 08:01 3933049 /usr/lib/libboost_iostreams.so.1.49.0
7fab1a585000-7fab1a587000 rw-p 00017000 08:01 3933049 /usr/lib/libboost_iostreams.so.1.49.0
7fab1a587000-7fab1a5e5000 r-xp 00000000 08:01 3951842 /usr/lib/libboost_program_options.so.1.49.0
7fab1a5e5000-7fab1a7e5000 ---p 0005e000 08:01 3951842 /usr/lib/libboost_program_options.so.1.49.0
7fab1a7e5000-7fab1a7e9000 rw-p 0005e000 08:01 3951842 /usr/lib/libboost_program_options.so.1.49.0
7fab1a7e9000-7fab1a809000 r-xp 00000000 08:01 2372239 /lib/x86_64-linux-gnu/ld-2.13.so
7fab1a9c0000-7fab1a9ca000 rw-p 00000000 00:00 0
7fab1aa06000-7fab1aa08000 rw-p 00000000 00:00 0
7fab1aa08000-7fab1aa09000 r--p 0001f000 08:01 2372239 /lib/x86_64-linux-gnu/ld-2.13.so
7fab1aa09000-7fab1aa0a000 rw-p 00020000 08:01 2372239 /lib/x86_64-linux-gnu/ld-2.13.so
7fab1aa0a000-7fab1aa0b000 rw-p 00000000 00:00 0
7ffc39dc1000-7ffc39de2000 rw-p 00000000 00:00 0 [stack]
7ffc39df8000-7ffc39dfa000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Error in job loop while creating output files ./output/Test/9557-FGS-R/quasispecies.fasta, ./output/Test/9557-FGS-R/9557-FGS-R-haplo-results.txt, ./output/Test/9557-FGS-R/9557-FGS-R-haplo-temp.txt.
RuleException:
NameError in line 35 of /MMCI/TM/structvar/work/hivhaplo/Haplo:
name 'str_list1' is not defined
那么无效指针是否对另一个错误负责?
最好的,马塞尔