Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LeonDK
    Member
    • Sep 2014
    • 69

    #1

    VCF to BCF conversion error: [E::bcf_hdr_add_sample] Duplicated sample name

    In converting a .vcf file to a .bcf file a get the following error message:
    Code:
    [E::bcf_hdr_add_sample] Duplicated sample name
    I am running conversion using bcftools like so:
    Code:
    bcftools convert -O u -o /path/to/input/file.bcf  /path/to/output/file.vcf.gz
    How do I fix this?
  • jmarshall
    Samtools maintainer
    • Jul 2009
    • 39

    #2
    Sample names are parsed from the #CHROM POS ID REF line, and can't appear more than once (at least for bcftools's implementation; not sure if this is clear in the VCF spec).

    The actual "Duplicated sample name" error message also tells you which sample name it's complaining about.

    Comment

    • LeonDK
      Member
      • Sep 2014
      • 69

      #3
      Originally posted by jmarshall View Post
      Sample names are parsed from the #CHROM POS ID REF line, and can't appear more than once (at least for bcftools's implementation; not sure if this is clear in the VCF spec).

      The actual "Duplicated sample name" error message also tells you which sample name it's complaining about.
      Yes, I was looking for a tool, which could identify and remove sample duplicates

      Comment

      • jmarshall
        Samtools maintainer
        • Jul 2009
        • 39

        #4
        That error message identifies duplicate sample names, or to find them all at once:

        Code:
        bcftools view -h file.bcf|grep '^#CHROM'| cut -f10-|tr '\t' '\n'|sort|uniq -c|grep -v '^ *1 '
        Then you could e.g. hack the #CHROM line in a text editor and use bcftools view -s to remove the duplicates you've marked via the text editor. Or use awk or similar.

        Comment

        • LeonDK
          Member
          • Sep 2014
          • 69

          #5
          Originally posted by jmarshall View Post
          That error message identifies duplicate sample names, or to find them all at once:

          Code:
          bcftools view -h file.bcf|grep '^#CHROM'| cut -f10-|tr '\t' '\n'|sort|uniq -c|grep -v '^ *1 '
          Then you could e.g. hack the #CHROM line in a text editor and use bcftools view -s to remove the duplicates you've marked via the text editor. Or use awk or similar.
          I wrote me a small script to search and identify sample name duplicates and exclude, such that only one is kept for each possible duplicate.

          Thanks for input.

          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
            ...
            Today, 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, Today, 05:39 AM
          0 responses
          9 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, Yesterday, 09:56 AM
          0 responses
          11 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-09-2026, 11:14 AM
          0 responses
          25 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 09-29-2026, 09:51 AM
          0 responses
          76 views
          0 reactions
          Last Post SEQadmin2  
          Working...