Soft-clipping of a BAM file based on regions from the BED file
1
0
Entering edit mode
3.7 years ago
lechu ▴ 20

I have a BED file with genomic regions. Is there a tool that, using this BED file, would help me to subset this BAM file so that all reads (and parts of reads) that fall outside of the regions in the BED file would be soft-clipped?

rna-seq • 2.7k views
ADD COMMENT
0
0
Entering edit mode

This truly gives impression I'm a a lazy tard that can't use google ;). Thanks!

ADD REPLY
1
Entering edit mode

@Pierre has answers/code written for questions that have not even been asked. These were examples where he already provided answers. So don't feel bad :-)

ADD REPLY
0
Entering edit mode

I looked at the PcrClipReads tool developed by @Pierre. It's great, but as far as I understand, it does not handle cases of reads that overlap two (or more) regions. I realized I was not precise in my question. In a situation like the one depicted below I would only like to clip bases marked x (read 1 should not be clipped). The goal is to use exonic regions and remove everything the protrudes outside of exonic ranges (this may require "internal' clips in the reads). Equally good alternative would be to somehow reset the qualities of the bases to be clipped to zero (instead of clipping). I tried to do it using sam2tsv (also from @Pierre), but ended up with file sizes that were impossible to handle (I need it for whole transcriptome data). Then I run out of ideas.

        ----------           ---  read 1 (goes across two exons)
        ----------xxx        ---  read 2 (goes across two exons, some mapped to intron)
        ----------xxx             read 3 (mapped to single regions + some protrusion)
       |-REGION1-|           |-REGION2-|
ADD REPLY
0
Entering edit mode

update 2021: there is now samtools ampliconclip samtools-ampliconclip http://www.htslib.org/doc/samtools-ampliconclip.html

Clip reads in a SAM compatible file based on data from a BED file.

ADD REPLY

Login before adding your answer.

Traffic: 2406 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