KolmogorovLab / hapdup

Pipeline to convert a haploid assembly into diploid
Other
85 stars 8 forks source link

unexpected keyword argument 'index_filename' #26

Closed rmormando closed 1 year ago

rmormando commented 1 year ago

Hi I'm trying to run HapDup on my Flye assembly using this command:

./hapdup.py --assembly ../flye.fasta --bam ../flye_LR.bam --bam-index ../flye_LR.bai --out-dir ../hapdup --rtype ont

But for some reason I keep getting this error message:

[2023-02-23 20:54:19] INFO: Filtering alignments
Traceback (most recent call last):
  File "/home/ec2-user/hapdup/./hapdup.py", line 24, in <module>
    sys.exit(main())
  File "/home/ec2-user/hapdup/hapdup/main.py", line 153, in main
    filter_alignments_parallel(args.bam, filtered_bam, min(args.threads, 30),
  File "/home/ec2-user/hapdup/hapdup/filter_misplaced_alignments.py", line 157, in filter_alignments_parallel
    all_reference_ids = [r for r in pysam.AlignmentFile(bam_in, "rb", index_filename=bam_index).references]
  File "pysam/calignmentfile.pyx", line 340, in pysam.calignmentfile.AlignmentFile.__cinit__
  File "pysam/calignmentfile.pyx", line 378, in pysam.calignmentfile.AlignmentFile._open
TypeError: _open() got an unexpected keyword argument 'index_filename'

Anyone know a way to fix it?

mikolmogorov commented 1 year ago

Strange, are you using a Docker installation, or you installed manually? If manually, could you tell your pysam version?

Can you also run withtout --bam-index? If that doesn't work, rename flye_LR.bai into flye_LR.bam.bai and run again without --bam-index.

mikolmogorov commented 1 year ago

Assuming this has been resolved, feel free to follow up if not!