This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Running Freebayes on 100+ Samples

Hi everyone,

So I've been using Freebayes for a while now to do my variant calling with usually around 100-200 samples and I've never had a problem running it before. I usually make a text file with my list of bam files (everything is in the same directory and my bam files are indexed). I've actually used this same samples in the past calling variants with Freebayes, but now I cannot get Freebayes to run on these samples to save my life! I keep getting the following error:

[E::hts_open_format] Failed to open file 2012EL-1410.bam ERROR(freebayes): Could not open input BAM file: 2012EL-1410.bam

2012EL-1410.bam is just the name of the bam file that is first on my list. I've changed the read groups and everything for my samples. Like I said, I did the same exact pipeline I did before and never had a problem with running Freebayes and now I can't get it to run. I'm wondering if there was an updated and I need to do something differently but I can't find any info about what to do. Here is my Freebayes command:

freebayes -L $FILE1 -f $REF -v $FILE2 -T 0.001 -p 1 -i -X -n 0 -E 3 --min-repeat-size 5 -m 1 -q 20 -R 0 -Y 0 -e 1000 -F 0.5 -C 2 -3 0 -G 1 -! 0 -d

I do not believe there is a problem with my text file, its formatted with each bam file listed on one line, then the next bam file on the next line, one after the other.

Now just to test it out, I ran Freebayes with a list of 2 samples and it started running! So I'm not sure if something has changed in regards to the number of samples you can run with Freebayes now, because I ran it not that long ago with over 250 bam files with no problem and now I can't get it to run with 100 bam files.

The version of Freebayes I'm using is v1.1.0-20170823. Has anyone else had this problem and could help me out?? I would be appreciate it so much!!

Thanks!!

snp variant calling bacteria

Is the file freebayes is complaining about in the same folder from where you start freebayes?

Check if there are any white-spaces around the filename in your text file and/or the file name.

fin swimmer

Yeah I have, it's still not running. I've checked that many times, because originally I did think that was the problem.

You've said you have tested it with a list of two samples and it works. Was the same sample from the error message above in it?

Those samples were part of the list, but it seems like it never even gets past the first sample. I took out the sample I mentioned in the error out of the list to see if it was just sample, and it just gave the same error with the next sample. So I have no idea what is going on.

So I did some looking at my bam file headers and noticed that some of the samples were ran with different versions of bowtie2. Do you think that could potentially be the issue?

Hello tpaisie!

We believe that this post does not fit the main topic of this site.

Fixed problem.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

2 answers

If something wrong with the header freebayes would complain about this. Could you check with which character the lines terminates in your text file?

$ file samples.txt

This should print:

samples.txt: ASCII text

If the result is this:

samples.txt: ASCII text, with CRLF line terminators

we have found the problem. You can correct this than with dos2unix, by simply type dos2unix samples.txt

fin swimmer

That worked!!! Thank you so much for your help!!

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
Upvote|Bookmark|Accept

That worked!!! Thank you so much for your help!!

Hi, please do not add answers unless you're answering the top level question. Thank you.

Log in to answer this question.