Entering edit mode
6.9 years ago
akoizumi
•
0
I'm running the FUSION.assoc_test.R program from the fusion_twas package and I'm trying to write a simple piece of code that will allow me to loop through the program and substitute with a different chromosome number with every iteration.
So far I have:
for i in {1..22..1}
do
Rscript ./FUSION.assoc_test.R \
--sumstats PGC2.SCZ.sumstats \
--weights ./WEIGHTS/GTEx.Whole_Blood.pos \
--weights_dir ./WEIGHTS/ \
--ref_ld_chr ./LDREF/1000G.EUR. \
--chr $i \
--out "PGZ_"$i".dat"
done
exit 0
When I try this I get an error:
Error in file(file, "rt") : cannot open the connection
Calls: read_plink -> read.table -> file
In addition: Warning message:
In file(file, "rt") :
cannot open file './LDREF/1000G.EUR..bim': No such file or directory
Execution halted
which I assume arises because there wasn't a chromosome defined.
Any help would be appreciated.
Thanks!
and without the loop ? does it work ?
Thanks for the tip on readability- It works fine without the loop.
and what is the shell ? it's not bash because {1..2..1} is not a bash syntax.
using 'echo', what is the output of ?
I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
I assume you checked if the file
'./LDREF/1000G.EUR..bim'
exists?The
..
looks a bit strange, so I guess--ref_ld_chr ./LDREF/1000G.EUR.
should be changed to--ref_ld_chr ./LDREF/1000G.EUR