annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
1 import os
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
2 import sys
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
3 import subprocess
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
4 import shutil
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
5
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
6 def main():
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
7
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
8 input_file=sys.argv[1]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
9 tmp_dir=sys.argv[4]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
10 script_dir=os.path.dirname(os.path.abspath(__file__))
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
11 plot=sys.argv[11]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
12 pdffigures=sys.argv[13]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
13 outputlog=sys.argv[14]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
14 log=sys.argv[15]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
15 user=sys.argv[16]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
16 package=sys.argv[17]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
17
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
18 iFile=open(input_file,'r')
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
19 dataSetLine=iFile.readline()
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
20 dataset=dataSetLine.split("\t")[1]
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
21 iFile.close()
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
22
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
23 if (outputlog=="TRUE"):
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
24 errfile=open(log,'w')
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
25 else:
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
26 errfile=open(os.path.join(tmp_dir,"errfile.log"),'w')
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
27
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
28 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)
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
29
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
30 if (plot=="TRUE"):
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
31 shutil.copy(os.path.join(tmp_dir,"mpagenomics",user,"Rplots.pdf"), pdffigures)
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
32
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
33 errfile.close()
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
34
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
35 sys.exit(retcode)
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
36
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
37 if __name__ == "__main__":
af4f63f27c77 planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 11d660a2de749dae548b2fae0dd81f9f2b2c4b4f
sblanck
parents:
diff changeset
38 main()