Hello!
I have a bam alignment file from lifescope. I would like to extract reads that fulfil following criteria:
- one pair is aligned to the annotated region (on exom) and
- the other pair aligned to the intron region
I tried the following command but was unable to grep the condition.
samtools view -F 14 input_file.bam | grep -v " = " > ouput_file.sam
I have searched for the answer and played with different options for samtools view but failed to find that satisfies the criteria.
Thanks
There's no possible way to do this with a combination of samtools and grep. You're going to write a script using pysam or something similar to do this.