This is a test version of Biostars. For the public version, visit https://www.biostars.org.
VCF to BED conversion error in BEDOPS

I have been using the latest version of convert2bed (from bedops) to convert VCF format to BED. But have been getting this error:

convert2bed -i vcf </files/stuff.vcf> /files/stuff.bed

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

When I simply use cat -A:

cat -A /files/stuff.vcf | convert2bed -i vcf /files/stuff.bed

Segmentation fault

Any help would be greatly appreciated!

bedops bed vcf

2 answers

So, probably this and incomplete .bed output are because of the sorting step which might cause the /tempdir to be filled up. A workaround for this, this to use this in addition to my above commands: --do-not-sort. For now, it's working!

If /tmp is filling up, use --sort-tmpdir=<dir> with convert2bed to specify an alternate directory to store intermediate sort data.

You could use --do-not-sort, I suppose, but really you want a sorted BED file so that you can use it for set operations. If you use --do-not-sort, you would follow up with sort-bed --tmpdir <dir> on the resulting unsorted BED, to put it into sorted order.

The purpose of cat -A is to debug your VCF file, to make sure it doesn't have Microsoft-specific line endings. If it does, then you would use dos2unix or tr or similar to clean the input. You would not pipe the output of cat -A to convert2bed, as it seems you may be doing from your question.

Log in to answer this question.