The file answer.bed will be a properly-sorted BED file containing your bins.
Change 1000 to whatever window size that you want.
Because genomes will not divide evenly by 1000 bases, you can add -x to the bedops --chop 1000 statement if you want to leave out the trailing bin for each chromosome, which will usually be less than 1000 bases long.
BED is generally an unbound format after the third column, with some very specific exceptions, so BED-to-GTF is not straightforward. Usually you can go the other way, however; see gtf2bed for an example.
That said, going from bins in a BED file to GTF doesn't really make sense. GTF is used to represent gene annotation data. A bin is just an (empty) genomic interval that would first need annotation and curation steps to get to something that could be turned into sensible GTF.
Alternatively, maybe tell us what you're really trying to do. Using BEDOPS/Kentutils might be the right answer, but it depends on what you're trying to do.
Basically, my purpose is to make my own gtf file to be able to find the differentially expressed regions in the genome. So that is the reason I want to do the binning and then make a gtf file out of it.
bedtools makewindows
, please read its documentation and then state what is unclear.Could you please provide a link? It seems that there is no detailed manual about the
bedtools makewindows
.Type
bedtools makewindows
into your console and the help will pop up.