FRED-2 / OptiType

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

could not open alignment file #130

Closed tamlav closed 6 months ago

tamlav commented 2 years ago

Hi, I want to use optitype. I run: sudo docker pull fred2/optitype
which works fine, but when run: sudo docker run -v /path to folder:/data/ -t fred2/optitype -i myfile.fastq -d -o /data/ I got error:

[E::hts_open_format] Failed to open file /data/2022_05_31_04_55_51/2022_05_31_04_55_51_1.bam Traceback (most recent call last): File "/usr/local/bin/OptiType/OptiTypePipeline.py", line 358, in 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 /data/2022_05_31_04_55_51/2022_05_31_04_55_51_1.bam: No such file or directory

It do create the folder in data.

I tried different folders as path including root file. I tried to find help in different places. any help?

thanks

Liulab commented 1 year ago

I have the same error,did you know how to fix it? thanks

vodkatad commented 6 months ago

I've the same problem.

data@rotpunkt:~/work/OptiType$ docker -v
Docker version 20.10.25+dfsg1, build b82b9f3

data@rotpunkt:~/work/OptiType$ docker run -v /home/data/work/OptiType/test/exome:/data/ -t fred2/optitype -i test/exome/NA11995_SRR766010_1_fished.fastq test/exome/NA11995_SRR766010_2_fished.fastq -d -o /data
[E::hts_open_format] Failed to open file /data/2024_02_23_10_07_58/2024_02_23_10_07_58_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 `/data/2024_02_23_10_07_58/2024_02_23_10_07_58_1.bam`: No such file or directory
b-schubert commented 6 months ago

You are calling the container incorrect. The Docker-Version expects the input files in the internal folder /data/ . The right way to call it would be:

docker run -v /Users/benjamin.schubert/Downloads/OptiType-master/test/exome/:/data/ -t fred2/optitype -i NA11995_SRR766010_1_fished.fastq NA11995_SRR766010_2_fished.fastq -d -o /data/

vodkatad commented 6 months ago

Ooh, I see. Thanks.