bcftools icon indicating copy to clipboard operation
bcftools copied to clipboard

Different parameters on different chromosomes

Open JJ0ONATHANESTAR opened this issue 1 year ago • 1 comments

Hi, I have a problem with filtering with bcftools. I have total 26 chromosomes (1 ~ 25, MT) And I want to filter them with different parameters, FMT/DP.

My code was like: bcftools filter -e '((CHROM=="MT") && (FMT/DP<10 || FMT/DP>790)) || ((CHROM!="MT") && (FMT/DP<10 || FMT/DP>70)) || F_MISSING>0.1 || MIN(FMT/GQ)<10 || QUAL<30 || AC==0 || AC==AN' \ $INDIR/merged_with_outgroup.raw.vcf.gz | bcftools view -m2 -M2 -v snps -O z -o $OUTDIR/merged_with_outgroup.final.filtered.vcf.gz bcftools view $OUTDIR/merged_with_outgroup.final.filtered.vcf.gz | grep -c -v "^#"

MT chromosome was filtered well, but others were filtered with MT chromosome parameter(10-790). How do i modify this?

I heard that --chr option is for only extracting specific chromosomes in vcf file.

JJ0ONATHANESTAR avatar Dec 01 '24 09:12 JJ0ONATHANESTAR

If you think it is a bug, please provide a small test case which makes you believe that. Otherwise I'd look for errors in the logic of the boolean expression or in your assumptions. Specifically, are you sure it is not another part of the expression which breaks the filtering?

pd3 avatar Dec 03 '24 14:12 pd3