ERROR(freebayes): Could not get first alignment from target
1
0
Entering edit mode
18 months ago

Hi I am trying to run the below freebayes command on the bam file that I had created using bwa mem and readgrouped it using picard AddOrReplaceReadGroups.jar

software/freebayes_v0.9.21-19-gc003c1e/freebayes/bin/freebayes --use-duplicate-reads --min-alternate-count 2 --min-alternate-fraction 0.01 --min-coverage 5 --use-mapping-quality -b test.bam -f hg19_GRCh37_p13_full.fasta -v test.vcf 

but I get this error stating:

ERROR(freebayes): Could not get first alignment from target
WARNING: test.vcf has no calls only header....

What possibly could be reason for this?

Sharing a snippet of few lines from the bam file (samtools view test.bam |less)

image

bam freebayes • 1.2k views
ADD COMMENT
3
Entering edit mode
18 months ago
Sasha ▴ 850

Can you share some of the image as text for easier understanding?

It seems like there might be an issue with your BAM file or the region you are trying to call variants on. To help diagnose the issue, please follow these steps:

1. Check if your BAM file is sorted and indexed:

samtools sort -o test_sorted.bam test.bam
samtools index test_sorted.bam

2. Check if your reference genome (hg19_GRCh37_p13_full.fasta) is indexed for freebayes:

samtools faidx hg19_GRCh37_p13_full.fasta

3. Run freebayes again with the sorted and indexed BAM file:

software/freebayes_v0.9.21-19-gc003c1e/freebayes/bin/freebayes --use-duplicate-reads --min-alternate-count 2 --min-alternate-fraction 0.01 --min-coverage 5 --use-mapping-quality -b test_sorted.bam -f hg19_GRCh37_p13_full.fasta -v test.vcf

4. If you still encounter the error, try to inspect the BAM file to see if there are any alignments:

samtools view test_sorted.bam | head

If you see alignments in the BAM file but still encounter the error with freebayes, it might be helpful to narrow down the region you are trying to call variants on. You can use the -r option in freebayes to specify a specific region, for example:

software/freebayes_v0.9.21-19-gc003c1e/freebayes/bin/freebayes --use-duplicate-reads --min-alternate-count 2 --min-alternate-fraction 0.01 --min-coverage 5 --use-mapping-quality -b test_sorted.bam -f hg19_GRCh37_p13_full.fasta -r chr1:100000-200000 -v test.vcf

Replace chr1:100000-200000 with the region you are interested in. If this works, it might indicate that the issue is specific to certain regions in your BAM file.

I'm using my chatbot here (https://tinybio.cloud) to help generate this answer. You can download it from the website.

ADD COMMENT
1
Entering edit mode

Thank you Sasha for the steps to diagnose. You were right, there was an issue with the bam file alignment.

ADD REPLY

Login before adding your answer.

Traffic: 1890 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6