This is a test version of Biostars. For the public version, visit https://www.biostars.org.
[Errno 13] could not open alignment file

Hello everyone,

I trying to load the Bam file, but it seems doesn't allow me to read it from there (working with Ubuntu). I'm working on Windows 10 and now using pysamstats. I had a difficult time. Would you please tell me the reason?

Here the code:

(base) cdc421@DESKTOP-6PSGIA8:~$ pysamstats --type coverage W2.bam > output
[E::hts_open_format] Failed to open file W2.bam
Traceback (most recent call last):
  File "/home/cdc421/anaconda3/bin/pysamstats", line 253, in <module>
    **kwargs
  File "/home/cdc421/anaconda3/lib/python3.7/site-packages/pysamstats/io.py", line 49, in write_csv
    recs = stats_function(alignmentfile, **kwargs)
  File "/home/cdc421/anaconda3/lib/python3.7/site-packages/pysamstats/pileup.py", line 94, in stat_pileup
    no_del=no_del, no_dup=no_dup)
  File "pysamstats/opt.pyx", line 1835, in pysamstats.opt.iter_pileup
  File "pysam/libcalignmentfile.pyx", line 741, in pysam.libcalignmentfile.AlignmentFile.__cinit__
  File "pysam/libcalignmentfile.pyx", line 940, in pysam.libcalignmentfile.AlignmentFile._open
PermissionError: [Errno 13] could not open alignment file `W2.bam`: Permission denied
software error python

1 answer

The error has clearly shown you don't have the permission to this file, check the owner of W2.bam

Log in to answer this question.