I have bam file that I must convert to bed file to filter specific reads. Now I need to convert output bed to bam file. I am using bedToBam. As an output I have bam file but when I visualize it I see that sequences are in headers.
When I export it to txt. file I get:
TAATCACCAGCCTGACTGGCCGGGACAAAAACCAAGTGGAGGGCGAGATTCAGATCGTGTCAACTGCTGCCCAGACCTTCCTGGCAACGTGCATCAACGGGGTATGCTGGACTGTCTACCACGGGGCCGGAACGAGGACCATTGCGTCACCCAAGGGTCCTGTCATCCAGATGTATACCAACGTGGACCAAGACCTCGTGGGCTGGCCCGCTCCGCAGGGTTCCCGTTC pos=3329 len=229 ??????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? TTGACGCCCTGCACCTGCGGTTCCTCGGACCTCTACCTGGTCACGAGGCACGCCGATGTCATCCCCGTGCGCCGGCGGGGTGATAGCAGGGGCAGCCTGCTTTCGCCCCGGCCCATTTCCTACTTGAAAGGCTCCTCGGGGGGTCCGCTGTTGTGCCCCGCGGGACACGCCGTGGGCATATTCAGGGCCGCGGTGTGCACC pos=3559 len=201 ??????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????
Is there any way to make this bed to bam conversion and get file with typical bam format ? Maybe there is an option fo filter headers containing sequences from my output bam and then using input bam, filter them in correct bam format?
It looks like you deleted a prior question where you had shown how you did this conversion. Can you show us snippets of your BED, genome.size and resulting BAM file?
In any case it may be best to use the method that benformatics linked below in their answer.