tseemann / snippy

:scissors: :zap: Rapid haploid variant calling and core genome alignment
GNU General Public License v2.0
474 stars 115 forks source link

samtools markdup: error, no ms score tag #598

Open lusacristan opened 1 month ago

lusacristan commented 1 month ago

Hello! I'm trying to run this:

snippy --outdir GPSC33 --R1 ERR3261191_1.fastq.gz --R2 ERR3261191_2.fastq.gz --ref Reference_sequence_GPSC33.fa

but I got this error:

`### samtools faidx reference/ref.fa

bwa index reference/ref.fa

[bwa_index] Pack FASTA... 0.01 sec [bwa_index] Construct BWT for the packed sequence... [bwa_index] 0.31 seconds elapse. [bwa_index] Update BWT... 0.01 sec [bwa_index] Pack forward-only FASTA... 0.01 sec [bwa_index] Construct SA from BWT and Occ... 0.16 sec [main] Version: 0.7.18-r1243-dirty [main] CMD: bwa index reference/ref.fa [main] Real time: 0.569 sec; CPU: 0.501 sec

mkdir -p reference/genomes && cp -f reference/ref.fa reference/genomes/ref.fa

ln -sf reference/ref.fa .

ln -sf reference/ref.fa.fai .

mkdir -p reference/ref && gzip -c reference/ref.gff > reference/ref/genes.gff.gz

bwa mem -Y -M -R '@RG\tID:GPSC33_folder\tSM:GPSC33_folder' -t 4 reference/ref.fa /hpcfs/home/ciencias_biologicas/lf.sacristan2215/CABANA/vigilancia/Module_12/ERR2667737_1.fastq.gz /hpcfs/home/ciencias_biologicas/lf.sacristan2215/CABANA/vigilancia/Module_12/ERR2667737_2.fastq.gz | samclip --max 10 --ref reference/ref.fa.fai | samtools sort -n -l 0 -T /tmp --threads 1 -m 8000M | samtools fixmate -m --threads 1 - - | samtools sort -l 0 -T /tmp --threads 1 -m 8000M | samtools markdup -T /tmp --threads 1 -r -s - - > snps.bam

samtools markdup: error, no ms score tag. Please run samtools fixmate on file first.

samtools markdup: error, no ms score tag. Please run samtools fixmate on file first. `

I've tried it several times with different files but the error is the same.

pmagwene commented 1 month ago

I'm seeing this error as well. I'm installing snippy through a CONDA env (via Snakemake).

I notice samtools had a recent release (1.21; https://github.com/samtools/samtools/releases). Among the changes in the release notes is the following:

samtools fixmate no longer removes the PAIRED flag from reads that have no mate. This is done on the understanding that the PAIRED flag is a sequencing technology indicator not a feature of alignment. This is a change to previous fixmate behaviour. (PR https://github.com/samtools/samtools/pull/2056, fixes https://github.com/samtools/samtools/issues/2052. Reported by John Wiedenhoeft)

I'm wondering if this change, or something related is the cause of the fixmate errors that Snippy is throwing. I'll try running with previous version of Samtools and report back.

UPDATE: I can confirm that re-running snippy with samtools v1.20 fixes the issue listed above. If installing samtools and snippy through conda the easiest is to pin the samtools version.

pdimens commented 4 weeks ago

I can confirm this behavior with v1.21 as well. Whatever ms tag markdup requires is no longer being created, even when using the -m argument to add a mate score tag.

indexofire commented 2 weeks ago

first of all, I recommend you install 1.17 version of samtools and bcftools. And I got the similar problem in my new installation. Check the result if you run:

bcftools view --include 'FMT/GT="1/1" && QUAL>=100 && FMT/DP>=10 && (FMT/AO)/(FMT/DP)>=0' snps.raw.vcf  | vt normalize -r reference/ref.fa -

which return error, then make sure your vt version is 2015.11.10=h5ef6573_4. if not,

mamba install vt=2015.11.10=he941832_3
pmenzel commented 2 weeks ago

as a workaround, the bioconda recipe for snippy is now updated to restrict samtools to version 1.20. (https://github.com/bioconda/bioconda-recipes/pull/51628)