Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • balsampoplar
    Member
    • Mar 2014
    • 14

    #1

    Separating indels and snps in vcf

    Task at hand: Remove simple indel loci from vcf file.

    ------ example vcf file excerpt ----------
    CHR POS ID REF ALT
    1 20293 S_20293 A G
    1 22689 S_22689 A -
    1 23251 S_23251 - T
    --------------------------------------------

    $ bcftools filter -e'%TYPE="snp"' in.vcf > indels.vcf
    Results in a VCF file containing only header

    $ bcftools filter -e'%TYPE="indels"' in.vcf > snp.vcf
    Results in a VCF file containing all variants (snps and indels)

    It appears that bcftools is not treating the last two sites above as indels, but as snps. I saw the same behvior with --remove-indels filter in vcftools.

    Does anyone know what's going on?
  • sarvidsson
    Senior Member
    • Jan 2015
    • 137

    #2
    What VCF version should that be (and what software called those)? It is not proper VCF4.1 or 4.2 - dashes are not allowed as bases, so no wonder that the tools you tried couldn't identify those as indels.

    VCF 4.2 spec, check section 1.4.1 for the REF and ALT fields, as well as section 5.2 for examples with properly formatted indels: http://samtools.github.io/hts-specs/VCFv4.2.pdf
    Last edited by sarvidsson; 03-12-2015, 06:58 AM. Reason: Added spec link

    Comment

    • balsampoplar
      Member
      • Mar 2014
      • 14

      #3
      sarvidsson: My VCF files were generated using the Tassel GBS pipeline and the header indicates they conform to 4.0 specification.

      Comment

      • sarvidsson
        Senior Member
        • Jan 2015
        • 137

        #4
        Then their conformity is broken: http://www.1000genomes.org/node/101; the allowed contents of the REF and ALT fields are the same for 4.0 as 4.1.
        Last edited by sarvidsson; 03-12-2015, 07:05 AM.

        Comment

        • balsampoplar
          Member
          • Mar 2014
          • 14

          #5
          That's interesting. According to the 1000genomes 4.0 spec, the '.' in the ALT column indicates monomorphic site. That's clearly not the same as a '-' which is supposed to indicate an indel, right?

          Comment

          • sarvidsson
            Senior Member
            • Jan 2015
            • 137

            #6
            A quick and dirty way to filter these files would be to
            Code:
            grep -v $'\t-\t' in.vcf > no_indels.vcf
            in case there are no other tab-separated fields with dashes. Check that with:
            Code:
            grep $'\t-\t' in.vcf > indels.vcf

            Comment

            • sarvidsson
              Senior Member
              • Jan 2015
              • 137

              #7
              Originally posted by balsampoplar View Post
              That's interesting. According to the 1000genomes 4.0 spec, the '.' in the ALT column indicates monomorphic site. That's clearly not the same as a '-' which is supposed to indicate an indel, right?
              Exactly. I'd check with the TASSEL people that those records are really indels, perhaps they can fix the VCF output for a future version.

              Comment

              • balsampoplar
                Member
                • Mar 2014
                • 14

                #8
                Thanks. One liners are always useful. I have been doing this by first subsetting REF/ALT columns containing dashes in R and then using that list with --positions filter in vcftools to separate out snp and indels in individual vcf files.

                Still I would like to figure out what dash versus periods mean in the REF/ALT fields.

                Edit: Will post a question to the Tassel list.
                Last edited by balsampoplar; 03-12-2015, 07:14 AM. Reason: cross connection

                Comment

                • sarvidsson
                  Senior Member
                  • Jan 2015
                  • 137

                  #9
                  Originally posted by balsampoplar View Post
                  Thanks. One liners are always useful. I have been doing this by first subsetting REF/ALT columns containing dashes in R and then using that list with --positions filter in vcftools to separate out snp and indels in individual vcf files.
                  You don't need to load the whole thing in R for that,

                  Code:
                  cut -f 3,4 in.vcf | grep '\-$' | cut -f 1 > ref_dash_ID-list
                  cut -f 3,5 in.vcf | grep '\-$' | cut -f 1 > alt_dash_ID-list
                  would be much faster

                  Comment

                  • balsampoplar
                    Member
                    • Mar 2014
                    • 14

                    #10
                    I have been only bringing in the first 5 columns in R, but I like your solution as well. Thanks.

                    Comment

                    Latest Articles

                    Collapse

                    • SEQadmin2
                      Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                      by SEQadmin2



                      Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                      Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                      ...
                      10-14-2026, 09:55 AM
                    • SEQadmin2
                      New Genomics Technologies Take Aim at Long-Standing Limits
                      by SEQadmin2


                      Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                      We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                      ...
                      09-28-2026, 10:25 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, 10-15-2026, 10:52 AM
                    0 responses
                    14 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 10-14-2026, 05:39 AM
                    0 responses
                    21 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 10-13-2026, 09:56 AM
                    0 responses
                    19 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 10-09-2026, 11:14 AM
                    0 responses
                    27 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...