I am new to bioinformatics analysis. I have a sorted BAM file which is WES. In order to get chromosome 1 from the given BAM file in fasta format, I use the following set of commands
samtools view -b file_name.bam chr1>chr1.bam samtools mpileup -E -uf ~/hg38.fa chr1.bam > chr1.mpileup bcftools call -mv -Oz chr1.mpileup>chr1.vcf.gz tabix -p vcf chr1.vcf.gz samtools faidx ~/hg38.fa chr1|bcftools consensus chr1.vcf.gz -o chr1.fa
In the obtained chr1.fa file, it seems that the non-exome parts of the sequence are also there which doesn't make sense. Further, given the human genome is diploid, shouldn't I be getting 2 fasta files??