Can I filter based on chr_n in VCFtools
Hello,
I’m working in VCFtools on a .vcf file and am wondering if there is a command to filter based on chr_n <integer>. I would like to filter out chromosomes that have a chr_n less than 560.
Thank-you,
Cherie
• 2,682 views
•
link
1 answer
not vcftools but Using VCFIlterJS : https://github.com/lindenb/jvarkit/wiki/VCFFilterJS
if 'n' is a length
gunzip -c input.vcf.gz | \
java -jar dist/vcffilterjs.jar -e 'header.getSequenceDictionary().getSequence(variant.getContig()).getSequenceLength() > 560'
if 'n' is a chromosome number chr1, chr2...
gunzip -c input.vcf.gz | \
java -jar dist/vcffilterjs.jar -e 'var n; try { n=parseInt(variant.getContig()); } catch(err) {n=9999;} n<560; '
• 1 views
•
link
Log in to answer this question.
I refer to the number of total across all individuals for that chromosome when I refer to chr_n, not the length of the read. For example, when I get stats (--freq), my ‘CHROM’ 78860_1 has a ‘chr_n’ of 560. I take it to mean that that site (78860_1, pos 152) is represented across all individuals (280 individuals x 2 chromosomes). What I am looking to do is to filter the .vcf file so that the resulting file only includes sites that are represented in all individuals completely (such as 78860_1, pos 152). Do you know which command does this? Part of my problem is that some of these sites (i.e. ‘CHROM' 78860_1) have SNPs at multiple positions and some of those positions have a N_CHR of 560 while others do not. I will lose some good information if I remove the entire CHROM.