Install vcf2bed plugin for bcftools
1
0
Entering edit mode
6.1 years ago

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

vcf2bed bcftools installation • 4.7k views
ADD COMMENT
1
Entering edit mode

Better going throught this to install

If you want to convert vcf to bed format you can also use :

sed -e 's/chr//' file.vcf | awk '{OFS="\t"; if (!/^#/){print $1,$2-1,$2,$4"/"$5,"+"}}'

From here

ADD REPLY
0
Entering edit mode

This looks simple and effective. I got this from the human genome vcf:

1   1014041 1014042 G/A +
1   1014121 1014122 C/T +
1   1014142 1014143 C/T +
1   1014178 1014179 C/T +
1   1014216 1014217 C/T +
1   1014227 1014228 G/A +
1   1014315 1014316 C/CG    +

If it looks good, I think this sorts it out. I'll look also into Bedops. Thanks!

ADD REPLY
0
Entering edit mode
6.1 years ago

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:

  1. Download bcftools source from http://htslib.org/download/ and unpack it in some temporary directory.
  2. Copy vcf2bed.c into the newly-unpacked plugins/ directory
  3. Run make (or make plugins/vcf2bed.so to build just the new plugin)
  4. 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
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1553 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6