so do I need to re-install/re-compile the whole BCFtools -- which I installed directly with apt install -- just to add vcf2bed? The instructions say: put it to the plugins directory and the only directory I have for bcftools/plugins is /usr/local/bcftools/plugins
Dear all,
how can I install the plugin vcf2bed in ubuntu?
BCFtools was installed with sudo apt-get install bedtools and I followed the instructions here thus I copied the file vcf2bed.c into /usr/local/bcftools/plugins and run sudo make but the error was make: *** No targets specified and no makefile found. Stop. and this make sense because vcf2bed.c is a C file not a make file. Thus I tried with gcc but I got: `
$ sudo gcc vcf2bed.c -o vcf2bed.so
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/cc5WNHDB.o: In function `process':
vcf2bed.c:(.text+0x82): undefined reference to `bcf_unpack'
collect2: error: ld returned 1 exit status
What is the correct way of installing this plugin?
Thank you
1 answer
What the instructions say is put it [in] the plugins directory of the bcftools source tree. You've put it in (what appears to be intended to be) the plugin installation directory instead. (Or possibly the problem is that you ran make within the plugins/ subdirectory of a source tree, instead of its main directory.)
So what you need is a bcftools source tree, and to build vcf2bed.so therein:
- Download bcftools source from http://htslib.org/download/ and unpack it in some temporary directory.
- Copy vcf2bed.c into the newly-unpacked plugins/ directory
- Run
make(ormake plugins/vcf2bed.soto build just the new plugin) - Copy the resulting vcf2bed.so to /usr/lib/x86_64-linux-gnu/bcftools/ alongside the other already-built plugins.
cd /tmp
tar xf ~/Downloads/bcftools-1.9.tar.bz2
cd bcftools-1.9
cp ~/Downloads/vcf2bed.c plugins/
make plugins/vcf2bed.so
cp plugins/vcf2bed.so /usr/lib/x86_64-linux-gnu/bcftools
Depending on where your bcftools package came from (check with dpkg -L bcftools), I think you will find that the existing plugins are in /usr/lib/x86_64-linux-gnu/bcftools/ rather than /usr/local/bcftools/plugins/.
You need to compile the new plugin in the context of the BCFtools source code, and install just the resulting plugin (no need to re-install all of BCFtools). You have the choice of re-compiling the whole BCFtools (with make) or just the new plugin (with make plugins/vcf2bed.so).
The instructions say put it to the plugins directory OF THE BCFTOOLS SOURCE TREE. If you don't already have a BCFtools source tree, you'll need to download and unpack or git clone one.
Log in to answer this question.
Better going throught this to install
If you want to convert vcf to bed format you can also use :
From here
This looks simple and effective. I got this from the human genome vcf:
If it looks good, I think this sorts it out. I'll look also into Bedops. Thanks!