zyndagj / BSMAPz

Updated and optimized fork of BSMAP
Other
22 stars 6 forks source link

ZeroDivisionError #35

Closed NaKent closed 3 years ago

NaKent commented 3 years ago

Hi @zyndagj Thank you for supplying with fantastic tool for methylation analysis.

I'm analyzing the methylation ratio of arabidopsis, and I tried to check the moviment of methratio.py. However, I received the ZeroDivisionError as below. What should I do to solve this problem?

GCF_000001735.4_TAIR10.1_genomic.fna: genome of arabidopsis download from NCBI (tair10.1) Col-0_sorted_marked.bam: mapped and sorted bam file generated by BSMAP. environment: python2.7, ubuntu20.04 (WSL2)

↓copyed from terminal

methratio.py --ref GCF_000001735.4_TAIR10.1_genomic.fna --out Col0_methratio.txt Col-0_sorted_marked.bam [methratio] @Tue May 18 21:19:28 2021 loading reference file: GCF_000001735.4_TAIR10.1_genomic.fna ... [main_samview] incorrect number of arguments for -X option. Aborting. [methratio] @Tue May 18 21:19:35 2021 read 0 lines [methratio] @Tue May 18 21:19:35 2021 writing Col0_methratio.txt ... Traceback (most recent call last): File "/anaconda3/envs/py27/bin/methratio.py", line 257, in disp('total %d valid mappings, %d covered cytosines, average coverage: %.2f fold.' % (nmap, nc, float(nd)/nc)) ZeroDivisionError: float division by zero

praxsubba commented 3 years ago

I had the same issue. Just download the methratio.py script from GitHub and replace it with the one you used previously. The issue arises because of the samtools -X option in the old script. Hope that helps!

NaKent commented 3 years ago

Thank you very much!! The problem was solved. If you don't mind, I want to ask unrelated question. (Sorry, I'm stranger to this field.) I tried to run DMR with MethylKit, but the format of methylation ratio file on this BSMAPz seems to be different from original BSMAP's one. So, THIS PAGE is no longer helpful for me. How can I do DMR with the result of methratio.py?

praxsubba commented 3 years ago

You're welcome @NaKent. You should check your methratio.py output files to see if they have any data at all. If they do, then, it should work. I recommend following the methylkit tutorial: https://bioconductor.org/packages/devel/bioc/vignettes/methylKit/inst/doc/methylKit.html

NaKent commented 3 years ago

Thank you for your help. After I learned the page and awk, I achieved analyzing the data with R :)