Hello I have a txt file that consists from CHROM,ID,POS, REF and ALT ( 48 variants ) I want to subset this txt with original VCF to make a new VCF I try to use bcftools using this query
bcftools view -T variants.txt mydata.vcf > variant1.vcf
but the problem , I have 4 variants in txt that don't have ID ( The ID of them = . ) and bcftools delete this 4 variants ( So my new VCF = 44 variants )
how can I save this 4 variants and don't delete them , So, my new VCF must be 48?
Thanks.
Refresh : I try to make my txt file consists from CHROM and POS only and try this code :
bcftools view -R variants.txt mydata.vcf.gz > variant1.vcf
but the results : I get 60 variants (+12 variants) I guess ( but I'm not sure ) it add also any variants between 2 number that I really want. for example : ch3 have 2 locations :14933179 and 195781647 but when I do bcftools view -R , it have 8 locations: 14933179, 195781570, 195781607, 195781618 , 195781619 , 195781628 ,195781635 and 195781647
So , how can I print just my 48 variants without adding or losing :) ?
What if you just use the CHROM and POS columns of your text file with
-R
parameter instead of-T
?now I try, but it give me 60 variants! ( +12 variants ) ? what is the problem?
tbi is the associated index file. IMHO You'd better read the manual to have a clear view of what if an indexed vcf file
I'm finish this problem now, and I get ".vcf.gz" and I also bcftools view -R but the problem it appear 60 variants (+12 what I want ) .. I guess ( but I'm not sure ) it add also any variants between 2 number that I want. for example : ch3 have 2 locations :14933179 and 195781647 but when I do bcftools view -R , it have 8 locations: 14933179, 195781570, 195781607, 195781618 , 195781619 , 195781628 ,195781635 and 195781647. So, how can I avoid this problem?