What a funky error I got here... ```ERROR ~ Error...
# sarek
e
What a funky error I got here...
Copy code
ERROR ~ Error executing process > 'NFCORE_SAREK:SAREK:BAM_MERGE_INDEX_SAMTOOLS:INDEX_MERGE_BAM (001-07_21307-05PE)'                                              
                                                                                                                                                                 
Caused by:                                                                                                                                             
  Process `NFCORE_SAREK:SAREK:BAM_MERGE_INDEX_SAMTOOLS:INDEX_MERGE_BAM (001-07_21307-05PE)` terminated with an error exit status (1)                             
                                                                                                                                                       
                                                                                                                                                                 
Command executed:                                                                                                             
                                                                                                                                                                 
  samtools \                                                                                                                  
      index \                                                                                                                 
      -@ 0 \                                                                                                                                           
       \                                                                                                                                               
      001-07_21307-05PE.sorted.bam                                                                                                                     
                                                                                                                                                       
  cat <<-END_VERSIONS > versions.yml                                                                                          
  "NFCORE_SAREK:SAREK:BAM_MERGE_INDEX_SAMTOOLS:INDEX_MERGE_BAM":                                                              
      samtools: $(echo $(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*$//')                                                                        
  END_VERSIONS                                                                                                                                                   
                                                                                                                                                          
Command exit status:                                                                                                                                             
  1                                                                                                                                                              
                                                                                                                              
Command output:                                                                                                                                                  
  (empty)                                                                                                                                             
                                                                                                                                                                 
Command error:                                                                                                                                                   
  [E::hts_idx_push] Chromosome blocks not continuous                                                                                                             
  [E::sam_index] Read 'NB552055:623:HWGJGBGYW:1:11101:1089:14188' with ref_name='chr2', ref_length=243199373, flags=83, pos=190742206 cannot be indexed          
  samtools index: failed to create index for "001-07_21307-05PE.sorted.bam"
As far as I can see, the merged BAM has positions out of order(?), how can I debug further?
m
Any idea where these bams are coming for?
e
They're coming from an alignment within sarek, IOW they were made during the pipeline run
m
Funky error indeed
was that a particular genome?
e
hg19
(yeah, in 2025... don't ask)
m
If it were up to me, we would all only use a single genome, but it's not, so sarek supports ALL
so not judging at all, no worries
e
If I manually sort the file, it goes through for that specific file
I wonder if the name of the sample causes an out-of-order merge?
m
sample name should not matter at this level
can you share the command lines you used?
e
.command.sh
Copy code
cat .command.sh 
#!/usr/bin/env bash -C -e -u -o pipefail
samtools \
    merge \
    --threads 3 \
     \
     \
    001-07_21307-05PE.sorted.bam \
    1/001-07_21307-05PE.0004.bam 2/001-07_21307-05PE.0002.bam 3/001-07_21307-05PE.0001.bam 4/001-07_21307-05PE.0003.bam 5/001-07_21307-05PE.0005.bam 6/001-07_21307-05PE.0008.bam 7/001-07_21307-05PE.0007.bam 8/001-07_21307-05PE.0006.bam 9/001-07_21307-05PE.0009.bam 10/001-07_21307-05PE.0011.bam 11/001-07_21307-05PE.0010.bam 12/001-07_21307-05PE.0012.bam

cat <<-END_VERSIONS > versions.yml
"NFCORE_SAREK:SAREK:BAM_MERGE_INDEX_SAMTOOLS:MERGE_BAM":
    samtools: $(echo $(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*$//')
END_VERSIONS
CLI
Copy code
nextflow run nf-core/sarek -r 3.5.1 --input samplesheet.csv -params-file parameters.yaml --outdir ./ -profile cluster -qs 2 -resume --igenomes_ignore
Parameters
Copy code
wes: true
intervals: "/home/incalci/shared/regions/Agilent_custom_HRD.cleaned.noheader.sorted.bed"
genome: hg38
fasta: "/opt/bcbio/1.2.8/genomes/Hsapiens/hg19/seq/hg19.fa"
fasta_fai: "/opt/bcbio/1.2.8/genomes/Hsapiens/hg19/seq/hg19.fa.fai"
dict: "/opt/bcbio/1.2.8/genomes/Hsapiens/hg19/seq/hg19.dict"
bwa: "/opt/bcbio/1.2.8/genomes/Hsapiens/hg19/bwa"
igenomes_ignore: true
step: mapping
tools: "mutect2,vep"
vep_genome: "GRCh37"
vep_species: "homo_sapiens"
vep_cache: /home/incalci/shared/references/vep-cache/
vep_cache_version: '110'
download_cache: true
# Trimming
trim_fastq: true
trim_nextseq: 1
# Alignment
aligner: bwa-mem
use_gatk_spark: "markduplicates"
save_mapped: true
save_output_as_bam: true
skip_tools: "baserecalibrator,baserecalibrator_report,fastqc"
custom_config_base: /home/incalci/shared/pipeline-configs/
germline_resource: /home/incalci/shared/references/mutect2/somatic-b37_af-only-gnomad.raw.sites.vcf.gz
germline_resource_tbi: /home/incalci/shared/references/mutect2/somatic-b37_af-only-gnomad.raw.sites.vcf.gz.tbi
known_snps: /home/incalci/shared/references/mutect2/hg19_v0_1000G_omni2.5.b37.vcf.gz
known_snps_tbi: /home/incalci/shared/references/mutect2/hg19_v0_1000G_omni2.5.b37.vcf.gz.tbi
known_indels: /home/incalci/shared/references/mutect2/hg19_v0_Mills_and_1000G_gold_standard.indels.b37.vcf.gz
known_indels_tbi: /home/incalci/shared/references/mutect2/hg19_v0_Mills_and_1000G_gold_standard.indels.b37.vcf.gz.tbi
dbsnp: /home/incalci/shared/references/mutect2/hg19_v0_dbsnp_138.b37.vcf.gz
dbsnp_tbi: /home/incalci/shared/references/mutect2/hg19_v0_dbsnp_138.b37.vcf.gz.tbi
pon: /home/incalci/shared/references/Agilent_OneSeq_MuTect2_PoN.hg19.new.vcf.gz
pon_tbi: /home/incalci/shared/references/Agilent_OneSeq_MuTect2_PoN.hg19.new.vcf.gz.tbi
vep_include_fasta: true
vep_loftee: true
vep_custom_args: "--everything --filter_common --per_gene --total_length --offline --format vcf --custom file=/home/incalci/shared/references/mutect2/clinvar.hg19.vcf.gz,short_name=ClinVar,format=vcf,type=exact,coords=0,fields=CLNSIG%CLNREVSTAT%CLNDN --check_existing"
whooops
there's a genome: hg38 there
m
yeah but you used
igenomes_ignore
so it should have cancelled it
e
Yeah, but I just set it right in case someone wants to take the parameters without asking questions 😉
✅ 1
The only extra difference is a mutect parameter I set, and sarek doesn't go up to that so far
m
can you share the samplesheet?
e
sec
Patient and sample are the same here
Copy code
sample,fastq_1,fastq_2,sex,lane,status,patient
001-04_21304-R6MT,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-04_21304-R6MT_S8_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-04_21304-R6MT_S8_R3_001.fastq.gz,XX,lane1,1,001-04_21304-R6MT
001-07_21307-05PE,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-07_21307-05PE_S1_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-07_21307-05PE_S1_R3_001.fastq.gz,XX,lane1,1,001-07_21307-05PE
001-07_21307-YLCD,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-07_21307-YLCD_S2_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-07_21307-YLCD_S2_R3_001.fastq.gz,XX,lane1,1,001-07_21307-YLCD
001-09_21309-8Q4A,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-09_21309-8Q4A_S18_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/001-09_21309-8Q4A_S18_R3_001.fastq.gz,XX,lane1,1,001-09_21309-8Q4A
002-01_21301-E9VS,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/002-01_21301-E9VS_S15_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/002-01_21301-E9VS_S15_R3_001.fastq.gz,XX,lane1,1,002-01_21301-E9VS
002-04_21304-4HTD,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/002-04_21304-4HTD_S9_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/002-04_21304-4HTD_S9_R3_001.fastq.gz,XX,lane1,1,002-04_21304-4HTD
002-07_21307-5JYA,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/002-07_21307-5JYA_S3_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/002-07_21307-5JYA_S3_R3_001.fastq.gz,XX,lane1,1,002-07_21307-5JYA
003-01_21301-MTOZ,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-01_21301-MTOZ_S16_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-01_21301-MTOZ_S16_R3_001.fastq.gz,XX,lane1,1,003-01_21301-MTOZ
003-04_21304-AD7H,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-04_21304-AD7H_S10_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-04_21304-AD7H_S10_R3_001.fastq.gz,XX,lane1,1,003-04_21304-AD7H
003-07_21307-JHLK,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-07_21307-JHLK_S4_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-07_21307-JHLK_S4_R3_001.fastq.gz,XX,lane1,1,003-07_21307-JHLK
003-09_21309-K8R3,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-09_21309-K8R3_S19_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-09_21309-K8R3_S19_R3_001.fastq.gz,XX,lane1,1,003-09_21309-K8R3
003-09_21309-QFRZ,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-09_21309-QFRZ_S20_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/003-09_21309-QFRZ_S20_R3_001.fastq.gz,XX,lane1,1,003-09_21309-QFRZ
004-01_23-I-51580,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/004-01_23-I-51580_S17_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/004-01_23-I-51580_S17_R3_001.fastq.gz,XX,lane1,1,004-01_23-I-51580
004-04_21304-T896,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/004-04_21304-T896_S11_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/004-04_21304-T896_S11_R3_001.fastq.gz,XX,lane1,1,004-04_21304-T896
004-07_21307-WC0Y,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/004-07_21307-WC0Y_S5_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/004-07_21307-WC0Y_S5_R3_001.fastq.gz,XX,lane1,1,004-07_21307-WC0Y
005-07_21307-3X0Z,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/005-07_21307-3X0Z_S6_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/005-07_21307-3X0Z_S6_R3_001.fastq.gz,XX,lane1,1,005-07_21307-3X0Z
005-09_21309-YZTM,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/005-09_21309-YZTM_S21_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/005-09_21309-YZTM_S21_R3_001.fastq.gz,XX,lane1,1,005-09_21309-YZTM
006-07_21307-URNZ,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/006-07_21307-URNZ_S7_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/006-07_21307-URNZ_S7_R3_001.fastq.gz,XX,lane1,1,006-07_21307-URNZ
006-09_21309-D90X,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/006-09_21309-D90X_S23_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/006-09_21309-D90X_S23_R3_001.fastq.gz,XX,lane1,1,006-09_21309-D90X
006-09_21309-X17S,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/006-09_21309-X17S_S22_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/006-09_21309-X17S_S22_R3_001.fastq.gz,XX,lane1,1,006-09_21309-X17S
007-04_21304-W6C9,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/007-04_21304-W6C9_S12_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/007-04_21304-W6C9_S12_R3_001.fastq.gz,XX,lane1,1,007-04_21304-W6C9
007-09_21309-78TX,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/007-09_21309-78TX_S24_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/007-09_21309-78TX_S24_R3_001.fastq.gz,XX,lane1,1,007-09_21309-78TX
010-04_21304-B65Y,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/010-04_21304-B65Y_S13_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/010-04_21304-B65Y_S13_R3_001.fastq.gz,XX,lane1,1,010-04_21304-B65Y
011-04_21304-AMGF,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/011-04_21304-AMGF_S14_R1_001.fastq.gz,/home/incalci/shared/runs/Iolanthe/FFPE/raw-data/run_2025-08-04/fastq/011-04_21304-AMGF_S14_R3_001.fastq.gz,XX,lane1,1,011-04_21304-AMGF
m
yeah, nothing out of ordinary here
.nextflow.log
file?
e
sec
I'll get one from the previous runs as a new one is running
.nextflow.log.4
The merge errors look like a red herring, they "disappear" the moment one sample goes through (after manual sorting)
m
I think I find a culprit
m
so I noticed that you're using spark for markduplicates
and this one requires the reads to be name sorted
so I'm assuming sarek produced theses bams with name sorted reads for you
e
Oh, I see
I set spark simply because I wanted mark duplicates to be a little faster 😉
m
but since you also want to save the output as bams, the convertions happens at this level, and it fails as you can see
e
Ah, I see
m
Could you create an issue so that we can have a look into having a proper error message so this won't happen again?
e
I'll get to it shortly
m
Thanks
e
m
Thanks a lot