I want to extract the mapped regions out of bam files. So I tried bcftools. I have the current version of bcftools (V.19). I tried the following steps
bcftools mpileup -Ou -f reference.fa alignments.bam | bcftools call -mv -Oz -o calls.vcf.gz
after that a note appeared
Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are diploid
but this file has the regions which I want, so I go on with:
bcftools index calls.vcf.gz cat reference.fa | bcftools consensus calls.vcf.gz > consensus.fa
Here also the note appear, and the whole fasta regions are displayed in consensus.fa
Note: the --sample option not given, applying all records
But when doing this:
cat reference.fa | bcftools consensus -s calls.vcf.gz > consensus.fa
nothing works. I tried a lot of stuff and have no idea where the mistake is.
Hope you can help me.