genePredToBed in.genePred out.bed
This tool is part of UCSC Genome Browser's Utility Tools.
Options
Assuming you want to convert an annotation file in gff3 format to standard bed format, you can first use gff3ToGenePred
to convert it to genePred format, then convert the genePred file to bed format:
# download annotations in gff3 format wget ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/gencode.v32.long_noncoding_RNAs.gff3.gz # convert GFF3 to genePred, making sure to include -geneNameAttr=gene_name # so that gene symbol is used as the name2 instead of ID number, and sorting by chromosome and position: gff3ToGenePred -geneNameAttr=gene_name gencode.v32.long_noncoding_RNAs.gff3.gz stdout | sort -k2,2 -k4n,4n > gencode.v32.lncRNAs.genePred genePredToBed gencode.v32.lncRNAs.genePred gencode.v32.lncRNAs.bed