(How) can you index a BAM file using pysam
?
When I tried the intuitive pysam.index
I got:
import pysam
my_bam = pysam.AlignmentFile("regular_bwamem_mapping.bam", "rb")
pysam.index(my_bam)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-a0b3a04ecb2c> in <module>
----> 1 pysam.index(L_bam)
~/miniconda3/lib/python3.7/site-packages/pysam/utils.py in __call__(self, *args, **kwargs)
59 args,
60 catch_stdout=kwargs.get("catch_stdout", True),
---> 61 save_stdout=kwargs.get("save_stdout", None))
62
63 if kwargs.get("split_lines", False):
pysam/libcutils.pyx in pysam.libcutils._pysam_dispatch()
TypeError: object of type 'pysam.libcalignmentfile.AlignmentFile' has no len()