Question: Can I filter based on chr_n in VCFtools
2
gravatar for mosher.cherie
2.8 years ago by
mosher.cherie20 wrote:

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

snp vcftools • 1.1k views
ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by mosher.cherie20

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.

ADD REPLYlink modified 2.8 years ago • written 2.8 years ago by mosher.cherie20
0
gravatar for Pierre Lindenbaum
2.8 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum115k wrote:

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; ' 
ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by Pierre Lindenbaum115k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 749 users visited in the last hour