Biostar Beta. Not for public use.
How to extract aligned exactly 1 time in Single end read?
1
Entering edit mode
16 months ago
star • 150
Netherlands

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?

ADD COMMENTlink
2
Entering edit mode
18 months ago
Limoges, CBRS, France

You want to remove unaligned reads ?

samtools view -F 4
ADD COMMENTlink
0
Entering edit mode

Good! Thanks !. it is working

ADD REPLYlink
2
Entering edit mode

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

ADD REPLYlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.3.1