Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • d_chall
    Junior Member
    • Jan 2010
    • 3

    Separate multi-allelic VCF lines to multiple rows

    The latest VCF formats (4.1+) allow for a single loci to cover multiple rows in the file when there are multiple alleles. The old standard of specifying multiple alleles in the same line is also valid. Unfortunately some analysis requires one standard and some the other. Are there any tools/scripts available which can take a VCF file with multiple alleles on one line and split them out to separate lines including the genotypes in the sample columns?
    Thanks!
  • mebbert
    Junior Member
    • Jul 2012
    • 7

    #2
    Did you find a tool for this? I'm looking too.

    Comment

    • d_chall
      Junior Member
      • Jan 2010
      • 3

      #3
      No I didn't, I ended having to write my own custom ruby script to do it.

      Comment

      • ekg
        Member
        • Apr 2010
        • 36

        #4
        I wrote something in C++ (https://github.com/ekg/vcflib/blob/m...eakmulti.cpp):

        % vcfbreakmulti --help
        usage: vcfbreakmulti [options] [file]

        If multiple alleles are specified in a single record, break the record into
        multiple lines, preserving allele-specific INFO fields.

        Comment

        • Elmaffo
          Junior Member
          • Nov 2011
          • 3

          #5
          @ekg

          I tried to compile vcflibs but I got some errors. Below the output of the make command, sorry it is in Italian but I can repeat with english language if needed.

          bw
          Andrea

          ---------------------------

          elmaffo@arc-HP8200i7 ~/Scaricati/vcflib $ make
          cd tabixpp && make
          make[1]: ingresso nella directory "/home/elmaffo/Scaricati/vcflib/tabixpp"
          make[2]: ingresso nella directory "/home/elmaffo/Scaricati/vcflib/tabixpp"
          gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE bgzf.c -o bgzf.o
          bgzf.c: In function ‘bgzf_close’:
          bgzf.c:630:8: warning: variable ‘count’ set but not used [-Wunused-but-set-variable]
          gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE kstring.c -o kstring.o
          gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE knetfile.c -o knetfile.o
          knetfile.c: In function ‘khttp_connect_file’:
          knetfile.c:418:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
          knetfile.c: In function ‘kftp_send_cmd’:
          knetfile.c:239:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
          gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE index.c -o index.o
          gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE bedidx.c -o bedidx.o
          ar -cru libtabix.a bgzf.o kstring.o knetfile.o index.o bedidx.o
          ranlib libtabix.a
          gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE main.c -o main.o
          gcc -g -Wall -O2 -fPIC -o tabix main.o -lm -lz -L. -ltabix
          ./libtabix.a(bgzf.o): nella funzione "deflate_block":
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:311: riferimento non definito a "deflate"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:313: riferimento non definito a "deflateEnd"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:305: riferimento non definito a "deflateInit2_"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:329: riferimento non definito a "deflateEnd"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:345: riferimento non definito a "crc32"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:346: riferimento non definito a "crc32"
          ./libtabix.a(bgzf.o): nella funzione "inflate_block":
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:380: riferimento non definito a "inflateInit2_"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:385: riferimento non definito a "inflate"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:391: riferimento non definito a "inflateEnd"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bgzf.c:387: riferimento non definito a "inflateEnd"
          ./libtabix.a(bedidx.o): nella funzione "ks_getuntil":
          /home/elmaffo/Scaricati/vcflib/tabixpp/bedidx.c:11: riferimento non definito a "gzread"
          ./libtabix.a(bedidx.o): nella funzione "bed_read":
          /home/elmaffo/Scaricati/vcflib/tabixpp/bedidx.c:103: riferimento non definito a "gzdopen"
          ./libtabix.a(bedidx.o): nella funzione "ks_getc":
          /home/elmaffo/Scaricati/vcflib/tabixpp/bedidx.c:11: riferimento non definito a "gzread"
          ./libtabix.a(bedidx.o): nella funzione "bed_read":
          /home/elmaffo/Scaricati/vcflib/tabixpp/bedidx.c:138: riferimento non definito a "gzclose"
          /home/elmaffo/Scaricati/vcflib/tabixpp/bedidx.c:103: riferimento non definito a "gzopen64"
          collect2: error: ld returned 1 exit status
          make[2]: *** [tabix] Errore 1
          make[2]: uscita dalla directory "/home/elmaffo/Scaricati/vcflib/tabixpp"
          make[1]: *** [all-recur] Errore 1
          make[1]: uscita dalla directory "/home/elmaffo/Scaricati/vcflib/tabixpp"
          make: *** [tabixpp/tabix.o] Errore 2

          Comment

          • ekg
            Member
            • Apr 2010
            • 36

            #6
            @Andrea

            Non ti preoccupare, parlo italiano.

            Mi sembra che si manca zlib: http://stackoverflow.com/questions/1...late-with-zlib

            Zlib e' installato nella tua sistema?

            Comment

            • Elmaffo
              Junior Member
              • Nov 2011
              • 3

              #7
              @ekg

              here is the list of Zlib-related packages on my Ubuntu 12.10 box:

              Installed: zlib1g, zlib1g-dev, zlib1g:i386
              not installed: zlib-bin, zlib-gst, zlib1g-dbg, zlibc,

              do I need anyone of the "not installed"?

              thanks
              Andrea

              Comment

              • Elmaffo
                Junior Member
                • Nov 2011
                • 3

                #8
                @ekg

                Found out the issue was related to tabixcpp, as specified by guillermo-carrasco in this thread (check out the last messages in the thread):



                I edited the Makefile in the tabixpp folder as suggested in the thread. Everything compiled.

                Bye

                Comment

                • d_chall
                  Junior Member
                  • Jan 2010
                  • 3

                  #9
                  Here you go

                  For anyone who is interested, I ended up writing a couple of scripts for splitting and merging multi-allelic lines.
                  They are available in the "utils" directory of the Atlas2 trunk.
                  http://sourceforge.net/projects/atlas2/

                  Comment

                  • mamons
                    Member
                    • Nov 2011
                    • 10

                    #10
                    Here is another small tool to do the same thing, written in python:

                    Simple vcf parser, based on PyVCF. Contribute to moonso/vcf_parser development by creating an account on GitHub.

                    Comment

                    Latest Articles

                    Collapse

                    • SEQadmin2
                      Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                      by SEQadmin2



                      Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                      ...
                      Today, 11:10 AM
                    • SEQadmin2
                      Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                      by SEQadmin2



                      Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                      There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                      Yesterday, 05:17 AM
                    • GATTACAT
                      Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                      by GATTACAT
                      Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
                      07-01-2026, 11:43 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, Today, 10:04 AM
                    0 responses
                    8 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, Yesterday, 10:08 AM
                    0 responses
                    6 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-07-2026, 11:05 AM
                    0 responses
                    9 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-02-2026, 11:08 AM
                    0 responses
                    31 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...