Question: How to extract aligned exactly 1 time in Single end read?
1
gravatar for star
2.1 years ago by
star240
Netherlands
star240 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 • 1000 views
ADD COMMENTlink modified 2.1 years ago by zx87549.3k • written 2.1 years ago by star240
2
gravatar for Bastien Hervé
2.1 years ago by
Bastien Hervé4.6k
Karolinska Institutet, Sweden
Bastien Hervé4.6k wrote:

You want to remove unaligned reads ?

samtools view -F 4
ADD COMMENTlink written 2.1 years ago by Bastien Hervé4.6k

Good! Thanks !. it is working

ADD REPLYlink modified 2.1 years ago • written 2.1 years ago by star240
2

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

ADD REPLYlink written 2.1 years ago by ATpoint36k
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: 797 users visited in the last hour