How to extract aligned exactly 1 time in Single end read?
1
1
Entering edit mode
2.8 years ago
star ▴ 270

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?

alignment bowtie2 bwa • 1.3k views
ADD COMMENT
2
Entering edit mode
2.8 years ago

You want to remove unaligned reads ?

samtools view -F 4
ADD COMMENT
0
Entering edit mode

Good! Thanks !. it is working

ADD REPLY
2
Entering edit mode

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

ADD REPLY

Login before adding your answer.

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