Question: Indexing reference genome for GATK
0
gravatar for lcc1844
4.4 years ago by
lcc184430
United Kingdom
lcc184430 wrote:

I have created .bam files using BWA and Samtools having downloaded a reference genome hg19 from UCSC and indexing it with 

bwa index -a bwtsw hg19.fa

This worked fine for me, until now when I am trying to call variants in GATK and see that I need a reference in karyotypic order. I have downloaded the hg19.fa.fai and .dict files from the GATK FTP site and have also downloaded their full reference genome which is in chromosome order. I read that it wad easier to do this than to try and order the indexed reference I already have. 

Only I am now trying to index the new reference in the same way and get the message: 

[bwa_index] fail to open file '‐a bwtsw' : No such file or directory

 

Any ideas what I should be doing?! 

Thanks 

sequencing next-gen alignment • 3.3k views
ADD COMMENTlink modified 2.3 years ago by Ray Lee0 • written 4.4 years ago by lcc184430

What version of bwa and what is the exact command that causes the error message?

ADD REPLYlink written 4.4 years ago by Devon Ryan91k

Hi it is bwa-0.7.12 and the command was 

bwa index -a bwtsw hg19.fa 

 

 

ADD REPLYlink written 4.4 years ago by lcc184430

Are you sure you didn't type:

bwa index "-a bwtsw" hg19.fa

or something like that? This isn't an error that I can reproduce without using an incorrect command.

ADD REPLYlink written 4.4 years ago by Devon Ryan91k

100% sure, I used the same command I have used in the past so I don't know why it wont work. In the BWA directory I see bwtsw files with various suffixes. At the moment I am running index alone (without bwtsw) but I am not familiar with how this works for the human genome. 

ADD REPLYlink written 4.4 years ago by lcc184430

Oh ok brilliant, thank you. The index command alone is processing nicely so I wont question it any more! 

ADD REPLYlink written 4.4 years ago by lcc184430
3
gravatar for matted
4.4 years ago by
matted7.0k
Boston, United States
matted7.0k wrote:

It looks like you may have copy-pasted the command from somewhere with a strange character encoding, or something like that.  Your dash character isn't the same as the "regular" one:

>>> ord(u"‐")  # I copied yours here
8208
>>> ord(u"-")   # this is the one on my keyboard
45

If I copy your bwa command, I get:

bwa index ‐a bwtsw test.fa
[bwa_index] fail to open file '‐a' : No such file or directory

As Devon suggested, I need to group bwtsw to get the exact error you did.  Maybe your space character is strange and effectively did that?  That's a guess, though.

bwa index "‐a bwtsw" test.fa
[bwa_index] fail to open file '‐a bwtsw' : No such file or directory

In any case, you no longer need to specify -a with bwa, as it will autodetect the best algorithm (the default is auto).  Therefore, what you're running now should work fine regardless.

 

Edit:  It looks like overall it's a Unicode problem.  Your hyphen is a Unicode hyphen (8208 is 0x2010, which is a regular hyphen).  It's not the same as an ASCII hyphen (ASCII 45, which is 0x002d).  I imagine the "-a bwtsw" problem is because it used a Unicode space instead of the plain ASCII one.  I don't know much about character encoding (and am glad!) and how desktop systems manage it when copying text between applications, but it looks like that caused these issues.

ADD COMMENTlink modified 4.4 years ago • written 4.4 years ago by matted7.0k
2

Wow, good catch on the dash character.

ADD REPLYlink written 4.4 years ago by Devon Ryan91k

This is the reason I always use TextWrangler, check encoding and try again if I'm copy pasting commands.

ADD REPLYlink written 4.4 years ago by RamRS22k
0
gravatar for Ray Lee
2.3 years ago by
Ray Lee0
Shanghai, Republic of China
Ray Lee0 wrote:

change the order

bwa index hg.fa -a bwtsw

this works for me.

ADD COMMENTlink written 2.3 years ago by Ray Lee0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 548 users visited in the last hour