Removing reads which map to certain region of reference
1
0
Entering edit mode
3.0 years ago
clinnaeus ▴ 30

I have mapped reads to a reference genome of a related species. I want to remove reads which map to a specific region (chromosome) of the reference, but I don't know what the best way to go about it is. I'm doing variant calling, and I've been using the -t ^ option in bcftools call to exclude the relevant chromosomes, but does this target regions in the reference, or in the mapped reads? Is it the same thing? Is it better to do this during mpileup phase?

I feel completely lost and would appreciate an ELI5.

mapping reference genome • 1.2k views
ADD COMMENT
0
Entering edit mode

Not sure if this would help but samtools view now has the option

-L FILE, --target-file FILE, --targets-file FILE

    Only output alignments overlapping the input BED FILE [null]. 

You could create intervals for parts you want to keep.

ADD REPLY
0
Entering edit mode
3.0 years ago

use bedtools complement to get the complement of your blacklisted.bed and then use samtools view -L complement.bed -O BAM -o out.bam in.bam

or use samtools view -M -L blacklisted.bed -O BAM --unoutput out.bam in.bam > /dev/null

ADD COMMENT

Login before adding your answer.

Traffic: 2680 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