This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bedtools getfasta for mm9 genome

I downloaded the mm9 genome (all chromosomes) from UCSC (http://hgdownload-test.cse.ucsc.edu/goldenPath/mm9/chromosomes/) , and then concatenated them using the following code:

 cat chr1.fa | cat - chr2.fa | cat - chr3.fa | cat - chr4.fa | cat - chr5.fa | cat - chr6.fa | cat - chr7.fa | cat - chr8.fa | cat - chr9.fa | cat - chr10.fa | cat - chr11.fa | cat - chr12.fa | cat - chr13.fa | cat - chr14.fa | cat - chr15.fa | cat - chr16.fa | cat - chr17.fa | cat - chr18.fa |cat - chr19.fa | cat - chrX.fa | cat - chrY.fa > mm9.fa

I expected that I got the whole genome fasta file, but when I used bedtools getfasta for my regions of interest:

bedtools getfasta -fi mm9.fa -bed *file* -tab -fo *file*

it gave me errors like this, for all the chromosomes:

WARNING. chromosome () was not found in the FASTA file. Skipping.

I used to grep to check, but all of my chromosomes are indeed present in the file. What am I doing wrong?

genome

What about using cat *.fa > mm9.fa?

That was my first try, didn't work.

1 answer

Do a cat bed-file | cut -f1 | sort | uniq and do a diff with your chromosome list. Most likely there will be some 'chr' or so prefix issue. If this doesn't work. Post the header list of fasta and few lines from input bed.

Thanks a lot! It was a problem with the 'chr' prefix of my .bed file.

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

Log in to answer this question.