Issue with bed to bam conversion - sequence in bam headers
1
0
Entering edit mode
2.8 years ago

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. enter image description here

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?

bam bed • 1.2k views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
1
Entering edit mode
2.8 years ago

Bed files contain no extra metadata that would be relevant to a BAM file. By converting your BAM to bed you are losing all your mismatch, gap, and, sequence quality information. I somewhat can't imagine a scenario where you would be required to convert BAM files to bed files in order to do filtering. I would suggest you filter your BAM files directly.

You can subset BAM files by regions for instance: Extract Reads From A Bam File That Fall Within A Given Region

ADD COMMENT

Login before adding your answer.

Traffic: 3615 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6