<p>How do I convert SAM to VCF file.</p>
<p>I tried to convert the SAM file generated using NCBI BLAST to VCF format when I get this error. I do not get any error while using BWA MEM based aligner in SAM format.</p>
<p>Here is the error I get using BCFTOOLS.</p>
<pre><code>bcftools mpileup -Ou --no-reference output.Sorted.bam -o output.Sorted.bcf -d 1
[mpileup] 1 samples in 1 input files
[mpileup] maximum number of reads per input file set to -d 1
Note: The maximum per-sample depth with -d 1 is 1.0x
bcftools: bam2bcf.c:421: bcf_call_glfgen: Assertion `epos&gt;=0 &amp;&amp; epos&lt;bca-&gt;npos' failed.
Aborted (core dumped)
</code></pre>

CC BY-SA 4.0
2024-12-25T07:46:15.217Z
Please add more context to your question to help us understand what it is that you're trying to do; any additional information you can give about your general study, or what you want to do with the converted file is helpful. In particular, the error suggests there is an issue with the input, so please show the first few lines of your SAM file, including the header information and a few aligned reads.
gringer
CC BY-SA 4.0
2024-12-26T07:57:39.910Z
I tried to convert the SAM file generated using NCBI BLAST to VCF format when I get this error. I do not get any error while using BWA MEM based aligner in SAM format.
ABHISHEK SINGH
CC BY-SA 4.0
2024-12-27T08:21:40.830Z
Okay, but you haven't provided any more context, you've just explained what you tried to do as an intermediate step (which can be mostly worked out from the command line you already included with the error).
gringer
CC BY-SA 4.0
2024-12-31T11:54:24.990Z
Can you explain what you mean by "convert SAM to VCF"? What exactly are you expecting in the VCF file? Are you trying to do variant calling here? If so, why are you limiting yourself to only one read per position? Why are you using `-d 1`?
terdon
<genome><sequence-analysis><linux><dna><alignment>
How to convert SAM file to VCF file. The BCFTools is giving me errors
# How to convert SAM file to VCF file. The BCFTools is giving me errors

(Asked by: username_0 on 2024-12-24)

How do I convert SAM to VCF file.
I tried to convert the SAM file generated using NCBI BLAST to VCF format when I get this error. I do not get any error while using BWA MEM based aligner in SAM format.
Here is the error I get using BCFTOOLS.
bcftools mpileup -Ou --no-reference output.Sorted.bam -o output.Sorted.bcf -d 1
[mpileup] 1 samples in 1 input files
[mpileup] maximum number of reads per input file set to -d 1
Note: The maximum per-sample depth with -d 1 is 1.0x
bcftools: bam2bcf.c:421: bcf_call_glfgen: Assertion `epos>=0 && eposnpos' failed.
Aborted (core dumped)

**Tags:** genome, sequence-analysis, linux, dna, alignment
> **Comments:**
> **username_1**: Please add more context to your question to help us understand what it is that you're trying to do; any additional information you can give about your general study, or what you want to do with the converted file is helpful. In particular, the error suggests there is an issue with the input, so please show the first few lines of your SAM file, including the header information and a few aligned reads.  
> **username_0**: I tried to convert the SAM file generated using NCBI BLAST to VCF format when I get this error. I do not get any error while using BWA MEM based aligner in SAM format.  
> **username_1**: Okay, but you haven't provided any more context, you've just explained what you tried to do as an intermediate step (which can be mostly worked out from the command line you already included with the error).  
> **username_2**: Can you explain what you mean by "convert SAM to VCF"? What exactly are you expecting in the VCF file? Are you trying to do variant calling here? If so, why are you limiting yourself to only one read per position? Why are you using `-d 1`?  

---

## 0 answers

