Mercurial > repos > sblanck > mpagenomics_wrappers
diff selection.py @ 5:af4f63f27c77 draft
planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
author | sblanck |
---|---|
date | Wed, 08 Apr 2020 15:34:17 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/selection.py Wed Apr 08 15:34:17 2020 +0000 @@ -0,0 +1,38 @@ +import os +import sys +import subprocess +import shutil + +def main(): + + input_file=sys.argv[1] + tmp_dir=sys.argv[4] + script_dir=os.path.dirname(os.path.abspath(__file__)) + plot=sys.argv[11] + pdffigures=sys.argv[13] + outputlog=sys.argv[14] + log=sys.argv[15] + user=sys.argv[16] + package=sys.argv[17] + + iFile=open(input_file,'r') + dataSetLine=iFile.readline() + dataset=dataSetLine.split("\t")[1] + iFile.close() + + if (outputlog=="TRUE"): + errfile=open(log,'w') + else: + errfile=open(os.path.join(tmp_dir,"errfile.log"),'w') + + retcode=subprocess.call(["Rscript", os.path.join(script_dir,"selection.R"), dataset, sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6], sys.argv[7], sys.argv[8], sys.argv[9], sys.argv[10], sys.argv[11], sys.argv[12],sys.argv[16],package], stdout = errfile, stderr = errfile) + + if (plot=="TRUE"): + shutil.copy(os.path.join(tmp_dir,"mpagenomics",user,"Rplots.pdf"), pdffigures) + + errfile.close() + + sys.exit(retcode) + +if __name__ == "__main__": + main()