How do you run a BWA alignnment command in R?
1
0
Entering edit mode
7.2 years ago

Hi, I'm trying to align my reads to a reference genome using the bwa alignment. I used this command wherein I already specified the path for my BWA folder ("path_bwa"):

system(paste(path_bwa, "/bwa aln -t ", proc, " ", genome, " FASTQ_FILTERED.fq > ", file_sai, sep=""))

However, it always shows this error: sh: /Applications/bwa/bwa: No such file or directory

Somehow, I think it assumes that the "/" in the "/bwa aln -t " is a directory and it is trying to look for it.

I tried deleting the "/" and just put "bwa aln -t " but it still doesn't work. Do you have any idea on what's wrong with the code?

Thank you so much for your help. It will be greatly appreciated.

Best, Carla

alignment R • 4.8k views
ADD COMMENT
2
Entering edit mode

citing OP on twitter :

ADD REPLY
1
Entering edit mode

I can easily invoke my BWA program by using full paths like this:

bwa.path <- "/Programs/bwa-0.7.12/"
system(paste(bwa.path, "bwa", " index", sep=""))

What is the value of path_bwa and proc ?

ADD REPLY
1
Entering edit mode

In addition to all comments on why do you want to wrap this on R, are you sure you want to use bwa aln? bwa mem is the recommended algorithm for most uses, unless your reads are really short, bellow 70bp.

ADD REPLY
0
Entering edit mode

1) why R ? why ? why ? why not a good-old bash/shell script ?

2) sounds like a path problem. check paste(path_bwa, "/bwa . What is the output of

find  /Applications/ -name "bwa"

and

which bwa
ADD REPLY
0
Entering edit mode

just curious why you don't do it in shell? And whether it's working in shell?

ADD REPLY
0
Entering edit mode

...or why not use one of the many fine pipeline frameworks actually designed for this?

ADD REPLY
0
Entering edit mode
6.1 years ago
viniciushs.z ▴ 20

Maybe the below wrapper can help

https://rdrr.io/github/flow-r/ngsflows/man/bwa.html

ADD COMMENT

Login before adding your answer.

Traffic: 2544 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