macs3-project/MACS

Bug: BEDPE Format input for hmmratac

bcantarel opened this issue · 3 comments

Thanks so much for adding the option to allow bedpe for hmmratac as a way to support CRAM -- unfortunately, when I am trying this command on a BED file, I am getting the following error

Describe the bug

INFO @ 26 Sep 2023 00:19:46: [95 MB]

Command line: hmmratac -i the_BEDPE_file.bed -f BEDPE -n temp

Random seed selected as: 10151

INFO @ 26 Sep 2023 00:19:46: [95 MB] #1 Read fragments from BAM file...
Traceback (most recent call last):
File "/opt/conda/bin/macs3", line 1026, in
main()
File "/opt/conda/bin/macs3", line 101, in main
run( args )
File "/opt/conda/lib/python3.10/site-packages/MACS3/Commands/hmmratac_cmd.py", line 81, in run
bam = BAMPEParser(options.bam_file[0], buffer_size=options.buffer_size)

To Reproduce
samtools view -@ 12 -1 --reference genome.fa -o file.bam file.cram
macs3 randsample -i file.bam -f BAMPE -p 100 -o the_BEDPE_file.bed
macs3 hmmratac -f BEDPE -i the_BEDPE_file.bed --outdir macs3out -n out --save-digested

System (please complete the following information):

  • OS: Linux
  • Python 3.10.12
  • Numpy version 1.23.5
  • macs3 3.0.0b3 (pulled from main last week)
taoliu commented

It is strange since in the main branch the line 81 of hmmratac_cmd.py is different with what you saw. You saw bam = BAMPEParser(options.bam_file[0], buffer_size=options.buffer_size), but now it's

if options.format == "BAMPE":
options.info("#1 Read fragments from BAMPE file...")
parser = BAMPEParser
elif options.format == "BEDPE":
options.info("#1 Read fragments from BEDPE file...")
parser = BEDPEParser
else:
raise Exception("wrong format")

Since this change hasn't been included in b3, could you remove MACS3 such as pip uninstall macs3 then pull the main branch (git clone git@github.com:macs3-project/MACS.git) and install macs3 again? Sorry that we are working on finishing documentation these days and haven't included this BEDPE feature for hmmratac in a new release.

Thanks! This worked for me!!

taoliu commented

@bcantarel FYI, in the release 3.0.0, we have included the support of BEDPE format in hmmratac command.