kundajelab/chrombpnet

Error while training the bias model

rb56 opened this issue · 5 comments

rb56 commented

Hello, I'm trying to train the bias model with the syntax in the tutorial https://github.com/kundajelab/chrombpnet/wiki/Bias-model-training
However I get this error while forming the bigwig files


Error: malformed BED entry at line 7201026. Start was greater than end. Exiting.
needLargeMem: trying to allocate 0 bytes (limit: 100000000000)
[bwHdrRead] There was an error while reading in the header!
[pyBwOpen] bw is NULL!
Traceback (most recent call last):
  File "x", line 33, in <module>
    sys.exit(load_entry_point('chrombpnet', 'console_scripts', 'chrombpnet')())
  File "CHROMBPNET.py", line 38, in main
    pipelines.train_bias_pipeline(args)
  File "pipelines.py", line 288, in train_bias_pipeline
    build_pwm_from_bigwig.main(args)
  File "helpers/preprocessing/analysis/build_pwm_from_bigwig.py", line 46, in main
    bw = pyBigWig.open(args.bigwig)
RuntimeError: Received an error during file opening!

I'm using the latest version of chrombpnet I believe ( installed it 3 days ago)
I'm unsure of what might be wrong and which bed file this error is referring to, the negative.bed and blacklist.bed files look fine. Would appreciate any help.

Thank you!

Hello! I am getting the same error.

It seems like the pipeline.py script is looking for the peaks BED file in the new auxiliary folder instead of the user-defined path to the file.

args_copy.peaks = os.path.join(args.output_dir,"auxiliary/{}filtered.peaks.bed".format(fpx))

I fixed it by commenting the lines that were looking for the peaks and nonpeaks files in a different location than the one that I indicated. It would be nice to know more about the function of those lines of code.

Thank you!

rb56 commented

Hi Andrea,

Thanks for your reply. Did you fix it by changing only the args_copy.peaks variable?
And by the location you had indicted do you mean the path indicated in chrombpnet bias pipeline -o ?

Thank you for your help.

rb56 commented

I think this error is in shifting bam to bw file step: (the reads_to_bigwig.py) before the generating of the peaks bed file. Unsure if this has something to do with the bam file

In my case it was because it was looking for the peaks and the nonpeaks files in the folder

args.output_dir+"auxiliary/"

I am not sure if at some point the script was supposed to make a copy of the files and put them there... But it didn't happen. So in the file pipelines.py, in the function bias_model_qc(args), I commented the lines that were redefining the peaks and nonpeaks file paths:

args_copy.peaks = os.path.join(args_copy.output_dir,"auxiliary/{}filtered.bias_peaks.bed".format(fpx))
args_copy.nonpeaks = os.path.join(args_copy.output_dir,"auxiliary/{}filtered.bias_nonpeaks.bed".format(fpx))

I imagine there is a cleaner solution to this, but in the mean time, I hope it helps.

rb56 commented

Hi Andrea, I could get it to work. I think the problem was with my bam files.

thank you so much for you help! 🥇