Hi all,
I was wondering what would be the fastest way to do something like the task described below in one line using samtools preferably:
Samtools one line instruction to do:
INPUT: infile.bam
The infile:
- Contains other flags than 0 or 16 and I only want 0 or 16 in the output
- Contains irrelevant chromosomes for my analysis such as GL000192.1, MT, etc., and I want to filter them out
- Contains the chromosomes as numbers, i.e., 1,2,3,...,22,X,Y and I want them as chr1, chr2, chr3,...,chr22,chrX,chrY
OUTPUT outfile.bam with no irrelevant chromosomes, only 0 or 16 as flags, and chromosome as chr.
Suggestions are welcome, thanks guys!
I think my answer here would point you towards a solution. Let me know if you're unable to get it.