Question: How to extract aligned exactly 1 time in Single end read?
1
gravatar for star
16 months ago by
star190
Netherlands
star190 wrote:

I like to have exactly 1 match reads (6729690) from output of bowtie2 aligner. the blow cod is what I have used for aligning.

bowtie2 --very-sensitive --score-min C,0,0 -p 8 -x Genome_Index  input.fastq.gz -S output.sam

  8506903 reads; of these:
  8506903 (100.00%) were unpaired; of these:
 923759 (10.86%) aligned 0 times
 6729690 (79.11%) aligned exactly 1 time
853454 (10.03%) aligned >1 times
89.14% overall alignment rate

Also, I used :

samtools view -hf "AS:i:" output.sam | grep -v "XS:i:" > unique_output.sam
samtools view unique_output.sam | wc -l

but I got 7653449 reads that is (923759 + 6729690)

Is my code right?

How can I get only 6729690 reads?

bwa alignment bowtie2 • 684 views
ADD COMMENTlink modified 16 months ago by zx87548.3k • written 16 months ago by star190
2
gravatar for Bastien Hervé
16 months ago by
Bastien Hervé4.5k
Limoges, CBRS, France
Bastien Hervé4.5k wrote:

You want to remove unaligned reads ?

samtools view -F 4
ADD COMMENTlink written 16 months ago by Bastien Hervé4.5k

Good! Thanks !. it is working

ADD REPLYlink modified 16 months ago • written 16 months ago by star190
2

The bitwise flag filtering is quiet powerful, check this page to get an idea what flag combination exist.

ADD REPLYlink written 16 months ago by ATpoint24k
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: 1788 users visited in the last hour