Hi,
I would like to create a fasta file from consensus of a bam file previously aligned on a reference genome.
Here's an example:
Fasta from Reference genome : CHR_1 ATGATACGATGCTACGTAGCTACGTACGATCGTACGATCGATCGATCGA
Fasta from Bam file consensus : CHR_1 ATGATACGATGCTACNNNNNNNNNNNNNNNNNNNNNNNCGATCGATCGA
I tried with samtools Fasta function but the fasta file obtained doesn't keep the chromosome nor the position of the read. So I end up with a fasta file containing thousand of "chromosome" named something like AMY1X:05260:04932
If i'm not clear enough don't hesitate to ask more question and thank for your time!
You can use
samtools
and 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.