Unconfigured Ad

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

    Problems installing bcftools and fixref plugin for using Sanger Imputation Service

    Dear all,

    I am trying to use the Sanger imputation service (https://imputation.sanger.ac.uk/), but I get the following error:
    "Reference allele mismatch at 1:752566 .. REF_SEQ:'G' vs VCF:'A'"

    According to this link https://imputation.sanger.ac.uk/?resources=1, this can be fixed by installing bcftools and using the fixref plugin available here https://github.com/pd3/bcftools/blob...ugins/fixref.c

    However, after installing bcftools, there are no plugins:
    Code:
    bcftools plugin -vl
    plugin directory /usr/local/libexec/bcftools .. ok
    
    No functional bcftools plugins were found. The environment variable BCFTOOLS_PLUGINS is not set.
    I have downloaded fixref.c and placed it in /usr/local/libexec/bcftools but still nok luck. If I try to compile fixref.c I get:
    Code:
    gcc fixref.c 
    fixref.c:84:22: fatal error: bcftools.h: No such file or directory
     #include "bcftools.h"
                          ^
    compilation terminated.
    Despite bcftools being installed:
    Code:
    which bcftools 
    /usr/local/bin/bcftools
    Not really sure what to do here?
  • GenoMax
    Senior Member
    • Feb 2008
    • 7142

    #2
    Did you compile bcftools yourself? If so you should have the bcftools.h header file available in the source code that you downloaded. You can edit the fixref.c file to include full path to the bcftools.h file and see if you can get the plug-in to compile.

    Comment

    • LeonDK
      Member
      • Sep 2014
      • 69

      #3
      Okay, so I got the plugins to install, by going to https://samtools.github.io/bcftools/ and then issuing the following commands:
      Code:
       git clone --branch=develop git://github.com/samtools/htslib.git
      git clone --branch=develop git://github.com/samtools/bcftools.git
      git clone --branch=develop git://github.com/samtools/samtools.git
      cd bcftools; make
      cd ../samtools; make
      Followed by:
      Code:
      cd ../bcftools; sudo make install
      cd ../samtools; sudo make install
      Then I get the plugins:
      Code:
      bcftools plugin -lv | head
      
      -- GTisec --
      Count genotype intersections across all possible sample subsets in a vcf file.
      
      -- color-chrs --
      Color shared chromosomal segments, requires phased GTs.
      
      -- counts --
      A minimal plugin which counts number of samples, SNPs,
      INDELs, MNPs and total number of sites.
      But I still cannot compile the fixref.c plugin:
      Code:
      cd /usr/local/libexec/bcftools/ ; sudo gcc -shared -o fixref.so -fPIC fixref.c
      fixref.c:84:22: fatal error: bcftools.h: No such file or directory
       #include "bcftools.h"
                            ^
      compilation terminated.

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        See where the bcftools source was put locally. bcftools.h should be in the top level directory. Edit the fixref.x source to include path to that file.

        #include "/path_to/bcftools.h"

        Comment

        • LeonDK
          Member
          • Sep 2014
          • 69

          #5
          Originally posted by GenoMax View Post
          See where the bcftools source was put locally. bcftools.h should be in the top level directory. Edit the fixref.x source to include path to that file.

          #include "/path_to/bcftools.h"
          Thank you, that worked with respect to getting fixref.c compiled into fixref.so, like so:
          Code:
          sudo gcc -shared -o fixref.so -fPIC fixref.c
          however, unfortunately I am not quite there yet:
          Code:
          $ bcftools plugin fixref
          Could not initialize fixref, version string not found

          Comment

          • GenoMax
            Senior Member
            • Feb 2008
            • 7142

            #6
            Check the syntax for using the plugin at the link you included above. It appears to go something like this.

            Code:
            bcftools +fixref file.bcf -- -f ref.fa

            Comment

            • LeonDK
              Member
              • Sep 2014
              • 69

              #7
              Originally posted by GenoMax View Post
              Check the syntax for using the plugin at the link you included above. It appears to go something like this.

              Code:
              bcftools +fixref file.bcf -- -f ref.fa
              Thanks a lot for input GenoMax! It's getting late in my part of the world, i will continue working on the issue tomorrow...

              Comment

              • LeonDK
                Member
                • Sep 2014
                • 69

                #8
                Originally posted by GenoMax View Post
                Check the syntax for using the plugin at the link you included above. It appears to go something like this.

                Code:
                bcftools +fixref file.bcf -- -f ref.fa
                It's not flying, despite using the stated syntax, I still get
                Code:
                Could not initialize fixref, version string not found
                I cannot find any elaboration on the fixref plugin on Sanger. I have tried to look in the source code, but I cannot seem to identify the error.

                Thanks for input, I will try to mail the source code author and ask.

                Comment

                • LeonDK
                  Member
                  • Sep 2014
                  • 69

                  #9
                  I have checked out the "Plugins troubleshooting:" at https://samtools.github.io/bcftools/bcftools.html with no luck.

                  So far unfortunately, I am stuck. I have written Sanger and the author and I am currently awaiting an answer. Should I get one, I will return to this thread with it for any future reference...

                  Comment

                  • jmarshall
                    Samtools maintainer
                    • Jul 2009
                    • 39

                    #10
                    Originally posted by LeonDK View Post
                    Thank you, that worked with respect to getting fixref.c compiled into fixref.so, like so:
                    Code:
                    sudo gcc -shared -o fixref.so -fPIC fixref.c
                    That only partially compiled it (to be precise, it did not link it).

                    To compile this plugin properly, you need to reproduce the commands that are used to compile the other plugins. So you should drop fixref.c into your bcftools-x.y.z/plugins source directory, and use a command like:

                    Code:
                    gcc -fPIC -shared -O2 -I. -I../htslib -o plugins/fixref.so version.c plugins/fixref.c
                    to compile it (which you run from the parent bcftools-x.y.z source code directory).

                    Comment

                    • LeonDK
                      Member
                      • Sep 2014
                      • 69

                      #11
                      Originally posted by jmarshall View Post
                      That only partially compiled it (to be precise, it did not link it).

                      To compile this plugin properly, you need to reproduce the commands that are used to compile the other plugins. So you should drop fixref.c into your bcftools-x.y.z/plugins source directory, and use a command like:

                      Code:
                      gcc -fPIC -shared -O2 -I. -I../htslib -o plugins/fixref.so version.c plugins/fixref.c
                      to compile it (which you run from the parent bcftools-x.y.z source code directory).
                      You sir, are my new hero!

                      Code:
                      $ cd ~/tmp/bcftools/
                      $ wget https://raw.githubusercontent.com/pd3/bcftools/develop/plugins/fixref.c
                      $ gcc -fPIC -shared -O2 -I . -I ../htslib/ -o fixref.so version.c fixref.c
                      $ mv fixref.so /usr/local/libexec/bcftools/
                      $ bcftools plugin fixref -h
                      
                      About: This tool helps to determine and fix strand orientation.
                             Currently the following modes are recognised:
                                 flip  .. flips non-ambiguous SNPs and ignores the rest
                                 stats .. converts from Illumina TOP strand to fwd
                                 top   .. converts from Illumina TOP strand to fwd
                      Might I suggest that a little more information on how to properly install the fixref-plugin is added? Alternatively it could come bundled with bcftools, now that it is explicitly suggested as part of the Sanger Imputation Service?

                      Thanks again!

                      Comment

                      • jmarshall
                        Samtools maintainer
                        • Jul 2009
                        • 39

                        #12
                        I expect that it will indeed be bundled within the next bcftools release.

                        Comment

                        • Petr
                          Junior Member
                          • Oct 2011
                          • 6

                          #13
                          Glad that it worked for you in the end.

                          Just a note, you don't need to invoke gcc directly, here is a slightly simpler version:

                          Code:
                          $ cd ~/tmp/bcftools
                          $ wget -O plugins/fixref.c https://raw.githubusercontent.com/pd3/bcftools/develop/plugins/fixref.c
                          $ make
                          $ mv plugins/fixref.so /usr/local/libexec/bcftools/
                          $ bcftools +fixref -h

                          Comment

                          • Petr
                            Junior Member
                            • Oct 2011
                            • 6

                            #14
                            I see that people are repeatedly struggling with the installation. Because of the rapid development of bcftools and htslib, best is to get the latest development version of both using the instructions described at this page http://samtools.github.io/bcftools.

                            In short:
                            Code:
                                git clone git://github.com/samtools/htslib.git
                                git clone git://github.com/samtools/bcftools.git
                                cd bcftools; make
                            The clone command above is used to create a local copy of the remote repository and needs to be run only once. Whenever the latest snapshot from github is needed, use instead the pull command:

                            Code:
                                cd htslib; git pull
                                cd ../bcftools; git pull
                                make clean
                                make
                            IMPORTANT: In order to use the BCFtools plugins, this environment variable must be set to point to the correct location:

                            Code:
                                export BCFTOOLS_PLUGINS=/path/to/bcftools/plugins
                            Verify by running

                            Code:
                                /path/to/bcftools/bcftools plugin -l
                                /path/to/bcftools/bcftools +fixref -h
                            The first command should print the list of available plugins (all *.so files in the plugins directory) and the second should print the usage help text for fixref.

                            Comment

                            Latest Articles

                            Collapse

                            • 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
                            • SEQadmin2
                              Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                              by SEQadmin2


                              I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

                              Here are nine questions we think about, in roughly the order they matter, before...
                              06-18-2026, 07:11 AM

                            ad_right_rmr

                            Collapse

                            News

                            Collapse

                            Topics Statistics Last Post
                            Started by SEQadmin2, 07-02-2026, 11:08 AM
                            0 responses
                            16 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 06-30-2026, 05:37 AM
                            0 responses
                            17 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 06-26-2026, 11:10 AM
                            0 responses
                            20 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 06-17-2026, 06:09 AM
                            0 responses
                            54 views
                            0 reactions
                            Last Post SEQadmin2  
                            Working...