This is a test version of Biostars. For the public version, visit https://www.biostars.org.
report only primary alignment BWA-MEM

I can extract primary alignment from sam/bam file using

samtools view -F 260

where 260 = unmapped(4) + secondary alignment(256)

but is there is a way to report primary alignment only for single read in the first place? (-a option in bwa-mem will report all alignment. Is there is option (or way around) so the output file contains the primary aligned read only? )

bwa sequence alignment

How about

bwa mem (...) | samtools view -bh -f 0 -F 256

good, but this do not show any direct way (in bwa-mem itself) to do the job, I still need to depend on another tool

Yes, but is that a problem? I guess you are anyway not using SAM files, right? So one round of samtools is necessary in any case to get binary files.

No, I was searching if there is a flag in bwa-mem to do that directly

0 answers

No answers yet.

Log in to answer this question.