Announcement

Collapse
No announcement yet.

Problems installing bcftools and fixref plugin for using Sanger Imputation Service

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #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


    • #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


      • #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


        • #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


          • #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


            • #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


              • #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


                • #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


                  • #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


                    • #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


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

                        Comment


                        • #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


                          • #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

                            Working...
                            X