ythuang0522 / homopolish

High-quality Nanopore-only genome polisher
GNU General Public License v3.0
65 stars 12 forks source link

modpolish division by zero #53

Closed aldertzomer closed 2 years ago

aldertzomer commented 2 years ago

something seems to be wrong with genLen, but not sure what.

Traceback (most recent call last): File "/mnt/md0/tools/homopolish/homopolish.py", line 102, in main() File "/mnt/md0/tools/homopolish/homopolish.py", line 77, in main mp.starModpolsh(fixData,FLAGS.debug) File "/mnt/md0/tools/homopolish/modules/mod_polish.py", line 76, in starModpolsh filePath,mod_fix_flag = getPos(fixData,debug_mod) File "/mnt/md0/tools/homopolish/modules/mod_polish.py", line 178, in getPos fixFlag = fixFlagFn(fixData,fixary,totalCovergae,fileName) File "/mnt/md0/tools/homopolish/modules/mod_polish.py", line 102, in fixFlagFn fix_expected_val = (num_fixPos/average_cov)/genLen ZeroDivisionError: float division by zero

(homopolish) klif@klif3:~/data/20220809_50xEcoli_PPS_groepA_HZ/barcode01/homopolish$ cat "/mnt/md0/tools/homopolish/modules/mod_polish.py" -n |grep 102 -A 10 -B 10
92 shutil.rmtree(fixData.output_dir+"debug") 93 94 95 def fixFlagFn(fixData,fixPosAry,totalCovergae,fileName): 96 filePath = fixData.output_dir+"debug/"+fixData.contig_id 97 #use expected value: (fixPos/coverage)/length 98 num_fixPos = len(fixPosAry) 99 genLen = len(fixData.seq) 100 fixFlag = True 101 average_cov = totalCovergae/genLen 102 fix_expected_val = (num_fixPos/average_cov)/genLen 103 104 #saveFn csv 105 Fndata = [] 106 Fndata.append([average_cov,genLen,num_fixPos,fix_expected_val]) 107 108 df = pds.DataFrame(Fndata) 109 df = df.reset_index() 110 if(len(Fndata)!=0): 111 df.columns =["","avg_cov","genLen","num_fixPos","fix_expected_val"] 112 df.to_csv(filePath+"/"+fileName+"_fnFlag.csv",encoding="ascii",index=False)

aldertzomer commented 2 years ago

managed to get it working. the -q flag does not need a folder but a fastq file itself. the term "fastq_path" is a bit ambiguous.