This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to reassembly using .bed file

Hi, I would like to request your help with re-assembling a transcriptome using a .bed file. I have a bad assembly that has parts with no coverage so I used bedtools to remove those sites and merged the remaining:

bedtools genomecov -bga -ibam ./PrairieSmoke/Assemblies/WG_assembly.sorted.bam -g ./PrairieSmoke/Assemblies/WG_assembly.fasta |
awk '$4==0' |
bedtools merge -i - \
> ./PrairieSmoke/WG_assembly.bed

My question is how can I use this .bed file to reassembly? The ideia is to repeat the assembly after having removed those sites with no coverage with the hope of improving said assembly. Thanks in advance, Pam

rna-seq bedtools assembly

Also, if you do not want 0 coverage regions do not use -bga flag, just use -bg. The -bga means bed graph all, as in output all positions, even those with 0 coverage. If you just use the -bg flag, you will only output regions with coverage. There is no reason to use -bga if you do not want regions with 0 coverage. This will totally eliminate the need for the awk step above. Understand your tools before you use them!

1 answer

The line:

awk '$4==0'

is doing the opposite of what you think. That is selecting for regions with 0 coverage and merging them. Replace that with:

awk '$4!=0'

which will output all regions that do not have 0 coverage (aka covered regions). Currently your code would merge all 0 coverage regions with this WG_assembly.bed file.

Log in to answer this question.