While this should work to generate a fasta file via a variant calling step, it should be noted that the name of the bcftools consensus function is somewhat misleading (see the documentation). In fact, bcftools consensus should better be named "alternate reference maker" as in GATK. By default, it will replace every reference position with its ALT allele if present irrespective of coverage or frequency. This is very different from what many people would expect under the term consensus.
So, this pipeline would give you a genome with all positions replaced with their alternate allele even if a large majority of reads supports the reference allele. Lacking a variant filtration step, this would also add a lot of noise to your genome.
You can use
samtoolsand create FASTA reference that has a 1:1 coordinate correspondence with the original reference you used in alignment step. This will not include insertions.If you want to include insertions, you can do sth like this.
I wonder why you would want to do this. If you want to create a new genome, you should look into genome assembly and not first align to a reference genome.
Because we tried GBS on a population from Self-pollination and we want to see if we'll get a better alignement and snpcalling if we remove region that has not been sequenced on the parent that has been self pollinated.