This tiny Shell script called prepareFastaRef.command
is supposed to receive a file name I am giving as an argument, generate the path based on it, then run a command on that file. It looks like:
#!/bin/bash
REF="~/Dropbox/phd/fastarefs/$1"
echo "$REF"
samtools faidx "$REF"
I run it from the command line with:
prepareFastaRef.command test.fa
But it does not seem to be able to find the file:
[E::fai_build3_core] Failed to open my file ~/Dropbox/phd/fastarefs/test.fa
The problem is not specific to the programme samtools
as I have the same issue with others. And I can confirm 100% the file test.fa
is in there.
What I find confusing is that this command alone works perfectly:
samtools faidx ~/Dropbox/phd/fastarefs/off_aa1.fa
So it seems to be an issue with how I pass the path from within the Shell script.
What am I missing?