Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
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

                            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
                            67 views
                            0 likes
                            Last Post seqadmin  
                            Working...
                            X