Samtools view filter by reference sequence
1
0
Entering edit mode
3.0 years ago
maxrwjones ▴ 60

Hi all,

Just wondering if I'm missing something very obvious. I have a SAM file of a bunch of alignments mapped to a reference genome consisting of multiple chromosomes.

I can see from the samtools view man page how to include alignments by ref seq name in the output, but is there a way to exclude alignments by ref seq name? (I know I could do this with a pipe to grep or awk but I figure there must be a way to do it within samtools...) (I could also do it by just listing all the chromosomes I want except the unwanted ones, but that seems clunky and less portable to new scenarios.)

Cheers in advance!

samtools • 977 views
ADD COMMENT
2
Entering edit mode
3.0 years ago

get the complement BED use bedtools complement and the scan the bam using

samtools view  -L complement.bed 
ADD COMMENT
0
Entering edit mode

Thanks for your answer, I will give this a go!

ADD REPLY

Login before adding your answer.

Traffic: 2564 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6