This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BAM detect unalign region

Hello folks,

I am running bowtie2 of a sequenced PCR product against a reference allele. Obviously here, my PCR product is bigger than the length of the sequence reads.

BAM containing unaligned region

How can I detect the presence of unaligned regions/positions early on without visualising on IGV?

Thank you.

bowtie2

1 answer

samtools depth -r "chrom1:234-567" -a in.bam |\
awk '$3=="0" {printf("%s\t%d\t%s\n",$1,int($2)-1,$2);}' |\
sort -t $'\t' -k1,1 -k2,2n |\
bedtools merge

Log in to answer this question.