Question: Remove clipped reads
0
gravatar for finswimmer
24 months ago by
finswimmer13k
Germany
finswimmer13k wrote:

Hello,

is there a tool or script which can remove reads from my bam files which contain soft clipped bases? It would be nice if I could also define to just remove reads that have at least n soft clipped bases, or the fraction of soft clipped bases is more than x.

Thanks for any advice.

fin swimmer

bam • 1.2k views
ADD COMMENTlink modified 24 months ago by Pierre Lindenbaum127k • written 24 months ago by finswimmer13k
1

@Pierre to rescue: Remove Soft Clipped Bases
How to remove reads with hard/soft clipping along with its mate?

ADD REPLYlink modified 24 months ago • written 24 months ago by genomax80k

This seems to remove only the soft clipped bases. But I'd like to get rid of the whole reads.

fin swimmer

ADD REPLYlink written 24 months ago by finswimmer13k

There are two links in the post. Did you look at the second?

ADD REPLYlink written 24 months ago by genomax80k

Oh, sorry haven't seen your edit.

But in your first link I also found a link to bamutils. A combination of removeclipping and filter seems to fit my needs. It's only a pity that bamutils seems not to support streaming.

Thanks for showing me the right direction.

fin swimmer

ADD REPLYlink modified 24 months ago • written 24 months ago by finswimmer13k

It's probably a bit late as you already have a BAM but if you really don't want any read clipped, your probably best off forcing your aligner to align entire reads (e.g. bowtie2 end-to-end).

ADD REPLYlink written 24 months ago by d-cameron2.1k
0
gravatar for Pierre Lindenbaum
24 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum127k wrote:

up-to-date answer using samjdk: http://lindenb.github.io/jvarkit/SamJdk.html , removing clipped reads where more than 33% of the read is clipped.

java -jar dist/samjdk.jar -e 'return record.getReadUnmappedFlag() || record.getCigar()==null || record.getCigar().getCigarElements().stream().filter(C->C.getOperator().isClipping()).mapToInt(C->C.getLength()).sum() / (double)record.getCigar().getReadLength() < 0.33;'
ADD COMMENTlink written 24 months ago by Pierre Lindenbaum127k
Please log in to add an answer.

Help
Access

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