Question: Install vcf2bed plugin for bcftools
0
gravatar for marongiu.luigi
12 months ago by
Germany, Mannheim, UMM
marongiu.luigi380 wrote:

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

bcftools vcf2bed installation • 650 views
ADD COMMENTlink modified 12 months ago by John Marshall1.7k • written 12 months ago by marongiu.luigi380
1

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 REPLYlink written 12 months ago by Bastien Hervé4.4k

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 REPLYlink modified 12 months ago • written 12 months ago by marongiu.luigi380
0
gravatar for John Marshall
12 months ago by
John Marshall1.7k
Glasgow, Scotland
John Marshall1.7k wrote:

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 COMMENTlink modified 12 months ago • written 12 months ago by John Marshall1.7k

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 REPLYlink written 12 months ago by marongiu.luigi380

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 REPLYlink written 12 months ago by John Marshall1.7k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1673 users visited in the last hour