View Single Post
Old 06-14-2011, 06:40 PM   #6
fpepin
Member
 
Location: Berkeley

Join Date: Feb 2011
Posts: 30
Default

I hadn't understood the question was about the script, not bwa.

I haven't read that book but I've heard good things about it.

You can do it in the shell fairly easily too:
Code:
for i in file*
do
bwa aln -t 24 index $i>$i.sam
done
Another way that I like is:
Code:
ls file* | xargs -n1 -P24 -I{} bwa aln index {}>{}.sam
xargs is nice in that it can run many jobs in parallel. For example, the example above would run 24 jobs with 1 thread each as opposed to running each sequentially with 24 threads. It makes little difference here, but it comes in real handy when working with tools that are only single-threaded.

Both of the examples above have a longer name for the sam file. You if you prefer your original naming scheme, you can use something like:
Code:
for i in file*.sam
do
echo mv $i `echo $i | sed -e 's/file//'`
done
That being said, learning a bit of perl will come in handy.
fpepin is offline   Reply With Quote