It's been some days that I'm trying to obtain second vcf from a larger one (~40K SNPs). What I want to achieve is to get into this new vcf all the information about non-consecutive 428 sites, of which I have the contig name (CHROM field) and the POS relative to the contig. So far I have tried both with vcftools and the -R command of bcftools, that one with the line
bcftools filter in.vcf -R TabDelimitedListOfCHROMandPOS.txt > out.vcf
where TabDelimitedListOfCHROMandPOS.txt is exactly what it says on the tin: a tab-delimited file with CHROM and POS header containing the information of the variants I wanti in my new vcf - namely, name of the contigs and variant positions. However, the result is
[E::bcf_sr_regions_init] Could not parse the file TabDelimitedListOfCHROMandPOS.txt, using the columns 1,2[,-1]
Failed to read the regions: TabDelimitedListOfCHROMandPOS.txt
Someone can provide some advice on this jazz? I thank you all in advance.
Hi! Maybe this or this is of interest?
you cannot use
-R
on a plain vcf. Vcf must be bgzipped (or bcf) and indexed.what is the output of:
Herethey are:
As of now I am dealing with samtools to bgzip the vcf, thanks.
bctools, not samtools
bcftools doesn't know that this line is a header