pepper
pepper copied to clipboard
Margin-[E::hts_open_format] Failed to open file .bam
Hi, Hope you are doing well. I am getting an error on the margin step of the pipeline. When I re-run it works. I am sure that my bam file was placed in the actual location. There are no duplicate reads in my bam. ` Command output:
[08-02-2022 22:51:19] INFO: PREDICTION FINISHED SUCCESSFULLY.
[08-02-2022 22:51:19] INFO: TOTAL ELAPSED TIME FOR INFERENCE: 1 Min 49 Sec
[08-02-2022 22:51:19] INFO: STEP 3/3 FINDING CANDIDATES
[08-02-2022 22:51:19] INFO: OUTPUT: pepper_output//pepper/
[08-02-2022 22:51:20] INFO: STARTING CANDIDATE FINDING.
[08-02-2022 22:51:44] INFO: FINISHED PROCESSING, TOTAL CANDIDATES FOUND: 46620
[08-02-2022 22:51:44] INFO: FINISHED PROCESSING, TOTAL VARIANTS IN PEPPER: 2877
[08-02-2022 22:51:44] INFO: FINISHED PROCESSING, TOTAL VARIANTS SELECTED FOR RE-GENOTYPING: 43743
[08-02-2022 22:51:44] INFO: FINISHED PROCESSING, TOTAL SNP VARIANTS SELECTED FOR RE-GENOTYPING: 38495
[08-02-2022 22:51:44] INFO: FINISHED PROCESSING, TOTAL INDEL VARIANTS SELECTED FOR RE-GENOTYPING: 5248
[08-02-2022 22:51:44] INFO: TOTAL TIME SPENT ON CANDIDATE FINDING: 0 Min 19 Sec
[08-02-2022 22:51:46] INFO: TOTAL ELAPSED TIME FOR FINDING CANDIDATES: 10 Min 55 Sec
CONTIGS FOUND IN PEPPER VCF:
6
Running OpenMP with 6 threads.
Parsing model parameters from file: /opt/margin_dir/params/phase/allParams.haplotag.ont-r94g507.snp.json
Parsed 46620 total VCF entries from pepper_output//intermediate_files/PEPPER_VARIANT_FULL.vcf.gz; kept 5785 HETs, skipped for region, 29725 for not being PASS, 11110 for being homozygous, 0 for being INDEL
Set up bam chunker in 6s with chunk size 100000 and overlap 10000 (for region=6), resulting in 1710 total chunks
Ordering chunks by estimated depth
Setup complete, beginning run
> Polishing 11% complete (190/1710, 7s). Estimated time remaining: 56s
> Polishing 12% complete (208/1710, 8s). Estimated time remaining: 58s
> Polishing 13% complete (224/1710, 8s). Estimated time remaining: 53s
> Polishing 14% complete (242/1710, 9s). Estimated time remaining: 55s
> Polishing 15% complete (262/1710, 10s). Estimated time remaining: 56s
> Polishing 16% complete (278/1710, 11s). Estimated time remaining: 57s
> Polishing 17% complete (299/1710, 11s). Estimated time remaining: 53s
> Polishing 18% complete (314/1710, 12s). Estimated time remaining: 54s
> Polishing 19% complete (326/1710, 12s). Estimated time remaining: 51s
> Polishing 20% complete (352/1710, 13s). Estimated time remaining: 52s
> Polishing 21% complete (363/1710, 13s). Estimated time remaining: 48s
> Polishing 22% complete (380/1710, 14s). Estimated time remaining: 49s
> Polishing 23% complete (395/1710, 14s). Estimated time remaining: 46s
> Polishing 24% complete (413/1710, 14s). Estimated time remaining: 44s
> Polishing 25% complete (431/1710, 15s). Estimated time remaining: 45s
> Polishing 26% complete (449/1710, 16s). Estimated time remaining: 45s
> Polishing 27% complete (465/1710, 16s). Estimated time remaining: 43s
[E::hts_open_format] Failed to open file 6.bam
ERROR: Cannot open bam file 6.bam
` Bam FlagStats output 39637 + 0 in total (QC-passed reads + QC-failed reads) 9767 + 0 secondary | 8658 + 0 supplementary | 0 + 0 duplicates | 39637 + 0 mapped (100.00% : N/A) | 0 + 0 paired in sequencing | 0 + 0 read1 | 0 + 0 read2 | 0 + 0 properly paired (N/A : N/A) | 0 + 0 with itself and mate mapped | 0 + 0 singletons (N/A : N/A) | 0 + 0 with mate mapped to a different chr | 0 + 0 with mate mapped to a different chr (mapQ>=5)
Best Regards
@infotmatician ,
Can you please put down the full command you are running? I think the --region
is causing this.
Hi, sorry for the late reply.
I did not find any particular reason for causing this error and I mount bam files in docker, I ran the same commands 5 times and got the [E::hts_open_format] Failed to open file 6.bam ERROR: Cannot open bam file 6.bam
on 3 of them
docker run -v /home/berkc/6_bam:/bam -v /home/berkc/inputs:/inputs -it --memory="8g" --memory-swap="8g" --cpus="2" kishwars/pepper_deepvariant:r0.8 bash
mkdir -p pepper_output
cp /opt/pepper_models/PEPPER_VARIANT_ONT_R10_Q20_V8.pkl pepper_output/PEPPER_VARIANT_ONT_R10_Q20_V8.pkl
pepper_variant call_variant -b /bam/6.bam -f /inputs/all_chr_reordered.fa -t 2 -r 6 -m pepper_output/PEPPER_VARIANT_ONT_R10_Q20_V8.pkl -o pepper_output/ --no_quantized -s sample --ont_r10_q20
margin phase /bam/1.bam /inputs/all_chr_reordered.fa pepper_output/PEPPER_VARIANT_FULL.vcf.gz /opt/margin_dir/params/phase/allParams.haplotag.ont-r94g507.snp.json -t 2 -r 6 -V -o pepper_output/PHASED.PEPPER_MARGIN
Note: I also tried without the -r
option and got the same error.
Best,
@infotmatician ,
It looks like a permission issue now. Can you please specify the pepper_output/
to a directory that you explicitly mount with -v
? For example use /inputs/pepper_output
to make sure that margin has permission to create the bam file in that directory.