Question: extract region bam
gravatar for J.F.Jiang
5 months ago by
J.F.Jiang690 wrote:

Hi all,

I want to extract bam of specific amplicon to evaluate the according amplicon performance. I used to use samtools view xx.bam chr:start-end to extract the bam, however, if the two amplicon are totally overlapped, this command will return us the whole reads covering the two region.

For example:

first amplicon:

------------------------------------> <----------------------------------------

second amplicon:



I firstly convert the bam to bed using bedtools, and get those reads name that are exactly match with the start position of the first amplicon. Then paired reads that belong the amplicon 1 were then extract from the bam file, as well as amplicon 2.

Is there any convenient method to seperately extract the exact reads belong to the two amplicons?

Thanks, Junfeng

bam region • 293 views
ADD COMMENTlink modified 5 months ago by h.mon14k • written 5 months ago by J.F.Jiang690
gravatar for h.mon
5 months ago by
h.mon14k wrote:

A couple of suggestions:

1) use from BBTools to split the sequencing before mapping. You could try something like: in=amplicons.fq ref=primers.fa pattern=out%.fq k=21 restrictleft=25 \
    nzo=f refstats=refstats.txt

See the discussion starting from post #25 on this SeqAnswers thread.

2) Maybe and could also do what you want (I am tagging Brian Bushnell and genomax because they can probably clarify this). See discussion starting at post #19 on the same thread as above

ADD COMMENTlink written 5 months ago by h.mon14k


Either or is spliting the raw sequencing file based on matched primers. However, I still want to begin from bam file.

ADD REPLYlink written 5 months ago by J.F.Jiang690
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: 1568 users visited in the last hour