Hello,
as jean.elbers says before bcftools consensus is the way you have to go. Therefor you need to convert your file to a valid vcf file.
$ echo "##fileformat=VCFv4.2" > input.vcf
$ echo "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO" >> input.vcf
$ tail -n+2 variants.txt|awk -v OFS="\t" '{print $1,$2,".",$3,$4,".",".","."}' >> input.vcf
Then compress it with bgzip and index by tabix.
$ bgzip -c input.vcf > input.vcf.gz
$ tabix input.vcf.gz
Now you are ready for bcftools consensus.
$ bcftools consensus -f genome.fa input.vcf.gz -o output.fa
fin swimmer
bcftools consensus may warn you about sequences not found in the vcf. You can safely ignore this. The warning happens if it finds sequence id's in the reference that are not in your vcf. If you want to get rid of those messages each contig of the reference needs to be defined in the vcf header. This can be done like this:
1. Index the reference
$ samtools faidx genome.fa
2. Create headers for the vcf
$ echo "##fileformat=VCFv4.2" > input.vcf
$ awk '{print "##contig=<ID="$1",length="$2">"}' genome.fa.fai >> input.vcf
$ echo "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO" >> input.vcf
3. Add variant information
$ tail -n+2 variants.txt|awk -v OFS="\t" '{print $1,$2,".",$3,$4,".",".","."}' >> input.vcf
Continue with bgzip, tabix and bcftools consensus as above.