Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Merge individual vcf files

    Dear SEQanswers,

    I cannot get the Perl scripts in VCFtools called "vcf-merge" to work and would like to ask for your help.

    This is my problem:
    I have 5 VCF files I would like to merge, and I have converted each one to VCFv4.0 using the perl script in VCFtools/perl called "vcf-convert".
    Then I used bgzip and tabix -p vcf as it is explained in the website.
    I also changed the PATH to where the perl scripts are, like this:
    "export PERL5LIB='/ugi/home/claudiagiambartolomei/shared/vcftools_0.1.5"

    Finally, when I type "perl vcf-merge file1.vcf.gz.tbi file2.vcf.gz.tbi file3.vcf.gz.tbi file4.vcf.gz.tbi file5.vcf.gz.tbi | gzip -c > out_merged.vcf.gz "

    First a lot of odd-looking signs and question marks come up, and then an error comes up which says:

    ], assuming VCFv4.0
    Broken VCF header, no column names?
    at /vcftools_0.1.5/perl//Vcf.pm line 169
    Vcf::throw('Vcf4_0=HASH(0x25672d8)', 'Broken VCF header, no column names?') called at /vcftools_0.1.5/perl//Vcf.pm line 808
    VcfReader::_read_column_names('Vcf4_0=HASH(0x25672d8)') called at /vcftools_0.1.5/perl//Vcf.pm line 583
    VcfReader:arse_header('Vcf4_0=HASH(0x25672d8)') called at /vcftools_0.1.5/perl/vcf-merge line 128
    main::init_cols('HASH(0x28a5b20)', 'Vcf4_0=HASH(0x2566b40)') called at /vcftools_0.1.5/perl/vcf-merge line 221
    main::merge_vcf_files('HASH(0x28a5b20)') called at /vcftools_0.1.5/perl/vcf-merge line 12

    Can you please help me figure out what I am doing wrong?

    Thank you very much for any advice you could give me,
    -f

  • #2
    It looks like you're trying to merge the tabix index files rather than the VCF files. Try something like:

    perl vcf-merge file1.vcf.gz file2.vcf.gz file3.vcf.gz file4.vcf.gz file5.vcf.gz > out_merged.vcf

    Cheers,
    Ian

    Comment


    • #3
      I can't help with vcftools, but bedtools supports vcf files if you want to give that a shot.

      Comment


      • #4
        Thank you very much to both for your replies!
        iansealy, it worked: I just needed to do run the command using the files not indexed using tabix! Although I am not sure why since it states clearly in the perl script "Merge the bgzipped and tabix indexed VCF files. (E.g. bgzip file.vcf; tabix -p vcf file.vcf.gz)\n"
        ...Anyway using only the .gz works!!

        pbluescript, I didn't know about bedtools and since I'll do much of this in the future I am sure I'll need that too so thanks for mentioning it.

        Cheers,
        -f

        Comment


        • #5
          When you index a file using tabix (or what ever tool) it creates an index which is used together withthe file itself. The .tbi files are not the indexed vcf file but extra index files (every .vcf file needs an additional .vcf.tbi file). You need to create the indexes but you need to specify the vcf (in this case gzipped vcf.gz) files. The program recognises the index files by just adding the .tbi to the file name you specified.
          That's like a general rule for the tools which need indexed files. You create the index file but you specify the normal file and the program searches for the index files itself...

          I hope this clarifies it.

          Comment


          • #6
            Dear ulz peter,

            Thank you for explaining this, it finally makes sense now!

            cheers,
            -f

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Strategies for Sequencing Challenging Samples
              by seqadmin


              Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
              03-22-2024, 06:39 AM
            • seqadmin
              Techniques and Challenges in Conservation Genomics
              by seqadmin



              The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

              Avian Conservation
              Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
              03-08-2024, 10:41 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, Yesterday, 06:37 PM
            0 responses
            8 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, Yesterday, 06:07 PM
            0 responses
            8 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 03-22-2024, 10:03 AM
            0 responses
            49 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 03-21-2024, 07:32 AM
            0 responses
            66 views
            0 likes
            Last Post seqadmin  
            Working...
            X