SBIMB / StellarPGx

Calling star alleles in highly polymorphic pharmacogenes (e.g. CYP450 genes) by leveraging genome graph-based variant detection.
MIT License
30 stars 7 forks source link

Docker run -- bam.bai file is missing from get_depth step #9

Closed pauline-ng closed 2 years ago

pauline-ng commented 2 years ago

get_depth step failing. It looks like the sample.recal.bam.bai file is not copied over to work_dir.

The run error:

  [E::idx_find_and_load] Could not retrieve index file for 'sample.recal.bam'
  ERROR: fail to open index BAM file 'sample.recal.bam'

Work dir:
  /home/pauline/StellarPGx/work/11/656f25ddd11281c7e79b18c9dee075

The bam file is in the work dir, but the bam.bai file is not (and the .bam.bai exists for $in_bam)

To Reproduce

Run on linux with docker and nextflow installed. nextflow run main.nf -profile standard --build b37 --gene cyp2d6

FULL Error message nextflow run main.nf -profile standard --build b37 --gene cyp2d6 N E X T F L O W ~ version 21.10.6 Launching main.nf [lethal_kare] - revision: ab68701493 executor > local (5) [d0/73a9dc] process > call_snvs1 (1) [ 0%] 0 of 1 [52/8bc26f] process > call_snvs2 (1) [ 0%] 0 of 1 [66/661bff] process > call_sv_del (1) [ 0%] 0 of 1 [3a/fa314c] process > call_sv_dup (1) [ 0%] 0 of 1 [11/656f25] process > get_depth (1) [ 0%] 0 of 1 [- ] process > format_snvs - [- ] process > get_core_var - [- ] process > analyse_1 - [- ] process > analyse_2 - [- ] process > analyse_3 - [- ] process > call_stars - Error executing process > 'get_depth (1)'

Caused by: Process get_depth (1) terminated with an error exit status (2)

Command executed:

samtools bedcov --reference hs37d5/hs37d5.fa cyp_b37/test3.bed sample.recal.bam > sample.recal_cyp2d6_ctrl.depth

executor > local (5) [- ] process > call_snvs1 (1) - [- ] process > call_snvs2 (1) - [- ] process > call_sv_del (1) - [- ] process > call_sv_dup (1) - [11/656f25] process > get_depth (1) [100%] 1 of 1, failed: 1 ✘ [- ] process > format_snvs - [- ] process > get_core_var - [- ] process > analyse_1 - [- ] process > analyse_2 - [- ] process > analyse_3 - [- ] process > call_stars - Error executing process > 'get_depth (1)'

Caused by: Process get_depth (1) terminated with an error exit status (2)

Command executed:

samtools bedcov --reference hs37d5/hs37d5.fa cyp_b37/test3.bed sample.recal.bam > sample.recal_cyp2d6_ctrl.depth

Command exit status: 2

Command output: (empty)

Command error: [E::idx_find_and_load] Could not retrieve index file for 'sample_1.recal.bam' ERROR: fail to open index BAM file 'sample_1.recal.bam'

Work dir: /home/pauline/StellarPGx/work/11/656f25ddd11281c7e79b18c9dee075

Tip: you can replicate the issue by changing to the process work dir and entering the command bash .command.run

twesigomwedavid commented 2 years ago

Hi @pauline-ng, Thanks for raising this issue.

According to your message, the BAM file used in the executed command is sample.recal.bam yet the error is pointing to sample_1.recal.bam. This implies that there's a potential mix up in your input:

  1. May you double-check to see if all your BAM files have corresponding indexes?

  2. May you share how you supplied the in_bam parameter. Note that this should be in one of the following formats (in the nextflow.config file): in_bam = "/path/to/data/GeT-RM/NA12878*{bam,bai}" // for single sample in_bam = "/path/to/data/GeT-RM/*{bam,bai}" // for all samples in the directory in_bam = "/path/to/data/GeT-RM/NA*{bam,bai}" // for a few samples with a particular pattern e.g. NA...

  3. Could you run the test command to see if it gives any errors on your end? nextflow run main.nf -profile standard,test

Thanks

David

pauline-ng commented 2 years ago

Hi David,

Thank you, your suggestions helped.

My mistake was that I had:

in_bam= "/home/pauline/StellarPGx/sample.recal.bam"

instead of

in_bam= "/home/pauline/StellarPGx/sample.recal*{bam,bai}"

Once I made that change, it ran. (The sample vs sample_1 was because I didn't want to disclose sample IDs publicly on github, that was just an editing error when I was writing up the issue.)

Thanks, Pauline