zeeev / wham

Structural variant detection and association testing
Other
101 stars 25 forks source link

FATAL: No SM tag in bam file. #61

Closed mvheetve closed 1 year ago

mvheetve commented 1 year ago

Hi there,

I keep getting this error message

`Command error:
  INFO: OpenMP will roughly use 2 threads
  INFO: target bams:
   PosCon3.bam
  INFO: fasta file: hg38_bcbio.fa
  INFO: WHAM-GRAPHENING will not give up sampling reads: -z set
  INFO: gathering stats (may take some time) for bam: PosCon3.bam
  FATAL: No SM tag in bam file.`

and using the following command:

Command executed:

  whamg \
      -x 2 \
      -f PosCon3.bam \
      -a hg38_bcbio.fa \
      -z \
      > PosCon3.vcf

here's some info on the bam files I'm using:

for f in temp/testdata/*.bam ; do samtools view -h $f | grep 'SM:' | head -1 ; done
@PG ID:bwa_0    PN:bwa  CL:/kyukon/data/gent/shared/000/gvo00082/bcbio/galaxy/../anaconda/bin/bwa mem -c 250 -M -t 9 -R @RG\tID:PosCon1\tPL:illumina\tPU:PosCon1\tSM:PosCon1 -v 1 /kyukon/data/gent/shared/000/gvo00082/bcbio/genomes/Hsapiens/hg38/bwa/hg38.fa /dev/fd/63 /dev/fd/62   VN:0.7.17-r1188
@PG ID:bwa_0    PN:bwa  CL:/kyukon/data/gent/shared/000/gvo00082/bcbio/galaxy/../anaconda/bin/bwa mem -c 250 -M -t 9 -R @RG\tID:PosCon2\tPL:illumina\tPU:PosCon2\tSM:PosCon2 -v 1 /kyukon/data/gent/shared/000/gvo00082/bcbio/genomes/Hsapiens/hg38/bwa/hg38.fa /dev/fd/63 /dev/fd/62   VN:0.7.17-r1188
@PG ID:bwa_0    PN:bwa  CL:/kyukon/data/gent/shared/000/gvo00082/bcbio/galaxy/../anaconda/bin/bwa mem -c 250 -M -t 9 -R @RG\tID:PosCon3\tPL:illumina\tPU:PosCon3\tSM:PosCon3 -v 1 /kyukon/data/gent/shared/000/gvo00082/bcbio/genomes/Hsapiens/hg38/bwa/hg38.fa /dev/fd/63 /dev/fd/62   VN:0.7.17-r1188
@PG ID:bwa_0    PN:bwa  CL:/kyukon/data/gent/shared/000/gvo00082/bcbio/galaxy/../anaconda/bin/bwa mem -c 250 -M -t 9 -R @RG\tID:PosCon4\tPL:illumina\tPU:PosCon4\tSM:PosCon4 -v 1 /kyukon/data/gent/shared/000/gvo00082/bcbio/genomes/Hsapiens/hg38/bwa/hg38.fa /dev/fd/63 /dev/fd/62   VN:0.7.17-r1188

I had a look already at https://github.com/zeeev/wham/blob/master/src/bin/whamg.cpp lines 1103-1112, but not sure why the error is generated.

Hope you can shed some light on this issue. Regards Mattias

zeeev commented 1 year ago

Hi @mvheetve,

Something strange is going on. I see the command line in the header that contains the SM string -R @RG\tID:PosCon1\tPL:illumina\tPU:PosCon1\tSM:PosCon1

However the SM field is not getting populated?

The SM field is encoded in the @RG lines, not shown above. Hopefully that makes sense. Feel free to reopen the ticket if it doesn't.

mvheetve commented 1 year ago

I manually added the SM field to the @RG line, after which everything worked. I'll have a look upstream why the SM field was not added to the header for these files.

Thank you and regards Mattias