Error in converting vcf to bed file using bedops
Entering edit mode
8 months ago
evafinegan • 0


I am using bedops to convert a vcf file to a bed file:

vcf2bed < in.vcf.gz > out.bed

But I get this error:

BED row length exceeds capacity at line 47483 in -.
Check that you have unix newlines (cat -A) or increase TOKENS_MAX_LENGTH in BEDOPS.Constants.hpp and recompile BEDOPS.

Thank you for any help!

bedops vcf bed • 410 views
Entering edit mode
8 months ago

You may need to decompress the gzipped VCF file to text, before conversion.

If you use the bash shell, you can use a process substitution:

$ vcf2bed < <( gunzip -c in.vcf.gz ) > out.bed

Or you can pipe uncompressed data, using the hyphen with vcf2bed to specify standard input:

$ gunzip -c in.vcf.gz | vcf2bed - > out.bed
Entering edit mode

I still get the same error.

Entering edit mode

Another possibility is that your VCF file contains genuinely very long lines, in which case, you'd need to run a version of BEDOPS that supports longer lines.

If this is your case, if you're using the binaries I distribute on our Github site, you should be able to run the following:

$ switch-BEDOPS-binary-type --megarow

This transparently swaps the binaries around so that your host runs a "megarow" build of these tools, which supports longer lines, at the cost of slightly longer runtime for set operations.

If you're using someone else's build (e.g., via Homebrew or a package manager I don't control) then my advice would be to compile the binaries you need.

Instructions for compilation are located at:

As the instructions note, you'd run make megarow or make all to build the set of binaries of the "megarow" variety. Grab some coffee as it may take a few minutes. Install the binaries where you need them, then run the command as described above.


Login before adding your answer.

Traffic: 3371 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6