Question: Remove Soft Clipped Bases
gravatar for Clare
7.1 years ago by
United States
Clare160 wrote:

I want to conduct some computations using a python script directly on some BWA aligned bam files, and to do this I need to remove the soft clipped bases. i.e. if the cigar string and read is: 2S8M CCTGGAGAAT I want to clip so it becomes: 8M TGGAGAAT

I tried to do this using clip reads in GaTK but the hardclip option is throwing errors and is unsupported.

Is there anyway to remove the soft clip bases with another piece of software.

Because my coverage is not very high, I don't want to disable softclipping in BWA, as I will loose a lot of coverage.


bam • 6.2k views
ADD COMMENTlink modified 3.0 years ago by opplatek40 • written 7.1 years ago by Clare160

Can't you just parse the CIGAR string in your script and take care of it there?

ADD REPLYlink written 7.1 years ago by Devon Ryan97k
gravatar for Pierre Lindenbaum
6.9 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum131k wrote:

I just wrote a program removing the clipped bases/qual



$  java -jar dist/biostar84452.jar samtools-0.1.18/examples/toy.sam > out.sam

@HD    VN:1.4    SO:unsorted
@SQ    SN:ref    LN:45
@SQ    SN:ref2    LN:40
@PG    ID:0    VN:b5ebf67dd2926d8a6afadb4d1e36a4959508057f    CL:samtools-0.1.18/examples/toy.sam
r002    0    ref    9    0    2I6M1P1I1P1I4M2I    *    0    0    AAAGATAAGGGATAAA    *

$ grep r002 samtools-0.1.18/examples/toy.sam
r002    0    ref    9    30    1S2I6M1P1I1P1I4M2I    *    0    0    AAAAGATAAGGGATAAA    *
ADD COMMENTlink written 6.9 years ago by Pierre Lindenbaum131k

this tool was cited in the suppl. mat. of

ADD REPLYlink written 3.0 years ago by Pierre Lindenbaum131k
gravatar for opplatek
3.0 years ago by
Czech Republic
opplatek40 wrote:

bamutils / removeclipping works also very nice

P.S. I know the post is very old but this might be handy for somebody else reading this post in the future.

ADD COMMENTlink modified 15 months ago • written 3.0 years ago by opplatek40

I'm afraid your link is broken. Are you referring to That doesn't seem to have a removeclipping tool.

ADD REPLYlink written 17 months ago by terdon410

I have edited the answer and link should be working now. The team stopped actively supporting the tools and they have migrated here. However, I don't see the clipping utility there. The 'old' one still works, though. The bamUtil is completely different package.

ADD REPLYlink written 15 months ago by opplatek40
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1115 users visited in the last hour