FRED-2 / OptiType

Precision HLA typing from next-generation sequencing data
BSD 3-Clause "New" or "Revised" License
180 stars 74 forks source link

IOError: [Errno 2] could not open alignment file #116

Open dstueckm opened 4 years ago

dstueckm commented 4 years ago

Hi there, I know this particular error has come up a few times now on different issues (e.g. https://github.com/FRED-2/OptiType/issues/66), but I believe I have taken all the steps mentioned in the solution and am still receiving an error message (I am using the same folder I mounted as my output folder).

I am trying to run OptiType via docker using Docker Desktop for windows, and using fished fastq files that were successfully generated by razerS3. The command I am trying is:

docker run -v D:\Test:/data/ -t fred2/optitype -i D:\sample_fished.fastq -r -o /data/ Which returns: IOError: [Errno 2] could not open alignment file /data/2020_09_03_18_16_20/2020_09_03_18_16_20_1.bam: No such file or directory

D:\Test is an empty folder. I have similarly tried using an empty folder on my C: drive, and get the same message. Since this runs off of a linux subsystem, I have also tried replacing the windows filepaths with the corresponding linux subsystem filepaths, which returns an entirely new error:

docker run -v /mnt/d/Test:/data/ -t fred2/optitype -i /mnt/d/sample_fished.fastq -r -o /data/ OSError: [Errno 13] Permission denied: '/data/2020_09_03_18_19_00'

I have ensured that these folders have full permissions for user and group. Attempting to write to ~ (/home/username/) gives the same result. Any advice would be greatly appreciated!

nikolasthuesen commented 3 years ago

I've had the same problem, and had Optitype work for 9 samples but it gave this error on the 10th.

haraldgrove commented 3 years ago

I think I'm having the same problem, at least the error message is the same. I'm using the docker image and running on a linux server. My command line is:

docker run --rm -v /home/harald/fastq:/fastq -v /home/harald/out:/out -t fred2/optitype \
-i fastq/sample_R1.fastq fastq/sample_R2.fastq \
--dna --verbose --outdir /out
The output is:
mapping with 1 threads... 

 0:00:00.67 Mapping BB-B0006-DNA_R1.fastq to GEN reference...

 0:00:01.23 Mapping BB-B0006-DNA_R2.fastq to GEN reference...

 0:00:01.40 Generating binary hit matrix.
[E::hts_open_format] Failed to open file /out/2020_10_08_02_07_35/2020_10_08_02_07_35_1.bam
Traceback (most recent call last):
  File "/usr/local/bin/OptiType/OptiTypePipeline.py", line 310, in <module>
    pos, read_details = ht.pysam_to_hdf(bam_paths[0])
  File "/usr/local/bin/OptiType/hlatyper.py", line 186, in pysam_to_hdf
    sam = pysam.AlignmentFile(samfile, sam_or_bam)
  File "pysam/libcalignmentfile.pyx", line 728, in pysam.libcalignmentfile.AlignmentFile.__cinit__
  File "pysam/libcalignmentfile.pyx", line 918, in pysam.libcalignmentfile.AlignmentFile._open
IOError: [Errno 2] could not open alignment file `/out/2020_10_08_02_07_35/2020_10_08_02_07_35_1.bam`: 
No such file or directory 

From the time stamps it looks like the alignment starts and then quickly stops without providing any feedback.

AlBurl commented 3 years ago

I am having this same issue, it was working for me but now am receiving this same error. Has anyone managed to resolve this? Thanks

nikolasthuesen commented 3 years ago

I fixed most of my problems with Optitype by switching ILP solver from cplex to cbc. Sometimes cplex does not converge to a solution, which gives problems down the line. Did not have of those problems with cbc (version 2.9.5)

CiCistar commented 2 years ago

I fixed this problem, it is beacause when we run the images, its default user is “bioxxx”(I forget the name), but the "root" is required to execute the command of OptiTypePipeline.py. So we must use the command with --user root. For example, sudo docker run -v $(pwd)/test:/data/ --user root -t fred2/optitype -i NA11995_SRR766010_1_fished.fastq -d -o /data/. Meanwhile, the test dir is my data dir which include NA11995_SRR766010_1_fished.fastq file.

CiCistar commented 2 years ago

Another thing important, if you are using Windows, you should also pay attention to using the shell with administrator privileges.