Answers.Body: <p>That isn't a valid ALT field according to the <a href="https://samtools.github.io/hts-specs/VCFv4.3.pdf" rel="nofollow noreferrer">VCF standard</a>:</p>
  <blockquote>
  <p>ALT — alternate base(s): Comma-separated list of alternate non-reference alleles. These alleles do not have
  to be called in any of the samples. Options are base Strings made up of the bases A,C,G,T,N (case insensitive)
  or the ‘*’ symbol (allele missing due to overlapping deletion) or a MISSING value ‘.’ (no variant) or an
  angle-bracketed ID String (“”) or a breakend replacement string as described in Section 5.4. If there
  are no alternative alleles, then the MISSING value must be used. In other words, the ALT field must be a
  symbolic allele, or a breakend replacement string, or match the regular expression ^([ACGTNacgtn]+|*|.)$.
  Tools processing VCF files are not required to preserve case in the allele String, except for IDs, which are case
  sensitive. (String; no whitespace, commas, or angle-brackets are permitted in the ID String itself)</p>
  </blockquote>
  <p>So yes, you can have things other than ACTG, <code>N</code> most commonly or <code>.</code> or <code>*</code>. And you can also have things like <code>&lt;DEL&gt;</code> and <code>&lt;DUP&gt;</code> for structural variants. But a <code>+</code> or a digit make no sense and are not allowed so this is not a valid VCF file.</p>
  <p>So, filter them out. You can use something like this:</p>
  <pre><code>zcat input.vcf.gz | awk -F'\t' '/^#/ || $5 ~ /^[ACGTNacgtn]+|\*|\.)$/' |
      bgzip &gt; fixed.vcf.gz
  </code></pre>
  <p>I would also report this as a bug to the developers of your variant caller.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-02T14:40:31.467Z
Answers.Text: Thank you for your comment. I will remove them for now, but is there a safe way to reformat those variants as insertions or deletions in the correct format?
Answers.UserDisplayName: Macintosh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-02T14:46:13.630Z
Answers.Text: @Macintosh I have absolutely no clue what those things are supposed to be. If I were you, I would use a proper variant caller that knows how to produce valid VCF files. What did you use?
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-02T14:49:14.837Z
Answers.Text: SCCaller 2.0.0.
Answers.UserDisplayName: Macintosh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-02T15:01:06.430Z
Answers.Text: @Macintosh well that looks like an abandoned project that was last touched 4 years ago (https://github.com/biosinodx/SCcaller). If you absolutely must use that, you need to go through the tool's documentation, understand what kind of variant represenation format they are using and then you could post a new question askiung how to convert those. I mean, I _think_ that `C   +2TG` should be `C  TGTG` but it might also need to be `C CTGTG` depending on how they work. And `G   -8TGTGTATC` should be... too long to write here, but 8 x `TGTGTATC` in the REF field and `G` in the ALT.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-02T23:17:15.290Z
Answers.Text: @terdon, in the examples given in this question, the number in the `ALT` is the length of the string of bases quoted, not the multiplicity, i.e. `-8TGTGTATC` represents the 8 bases `TGTGTATC` being deleted, and `+2TG` would be the 2 bases `TG` being added.
  
  It's still not standard VCF, but this might give a clue as to how to fix the `REF/ALT` to convert it to the correct format.
Answers.UserDisplayName: user36196
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-02T23:29:40.963Z
Answers.Text: Huh, thanks @user36196, that's completely new to me. Is this a known format then? Is it mentioned in the tool's docs? Is there some benefit in this? If I want to know the length of a string, I can measure it, it seems odd to include it.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-02T14:22:12.917Z
Answers.LastActivityDate: 2023-03-02T14:22:12.917Z
Answers.UserDisplayName: terdon
Answers.Body: <p>For future reference, you can use <code>bcftools norm</code> with the option <code>--check-ref x</code> to exclude such sites.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-21T06:13:23.653Z
Answers.LastActivityDate: 2024-06-21T06:13:23.653Z
Answers.UserDisplayName: schmat_90
Answers.Body: <p>I would personally use plink2 for this. Nice and simple and unerstandable by all.</p>
  <pre><code>plink2 --vcf in.vcf --snps-only just-acgt --export vcf --out out.vcf
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-03T20:29:22.357Z
Answers.LastActivityDate: 2023-03-03T20:30:05.513Z
Answers.LastEditDate: 2023-03-03T20:30:05.513Z
Answers.UserDisplayName: user438383
Body: <p>I was trying to left normalize my vcf file using following command:</p>
  <p><code>bcftools norm -f reference.fasta -m -any input.vcf &gt; output.norm.vcf</code></p>
  <p>However this gives the following error:</p>
  <p><code>Non-ACGTN alternate allele at 1:278165 .. VCF:'-3AGG'</code></p>
  <p>It looks like the variant caller returned all deletions and insertions like this:</p>
  <pre><code>1   5387285 .   C   +2TG
  1   5387316 .   G   -8TGTGTATC
  </code></pre>
  <p>This file format was produced by SCCaller 2.0.0, there are several unconventional output fields produced by this caller but but the repository isn't maintained.</p>
  <p>Is this an issue of the vcf format or does this means that there is a non-ACGTN character on position 1:278165 in the fasta reference file? I don't see anyting out of the ordinary at this position using IGV.</p>
  <p>What would be the best way forward?
  I tried the following command to extract non-ACGTN allels but it outputs all alleles:</p>
  <p><code>bcftools view -i 'ALT !~ &quot;^[ACGTN]+$&quot;' input.vcf.gz &gt; errors.vcf</code></p>
  <p>EDIT: including several lines of vcf file</p>
  <pre><code>CHROM   POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  SAMPLE1
  1   89946   .   A   T   68  .   NS=1    GT:SO:AD:BI:GQ:PL   0/1:False:3,18:0.973:68:273,164,49,117
  1   286158  .   A   +2TG    78  .   NS=1    GT:SO:AD:BI:GQ:PL   0/0:NA:11,10:0.982:78:154,97,175,456
  1   900119  .   A   G   150 .   NS=1    GT:SO:AD:BI:GQ:PL   0/0:False:17,14:0.995:150:214,136,321,657
  1   932613  .   G   -4TTTC  62  .   NS=1    GT:SO:AD:BI:GQ:PL   0/1:NA:4,18:0.998:62:274,165,103,173
  1   1168310 .   T   +2CA    35  .   NS=1    GT:SO:AD:BI:GQ:PL   0/0:NA:18,5:0.985:35:77,55,91,712```
  
  
  </code></pre>
  
Tags: <vcf><variant-calling><bcftools>
Title: Non-ACGTN alternate alleles in VCF
ThreadText: # Non-ACGTN alternate alleles in VCF
  
  (Asked by: username_0 on 2023-03-02)
  
  I was trying to left normalize my vcf file using following command:
  
  `bcftools norm -f reference.fasta -m -any input.vcf > output.norm.vcf`
  
  However this gives the following error:
  
  `Non-ACGTN alternate allele at 1:278165 .. VCF:'-3AGG'`
  
  It looks like the variant caller returned all deletions and insertions like this:
  
  ```
  1   5387285 .   C   +2TG
  1   5387316 .   G   -8TGTGTATC
  
  ```
  
  This file format was produced by SCCaller 2.0.0, there are several unconventional output fields produced by this caller but but the repository isn't maintained.
  
  Is this an issue of the vcf format or does this means that there is a non-ACGTN character on position 1:278165 in the fasta reference file? I don't see anyting out of the ordinary at this position using IGV.
  
  What would be the best way forward?
  I tried the following command to extract non-ACGTN allels but it outputs all alleles:
  
  `bcftools view -i 'ALT !~ "^[ACGTN]+$"' input.vcf.gz > errors.vcf`
  
  EDIT: including several lines of vcf file
  
  ```
  CHROM   POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  SAMPLE1
  1   89946   .   A   T   68  .   NS=1    GT:SO:AD:BI:GQ:PL   0/1:False:3,18:0.973:68:273,164,49,117
  1   286158  .   A   +2TG    78  .   NS=1    GT:SO:AD:BI:GQ:PL   0/0:NA:11,10:0.982:78:154,97,175,456
  1   900119  .   A   G   150 .   NS=1    GT:SO:AD:BI:GQ:PL   0/0:False:17,14:0.995:150:214,136,321,657
  1   932613  .   G   -4TTTC  62  .   NS=1    GT:SO:AD:BI:GQ:PL   0/1:NA:4,18:0.998:62:274,165,103,173
  1   1168310 .   T   +2CA    35  .   NS=1    GT:SO:AD:BI:GQ:PL   0/0:NA:18,5:0.985:35:77,55,91,712```
  
  ```
  
  **Tags:** vcf, variant-calling, bcftools
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2023-03-02. Score: 1 | Accepted answer
  
  That isn't a valid ALT field according to the [VCF standard](https://samtools.github.io/hts-specs/VCFv4.3.pdf):
  
  > ALT — alternate base(s): Comma-separated list of alternate non-reference alleles. These alleles do not have
  > to be called in any of the samples. Options are base Strings made up of the bases A,C,G,T,N (case insensitive)
  > or the ‘\*’ symbol (allele missing due to overlapping deletion) or a MISSING value ‘.’ (no variant) or an
  > angle-bracketed ID String (“”) or a breakend replacement string as described in Section 5.4. If there
  > are no alternative alleles, then the MISSING value must be used. In other words, the ALT field must be a
  > symbolic allele, or a breakend replacement string, or match the regular expression ^([ACGTNacgtn]+|\*|.)$.
  > Tools processing VCF files are not required to preserve case in the allele String, except for IDs, which are case
  > sensitive. (String; no whitespace, commas, or angle-brackets are permitted in the ID String itself)
  
  So yes, you can have things other than ACTG, `N` most commonly or `.` or `*`. And you can also have things like `<DEL>` and `<DUP>` for structural variants. But a `+` or a digit make no sense and are not allowed so this is not a valid VCF file.
  
  So, filter them out. You can use something like this:
  
  ```
  zcat input.vcf.gz | awk -F'\t' '/^#/ || $5 ~ /^[ACGTNacgtn]+|\*|\.)$/' |
      bgzip > fixed.vcf.gz
  
  ```
  
  I would also report this as a bug to the developers of your variant caller.
  
  > **Comments:**
  > **username_0**: Thank you for your comment. I will remove them for now, but is there a safe way to reformat those variants as insertions or deletions in the correct format?  
  > **username_1**: @username_0 I have absolutely no clue what those things are supposed to be. If I were you, I would use a proper variant caller that knows how to produce valid VCF files. What did you use?  
  > **username_0**: SCCaller 2.0.0.  
  > **username_1**: @username_0 well that looks like an abandoned project that was last touched 4 years ago (https://github.com/biosinodx/SCcaller). If you absolutely must use that, you need to go through the tool's documentation, understand what kind of variant represenation format they are using and then you could post a new question askiung how to convert those. I mean, I _think_ that `C   +2TG` should be `C  TGTG` but it might also need to be `C CTGTG` depending on how they work. And `G   -8TGTGTATC` should be... too long to write here, but 8 x `TGTGTATC` in the REF field and `G` in the ALT.  
  > **username_2**: @username_1, in the examples given in this question, the number in the `ALT` is the length of the string of bases quoted, not the multiplicity, i.e. `-8TGTGTATC` represents the 8 bases `TGTGTATC` being deleted, and `+2TG` would be the 2 bases `TG` being added.  It's still not standard VCF, but this might give a clue as to how to fix the `REF/ALT` to convert it to the correct format.  
  > **username_1**: Huh, thanks @username_2, that's completely new to me. Is this a known format then? Is it mentioned in the tool's docs? Is there some benefit in this? If I want to know the length of a string, I can measure it, it seems odd to include it.  
  
  ---
  
  ### Answer by username_3 on 2024-06-21. Score: 0
  
  For future reference, you can use `bcftools norm` with the option `--check-ref x` to exclude such sites.
  
  
  ---
  
  ### Answer by username_4 on 2023-03-03. Score: 0
  
  I would personally use plink2 for this. Nice and simple and unerstandable by all.
  
  ```
  plink2 --vcf in.vcf --snps-only just-acgt --export vcf --out out.vcf
  
  ```
  
  
  ---
  
  