Hi all,
I am creating a QIIME2 plugin similar to the DADA2 plugin, however when I install my plugin the R script is executed as though it is a python script, this of course results in errors as it is not valid python code.
Here is a small example of what I am referring to.
The directory structure is as follows:
test-r/
run_test.R
setup.py
the contents of setup.py
are:
from setuptools import setup
setup(
name='q2-test-r',
scripts=['run_test.R'],
entry_points={
'qiime2.plugins':
['q2-phylofactor=q2_phylofactor.plugin_setup:plugin']
},
)
and the contents of run_test.R
are:
#!/usr/bin/env Rscript
R.version
I installed the package pip install -e .
and when I run the script:
$run_test.R
Traceback (most recent call last):
File "/Users/jc33/miniconda3/envs/qiime2-dev/bin/run_test.R", line 6, in <module>
exec(compile(open(__file__).read(), __file__, 'exec'))
File "/Users/jc33/dev/test-r/run_test.R", line 3, in <module>
R.version
NameError: name 'R' is not defined
This works as expected when I run it with:
Rscript run_test.R
Though this is obviously a contrived sample the behavior is identical in the actual plugin I am developing. In the plugin the R script is called from within a python script using subprocess
, but in both cases it is being run as though it is a Python script.
The DADA2 plugin works with no issues, so I am clearly missing something, however I am totally stumped as to what that is. Any help is much appreciated.