Mercurial > repos > recetox > biotransformer
annotate wrapper_biotransformer.py @ 3:6080aee7c4f6 draft
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
author | recetox |
---|---|
date | Wed, 13 Jan 2021 11:17:53 +0000 |
parents | 362a66a3889c |
children | 77f693bb14ac |
rev | line source |
---|---|
1
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
1 import subprocess |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
2 import sys |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
3 import tempfile |
3
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
4 import re |
1
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
5 import pandas |
3
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
6 |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
7 from openbabel import openbabel, pybel |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
8 openbabel.obErrorLog.StopLogging() |
1
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
9 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
10 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
11 # function for translating inchi to smiles |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
12 def InchiToSmiles(df): |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
13 sm = [] |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
14 for item in df['InChI']: |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
15 tmp = pybel.readstring("inchi", item) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
16 sm.append(tmp.write("smi")) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
17 return(sm) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
18 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
19 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
20 executable = ["biotransformer"] |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
21 # executable_r = ["Rscript", "inchi_to_smiles.r"] |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
22 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
23 argv = sys.argv[1:] |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
24 if "-icsv" in argv: |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
25 icsv = argv.pop(argv.index("-icsv") + 1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
26 argv.remove("-icsv") |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
27 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
28 if "-ocsv" not in argv: |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
29 sys.stderr.write("excpected -ocsv parameter\n") |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
30 sys.exit(1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
31 ocsv = argv.pop(argv.index("-ocsv") + 1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
32 argv.remove("-ocsv") |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
33 ocsv_dup = argv.pop(argv.index("-ocsvDup") + 1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
34 argv.remove("-ocsvDup") |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
35 ocsv_dup2 = argv.pop(argv.index("-ocsvDup2") + 1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
36 argv.remove("-ocsvDup2") |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
37 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
38 in_df = pandas.read_csv(icsv, header=None) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
39 out_df1 = pandas.DataFrame() # all results |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
40 out_df2 = pandas.DataFrame() # filtered results based on 6 columns |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
41 out_df3 = pandas.DataFrame() # filtered results based on 3 columns |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
42 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
43 tmp2 = pandas.DataFrame() |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
44 tmp3 = pandas.DataFrame() |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
45 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
46 smList1 = [] # list with smiles string |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
47 smList2 = [] |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
48 smList3 = [] |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
49 for _, (smiles,) in in_df.iterrows(): |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
50 with tempfile.NamedTemporaryFile() as out: |
3
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
51 print("Working on compound: " + smiles) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
52 if not re.search(r'\.', smiles): |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
53 subprocess.run(executable + argv + ["-ismi", smiles] + ["-ocsv", out.name]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
54 try: |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
55 tmp2 = pandas.read_csv(out.name) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
56 tmp3 = pandas.read_csv(out.name) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
57 tmp2.drop_duplicates(inplace=True, subset=["InChI", "InChIKey", "Synonyms", "Molecular formula", "Major Isotope Mass", "ALogP"]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
58 tmp3.drop_duplicates(inplace=True, subset=["Molecular formula", "Major Isotope Mass", "ALogP"]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
59 smList2.append([smiles] * tmp2.shape[0]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
60 smList3.append([smiles] * tmp3.shape[0]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
61 out_df1 = pandas.concat([out_df1, pandas.read_csv(out.name)]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
62 out_df2 = pandas.concat([out_df2, tmp2]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
63 out_df3 = pandas.concat([out_df3, tmp3]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
64 smList1.append([smiles] * pandas.read_csv(out.name).shape[0]) |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
65 except pandas.errors.EmptyDataError: |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
66 continue |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
67 else: |
6080aee7c4f6
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 5cdd2628a1a509b3e0ccc599eaab63d664bf031a"
recetox
parents:
1
diff
changeset
|
68 print("ERROR: Input compound cannot be a mixture.") |
1
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
69 smList1 = sum(smList1, []) # merge sublists into one list |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
70 smList2 = sum(smList2, []) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
71 smList3 = sum(smList3, []) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
72 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
73 out_df1.insert(0, "SMILES query", smList1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
74 out_df1.drop_duplicates(inplace=True) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
75 out_df1.insert(1, "SMILES target", InchiToSmiles(out_df1)) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
76 out_df1.to_csv(ocsv) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
77 |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
78 out_df2.insert(0, "SMILES query", smList2) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
79 out_df3.insert(0, "SMILES query", smList3) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
80 out_df2.drop_duplicates(inplace=True) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
81 out_df3.drop_duplicates(inplace=True) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
82 out_df2.insert(1, "SMILES target", InchiToSmiles(out_df2)) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
83 out_df3.insert(1, "SMILES target", InchiToSmiles(out_df3)) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
84 # out_df.drop_duplicates(inplace=True, subset=["InChI", "InChIKey", "Synonyms", "Molecular formula", "Major Isotope Mass", "ALogP"]) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
85 out_df2.to_csv(ocsv_dup) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
86 out_df3.to_csv(ocsv_dup2) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
87 else: |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
88 # code = subprocess.run(executable + argv).returncode |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
89 # sys.exit(code) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
90 subprocess.run(executable + argv) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
91 smile = argv.pop(argv.index("-ismi") + 1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
92 tmp = pandas.DataFrame() |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
93 out = argv.pop(argv.index("-ocsv") + 1) |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
94 tmp = pandas.read_csv(out) # reads created output file |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
95 tmp.insert(0, "SMILES query", smile) # add SMILES string for query |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
96 tmp.insert(1, "SMILES target", InchiToSmiles(tmp)) # add SMILES string for target |
362a66a3889c
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/biotransformer commit 833817386e90cca9ac4737e6857fcaf672f2a011"
recetox
parents:
diff
changeset
|
97 tmp.to_csv(out) |