PengNi / ccsmeth

Detecting DNA methylation from PacBio CCS reads
BSD 3-Clause Clear License
66 stars 10 forks source link

A question about BedTools #22

Closed hunkui1 closed 1 year ago

hunkui1 commented 1 year ago

hello,PengNi,While doing call_freqb, I encountered the following problem,How do I deal with it?Thank you

Error was:

            Traceback (most recent call last):
      File "/home/lyx/wangaokai/anaconda3/envs/ccsmeth-mas/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap
        self.run()
      File "/home/lyx/wangaokai/anaconda3/envs/ccsmeth-mas/lib/python3.10/multiprocessing/process.py", line 108, in run
        self._target(*self._args, **self._kwargs)
      File "/home/lyx/wangaokai/anaconda3/envs/ccsmeth-mas/lib/python3.10/site-packages/ccsmeth/call_mods_freq_bam.py", line 531, in _worker_write_bed_result
        ori_bed.sort().moveto(bedfile)
      File "/home/lyx/wangaokai/anaconda3/envs/ccsmeth-mas/lib/python3.10/site-packages/pybedtools/bedtool.py", line 923, in decorated
        result = method(self, *args, **kwargs)
      File "/home/lyx/wangaokai/anaconda3/envs/ccsmeth-mas/lib/python3.10/site-packages/pybedtools/bedtool.py", line 402, in wrapped
        stream = call_bedtools(
      File "/home/lyx/wangaokai/anaconda3/envs/ccsmeth-mas/lib/python3.10/site-packages/pybedtools/helpers.py", line 460, in call_bedtools
        raise BEDToolsError(subprocess.list2cmdline(cmds), stderr)
    pybedtools.helpers.BEDToolsError:
    Command was:

            bedtools sort -i ./r64114_20201106_074159.hifi.pbmm2.call_mods.modbam.feaq.count.all.bed

    Error message was:
    Error: malformed BED entry at line 12023531. Start Coordinate detected that is < 0. Exiting.
hunkui1 commented 1 year ago

Lines 12023531 was: scaffold068 -1 0 . 1 + -1 0 0,0,0 1 0 How do I circumvent it in the process?

PengNi commented 1 year ago

@hunkui1 , it's weird that the position of this site is -1 of scaffold068. I am not sure what happened without more information. What command did you use?

hunkui1 commented 1 year ago

I can't find out what's wrong. I hope to get your help command was: ccsmeth call_hifi --subreads /home/lyx/wangaokai/data/pacbio/Td-1/r64114_20201106_074159/P05DY20267749-1_r64114_20201106_074159_1_G02.subreads.bam --threads 20 --output ./r64114_20201106_074159.subreads.hifi.bam ccsmeth align_hifi --hifireads /home/lyx/wangaokai/data/pacbio_analyse/tden-mas/01.call_hifi/r64114_20201106_074159.subreads.hifi.bam --ref /home/lyx/wangaokai/data/genome/tden/Tden.genome.fasta --output ./r64114_20201106_074159.hifi.pbmm2.bam --threads 20 CUDA_VISIBLE_DEVICES=0 ccsmeth call_mods --input /home/lyx/wangaokai/data/pacbio_analyse/tden-mas/02.align_hifi/r64114_20201106_074159.hifi.pbmm2.bam --ref /home/lyx/wangaokai/data/genome/tden/Tden.genome.fasta --model_file /home/lyx/wangaokai/software/ccsmeth-mas/ccsmeth/models/model_ccsmeth_5mCpG_call_mods_attbigru2s_b21.v1.ckpt --output ./r64114_20201106_074159.hifi.pbmm2.call_mods --threads 10 --threads_call 2 --model_type attbigru2s --mode align ccsmeth call_freqb --input_bam /home/lyx/wangaokai/data/pacbio_analyse/tden-mas/03.call_mods/r64114_20201106_074159.hifi.pbmm2.call_mods.modbam.bam --ref /home/lyx/wangaokai/data/genome/tden/Tden.genome.fasta --output ./r64114_20201106_074159.hifi.pbmm2.call_mods.modbam.feaq --threads 20 --sort --bed

PengNi commented 1 year ago

@hunkui1 , the commands seems fine. ccsmeth call_freqb starts looking for CpGs from coordinate 0 to the end of a contig, so there shouldn't be a site with a -1 position. Can you send me the reads (in bam format) aligned to scaffold068 and the reference seqeunce of scaffold068?

hunkui1 commented 1 year ago

068.zip I extracted the reads from r64114_20201106_074159.hifi.pbmm2.call_mods.modbam.bam with the following command: samtools view -h r64114_20201106_074159.hifi.pbmm2.call_mods.modbam.bam scaffold068 > sac.bam

PengNi commented 1 year ago

@hunkui1 , thanks, I'll let you know when I have debuged this issue.

PengNi commented 1 year ago

@hunkui1 , it turns out there wes a bug in call_freqb module. I have fixed it now. Please use the latest version from GitHub.

hunkui1 commented 1 year ago

thanks. I'll try the latest version

hunkui1 commented 1 year ago

hello,PengNi,I had the same problem again。 Error was: 99c18a63b21e43c2853f8c536557628 Lines was: 52b2c6eb159366140ca19e4025e8943 Do you need me to provide the reference sequence forscaffold092 and the reads (in bam format) aligned to scaffold092?

PengNi commented 1 year ago

Hi @hunkui1, did you reinstall ccsmeth using the source code of github repo like:

pip uninstall ccsmeth
git clone https://github.com/PengNi/ccsmeth.git
cd ccsmeth
python setup.py install
hunkui1 commented 1 year ago

This version is good. Thank you again.

PengNi commented 1 year ago

@hunkui1 , thanks for your try of ccsmeth.