annotate query_db.py @ 12:37cde8134c6a draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
author iuc
date Sat, 19 Jun 2021 14:16:06 +0000
parents 69b08fc9557c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
1 #!/usr/bin/env python
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
2
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
3 from __future__ import print_function
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
4
12
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
5 import math
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
6 import re
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
7 import sqlite3 as sqlite
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
8 import sys
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
9
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
10
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
11 TABLE_QUERY = \
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
12 """
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
13 SELECT name, sql
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
14 FROM sqlite_master
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
15 WHERE type='table'
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
16 ORDER BY name
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
17 """
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
18
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
19
12
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
20 def msg(e):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
21 print(e, file=sys.stderr)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
22
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
23
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
24 def regex_match(expr, item):
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
25 return re.match(expr, item) is not None
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
26
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
27
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
28 def regex_search(expr, item):
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
29 return re.search(expr, item) is not None
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
30
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
31
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
32 def regex_sub(expr, replace, item):
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
33 return re.sub(expr, replace, item)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
34
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
35
12
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
36 def math_acos(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
37 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
38 return math.acos(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
39 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
40 msg('acos(%s): %s' % (x, ve))
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
41 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
42
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
43
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
44 def math_acosh(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
45 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
46 return math.acosh(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
47 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
48 msg(f'acosh({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
49 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
50
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
51
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
52 def math_asin(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
53 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
54 return math.asin(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
55 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
56 msg(f'asin({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
57 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
58
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
59
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
60 def math_asinh(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
61 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
62 return math.asinh(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
63 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
64 msg(f'asinh({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
65 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
66
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
67
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
68 def math_atan(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
69 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
70 return math.atan(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
71 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
72 msg(f'atan({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
73 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
74
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
75
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
76 def math_atanh(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
77 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
78 return math.atanh(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
79 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
80 msg(f'atanh({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
81 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
82
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
83
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
84 def math_atan2(x, y):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
85 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
86 return math.atan2(x, y)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
87 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
88 msg(f'atan2({x}, {y}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
89 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
90
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
91
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
92 def math_ceil(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
93 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
94 return math.ceil(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
95 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
96 msg(f'ceil({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
97 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
98
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
99
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
100 def math_cos(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
101 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
102 return math.cos(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
103 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
104 msg(f'cos({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
105 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
106
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
107
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
108 def math_cosh(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
109 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
110 return math.cosh(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
111 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
112 msg(f'cosh({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
113 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
114
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
115
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
116 def math_degrees(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
117 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
118 return math.degrees(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
119 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
120 msg(f'degrees({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
121 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
122
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
123
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
124 def math_exp(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
125 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
126 return math.exp(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
127 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
128 msg(f'exp({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
129 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
130
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
131
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
132 def math_expm1(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
133 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
134 return math.expm1(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
135 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
136 msg(f'expm1({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
137 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
138
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
139
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
140 def math_fabs(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
141 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
142 return math.fabs(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
143 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
144 msg(f'fabs({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
145 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
146
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
147
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
148 def math_floor(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
149 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
150 return math.floor(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
151 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
152 msg(f'floor({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
153 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
154
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
155
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
156 def math_fmod(x, y):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
157 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
158 return math.fmod(x, y)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
159 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
160 msg(f'fmod({x}, {y}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
161 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
162
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
163
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
164 def math_blog(b, x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
165 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
166 return math.log(b, x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
167 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
168 msg(f'log({b}, {x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
169 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
170
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
171
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
172 def math_log(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
173 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
174 return math.log(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
175 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
176 msg(f'log({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
177 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
178
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
179
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
180 def math_log10(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
181 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
182 return math.log10(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
183 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
184 msg(f'log10({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
185 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
186
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
187
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
188 def math_log1p(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
189 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
190 return math.log1p(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
191 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
192 msg(f'log1p({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
193 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
194
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
195
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
196 def math_log2(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
197 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
198 return math.log2(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
199 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
200 msg(f'log2({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
201 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
202
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
203
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
204 def math_mod(x, y):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
205 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
206 return x % y
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
207 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
208 msg(f'mod({x}, {y}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
209 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
210
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
211
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
212 def math_pow(x, y):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
213 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
214 return math.pow(x, y)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
215 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
216 msg(f'pow({x}, {y}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
217 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
218
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
219
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
220 def math_radians(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
221 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
222 return math.radians(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
223 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
224 msg(f'radians({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
225 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
226
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
227
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
228 def math_sin(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
229 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
230 return math.sin(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
231 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
232 msg(f'sin({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
233 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
234
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
235
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
236 def math_sinh(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
237 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
238 return math.sinh(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
239 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
240 msg(f'sinh({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
241 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
242
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
243
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
244 def math_sqrt(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
245 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
246 return math.sqrt(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
247 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
248 msg(f'sqrt({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
249 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
250
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
251
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
252 def math_tan(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
253 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
254 return math.tan(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
255 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
256 msg(f'tan({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
257 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
258
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
259
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
260 def math_tanh(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
261 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
262 return math.tanh(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
263 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
264 msg(f'tanh({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
265 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
266
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
267
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
268 def math_trunc(x):
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
269 try:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
270 return math.trunc(x)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
271 except ValueError as ve:
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
272 msg(f'trunc({x}): {ve}')
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
273 return None
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
274
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
275
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
276 def get_connection(sqlitedb_path, addfunctions=True):
12
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
277 sqlite.enable_callback_tracebacks(addfunctions)
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
278 conn = sqlite.connect(sqlitedb_path)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
279 if addfunctions:
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
280 conn.create_function("re_match", 2, regex_match)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
281 conn.create_function("re_search", 2, regex_search)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
282 conn.create_function("re_sub", 3, regex_sub)
12
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
283 conn.create_function("acos", 1, math_acos)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
284 conn.create_function("acosh", 1, math_acosh)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
285 conn.create_function("asin", 1, math_asin)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
286 conn.create_function("asinh", 1, math_asinh)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
287 conn.create_function("atan", 1, math_atan)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
288 conn.create_function("atanh", 1, math_atanh)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
289 conn.create_function("atan2", 2, math_atan2)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
290 conn.create_function("ceil", 1, math_ceil)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
291 conn.create_function("cos", 1, math_cos)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
292 conn.create_function("cosh", 1, math_cosh)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
293 conn.create_function("degrees", 1, math_degrees)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
294 conn.create_function("exp", 1, math_exp)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
295 conn.create_function("expm1", 1, math_expm1)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
296 conn.create_function("fabs", 1, math_fabs)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
297 conn.create_function("floor", 1, math_floor)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
298 conn.create_function("fmod", 2, math_fmod)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
299 conn.create_function("log", 1, math_log)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
300 conn.create_function("log", 2, math_blog)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
301 conn.create_function("log10", 1, math_log10)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
302 conn.create_function("log2", 1, math_log2)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
303 conn.create_function("log1p", 1, math_log1p)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
304 conn.create_function("mod", 2, math_mod)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
305 conn.create_function("pow", 2, math_pow)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
306 conn.create_function("radians", 1, math_radians)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
307 conn.create_function("sin", 1, math_sin)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
308 conn.create_function("sinh", 1, math_sinh)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
309 conn.create_function("sqrt", 1, math_sqrt)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
310 conn.create_function("tan", 1, math_tan)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
311 conn.create_function("tanh", 1, math_tanh)
37cde8134c6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 4fd70e184fca17ad430c30eb286127c4a198ef11"
iuc
parents: 9
diff changeset
312 conn.create_function("trunc", 1, math_trunc)
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
313 return conn
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
314
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
315
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
316 def describe_tables(conn, outputFile):
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
317 try:
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
318 c = conn.cursor()
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
319 tables_query = TABLE_QUERY
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
320 rslt = c.execute(tables_query).fetchall()
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
321 for table, sql in rslt:
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
322 print("Table %s:" % table, file=outputFile)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
323 try:
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
324 col_query = 'SELECT * FROM %s LIMIT 0' % table
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
325 cur = conn.cursor().execute(col_query)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
326 cols = [col[0] for col in cur.description]
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
327 print(" Columns: %s" % cols, file=outputFile)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
328 except Exception as exc:
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
329 print("Warning: %s" % exc, file=sys.stderr)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
330 except Exception as e:
9
69b08fc9557c "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit daa9af57fe07ee83a45ddc9f855716f9d14a8e12"
iuc
parents: 4
diff changeset
331 exit('describe_tables Error: %s' % (e))
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
332 exit(0)
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
333
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
334
1
cd2a99849f8b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 81f69ad5f39223059c40501e55ac777d3feca845
iuc
parents: 0
diff changeset
335 def run_query(conn, query, outputFile, no_header=False, comment_char='#'):
0
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
336 cur = conn.cursor()
6fbd9d25ceef planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 74915fc9cee746bbce1c4b507e13231259de177d
iuc
parents:
diff changeset
337 results = cur.execute(query)
4
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
338 if outputFile is not None:
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
339 if not no_header:
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
340 outputFile.write("%s%s\n" % (comment_char, '\t'.join(
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
341 [str(col[0]) for col in cur.description])))
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
342 for i, row in enumerate(results):
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
343 outputFile.write("%s\n" % '\t'.join(
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
344 [str(val) if val is not None else '' for val in row]))
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
345 else:
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
346 conn.commit()
fe7be5634ab3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 6a362345c31764c28bb6328da1f0d81ef8f35d40
iuc
parents: 1
diff changeset
347 return results