Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pfb_to_zip/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .pfb_to_zip import PFBExporter
19 changes: 11 additions & 8 deletions pfb_to_zip/pfb_to_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def initialize(self):
tmp_path = Path(self.analysis_path + "/analysis")
if not tmp_path.exists():
tmp_path.mkdir()

tmp_path = os.path.join("./", "repo")
tmp_path = os.path.join(self.tmp_folder, "repo")
if Path(tmp_path).exists():
rmtree(tmp_path, ignore_errors=False, onerror=None)

Expand Down Expand Up @@ -247,18 +246,22 @@ def setup_and_run_analysis(self, consortium=None):
return

# TODO check R is installed
#check if R is installed
try:
command = 'which RScript'
cmd_output = subprocess.check_output(command, shell=True, text=True).rstrip('\n')
cmd_output = subprocess.check_output('which Rscript', shell=True, text=True).rstrip('\n')
except subprocess.CalledProcessError as grepexc:
print("error code", grepexc.returncode, grepexc.output)
print("R is not installed / not found!")
return
print("Rscript is not installed or found in Path!")
try:
cmd_output = subprocess.check_output('which RScript', shell=True, text=True).rstrip('\n')
except subprocess.CalledProcessError as grepexc:
print("error code", grepexc.returncode, grepexc.output)
print("R is not installed / not found!")
return

current_dir = str(Path( __file__ ).parent.absolute())
# subprocess.call(cmd_output + " --vanilla ./repo/INRG/PCDC_To_INRG_Data_Transformation.R", shell=True)
subprocess.call ([cmd_output, "--vanilla", "./repo/INRG/PCDC_To_INRG_Data_Transformation.R", os.path.join(current_dir, "repo/"), self.analysis_path + "/tsvs/", self.analysis_path + "/analysis/"])

subprocess.call ([cmd_output, "--vanilla", f"{self.tmp_folder}/repo/INRG/PCDC_To_INRG_Data_Transformation.R", os.path.join(self.tmp_folder, "repo/"), self.analysis_path + "/tsvs/", self.analysis_path + "/analysis/"])

# TODO cd to consortia subfolder
# TODO run the script with the input and output parameters
Expand Down