Mercurial > repos > devteam > column_maker
changeset 10:aff5135563c6 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/column_maker commit 06a92568f3409b035fd8a08725db20933d8d15e6
author | iuc |
---|---|
date | Thu, 22 Aug 2024 08:25:44 +0000 |
parents | 6595517c2dd8 |
children | |
files | column_maker.py column_maker.xml test-data/column_maker_out5.interval |
diffstat | 3 files changed, 145 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/column_maker.py Thu Jul 28 15:28:30 2022 +0000 +++ b/column_maker.py Thu Aug 22 08:25:44 2024 +0000 @@ -13,12 +13,61 @@ import sys # Functions that may be used in the compute expression from math import ( # noqa: F401 + acos, + acosh, + asin, + asinh, + atan, + atan2, + atanh, + cbrt, ceil, + comb, + copysign, + cos, + cosh, + degrees, + dist, + erf, + erfc, exp, + exp2, + expm1, + fabs, + factorial, floor, + fmod, + frexp, + fsum, + gamma, + gcd, + hypot, + inf, + isclose, + isfinite, + isinf, + isnan, + isqrt, + ldexp, + lgamma, log, log10, + log1p, + log2, + modf, + nextafter, + perm, + pi, + pow, + prod, + remainder, + sin, sqrt, + tan, + tanh, + tau, + trunc, + ulp, ) from numpy import format_float_positional @@ -121,10 +170,10 @@ 'lambda fields: [from_str(s, t) for s, t in zip(fields, [%s])]' % args.column_types ) -except Exception as e: +except Exception as err: sys.exit( 'While parsing column types, the following problem occured: "%s"' - % e + % err ) # Get and parse actions @@ -150,11 +199,19 @@ # COL_NAME is required with the --header option and specifies the name of the # new column; without --header, any COL_NAME gets ignored. operators = 'is|not|or|and' -builtin_and_math_functions = ( +builtin_functions = ( 'abs|all|any|ascii|bin|bool|chr|complex|divmod|float|format|hex|int|len|' - 'list|map|max|min|oct|ord|pow|range|reversed|round|set|sorted|str|sum|type|' - 'log|log10|exp|sqrt|ceil|floor' + 'list|map|max|min|oct|ord|pow|range|reversed|round|set|sorted|str|sum|type' ) + +math_functions = ( + 'acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|comb|copysign|cos|cosh|degrees|' + 'dist|erf|erfc|exp|exp2|expm1|fabs|factorial|floor|fmod|frexp|fsum|gamma|gcd|' + 'hypot|inf|isclose|isfinite|isinf|isnan|isqrt|ldexp|lgamma|log|log10|log1p|' + 'log2|modf|nextafter|perm|pi|pow|prod|remainder|sin|' + 'sqrt|tan|tanh|tau|trunc|ulp' +) +builtin_and_math_functions = builtin_functions + '|' + math_functions imported_numpy_function = 'format_float_positional' string_and_list_methods = [ name for name in dir('') + dir([]) if not name.startswith('_') @@ -171,6 +228,7 @@ for ac in actions: try: expr_string, col_add_spec, new_col_name = ac.split(';') + print(expr_string) except ValueError: sys.exit( 'Invalid Action: "%s". '
--- a/column_maker.xml Thu Jul 28 15:28:30 2022 +0000 +++ b/column_maker.xml Thu Aug 22 08:25:44 2024 +0000 @@ -1,4 +1,4 @@ -<tool id="Add_a_column1" name="Compute" version="2.0"> +<tool id="Add_a_column1" name="Compute" version="2.1" profile="23.0"> <description>on rows</description> <macros> <xml name="compute_repeat"> @@ -34,8 +34,8 @@ </xml> </macros> <requirements> - <requirement type="package" version="3.8">python</requirement> - <requirement type="package" version="1.23.1">numpy</requirement> + <requirement type="package" version="3.12">python</requirement> + <requirement type="package" version="2.1.0">numpy</requirement> </requirements> <command detect_errors="aggressive"><![CDATA[ python '$__tool_directory__/column_maker.py' @@ -193,6 +193,11 @@ </repeat> <output name="out_file1" file="column_maker_out4.tab" /> </test> + <test> + <param name="cond" value="cos(pi)+sin(tau)*c2"/> + <param name="input" value="1.bed" ftype="bed" /> + <output name="out_file1" file="column_maker_out5.interval"/> + </test> <!-- Test list column type in input --> <test> <param name="input" value="bed12.bed" ftype="bed12" /> @@ -311,13 +316,13 @@ - The following built-in Python functions are available for use in expressions:: - abs | all | any | ascii | bin | bool | chr | ceil | complex | divmod - - exp | float | floor | format | hex | int | len | list | log | log10 + abs | all | any | ascii | bin | bool | chr | complex | divmod | float | format | hex | int | len | list + map | max | min | oct | ord | pow | range | reversed | round | set | sorted | str | sum | type - list | map | max | min | oct | ord | pow | range | reversed - - round | set | sorted | sqrt | str | sum | type + acos | acosh | asin | asinh | atan | atan2 | atanh | cbrt | ceil | comb | copysign | cos | cosh | degrees + dist | erf | erfc | exp | exp2 | expm1 | fabs | factorial | floor | fmod | frexp | fsum | gamma | gcd + hypot | inf | isclose | isfinite | isinf | isnan | isqrt | ldexp | lgamma | log | log10 | log1p | log2 + modf | nextafter | perm | pow | prod | remainder | sin | sqrt | tan | tanh | tau | trunc | ulp - In addition the numpy function ``format_float_positional`` is available to control the formatting of floating point numbers. @@ -434,5 +439,7 @@ **Replacement value**: `.` ]]></help> - <citations /> + <citations> + <citation type="doi">10.1093/nar/gkae410</citation> + </citations> </tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/column_maker_out5.interval Thu Aug 22 08:25:44 2024 +0000 @@ -0,0 +1,65 @@ +chr1 147962192 147962580 CCDS989.1_cds_0_0_chr1_147962193_r 0 - -1.000000036240285 +chr1 147984545 147984630 CCDS990.1_cds_0_0_chr1_147984546_f 0 + -1.00000003624576 +chr1 148078400 148078582 CCDS993.1_cds_0_0_chr1_148078401_r 0 - -1.0000000362687478 +chr1 148185136 148185276 CCDS996.1_cds_0_0_chr1_148185137_f 0 + -1.0000000362948904 +chr10 55251623 55253124 CCDS7248.1_cds_0_0_chr10_55251624_r 0 - -1.0000000135327447 +chr11 116124407 116124501 CCDS8374.1_cds_0_0_chr11_116124408_r 0 - -1.0000000284422768 +chr11 116206508 116206563 CCDS8377.1_cds_0_0_chr11_116206509_f 0 + -1.0000000284623856 +chr11 116211733 116212337 CCDS8378.1_cds_0_0_chr11_116211734_r 0 - -1.0000000284636654 +chr11 1812377 1812407 CCDS7726.1_cds_0_0_chr11_1812378_f 0 + -1.0000000004439042 +chr12 38440094 38440321 CCDS8736.1_cds_0_0_chr12_38440095_r 0 - -1.0000000094151076 +chr13 112381694 112381953 CCDS9526.1_cds_0_0_chr13_112381695_f 0 + -1.0000000275255763 +chr14 98710240 98712285 CCDS9949.1_cds_0_0_chr14_98710241_r 0 - -1.000000024177036 +chr15 41486872 41487060 CCDS10096.1_cds_0_0_chr15_41486873_r 0 - -1.000000010161353 +chr15 41673708 41673857 CCDS10097.1_cds_0_0_chr15_41673709_f 0 + -1.0000000102071147 +chr15 41679161 41679250 CCDS10098.1_cds_0_0_chr15_41679162_r 0 - -1.0000000102084503 +chr15 41826029 41826196 CCDS10101.1_cds_0_0_chr15_41826030_f 0 + -1.0000000102444224 +chr16 142908 143003 CCDS10397.1_cds_0_0_chr16_142909_f 0 + -1.0000000000350024 +chr16 179963 180135 CCDS10401.1_cds_0_0_chr16_179964_r 0 - -1.0000000000440783 +chr16 244413 244681 CCDS10402.1_cds_0_0_chr16_244414_f 0 + -1.000000000059864 +chr16 259268 259383 CCDS10403.1_cds_0_0_chr16_259269_r 0 - -1.0000000000635023 +chr18 23786114 23786321 CCDS11891.1_cds_0_0_chr18_23786115_r 0 - -1.0000000058259177 +chr18 59406881 59407046 CCDS11985.1_cds_0_0_chr18_59406882_f 0 + -1.0000000145504893 +chr18 59455932 59456337 CCDS11986.1_cds_0_0_chr18_59455933_r 0 - -1.0000000145625034 +chr18 59600586 59600754 CCDS11988.1_cds_0_0_chr18_59600587_f 0 + -1.0000000145979333 +chr19 59068595 59069564 CCDS12866.1_cds_0_0_chr19_59068596_f 0 + -1.000000014467633 +chr19 59236026 59236146 CCDS12872.1_cds_0_0_chr19_59236027_r 0 - -1.0000000145086418 +chr19 59297998 59298008 CCDS12877.1_cds_0_0_chr19_59297999_f 0 + -1.0000000145238206 +chr19 59302168 59302288 CCDS12878.1_cds_0_0_chr19_59302169_r 0 - -1.000000014524842 +chr2 118288583 118288668 CCDS2120.1_cds_0_0_chr2_118288584_f 0 + -1.000000028972347 +chr2 118394148 118394202 CCDS2121.1_cds_0_0_chr2_118394149_r 0 - -1.000000028998203 +chr2 220190202 220190242 CCDS2441.1_cds_0_0_chr2_220190203_f 0 + -1.0000000539310452 +chr2 220229609 220230869 CCDS2443.1_cds_0_0_chr2_220229610_r 0 - -1.0000000539406972 +chr20 33330413 33330423 CCDS13249.1_cds_0_0_chr20_33330414_r 0 - -1.0000000081635967 +chr20 33513606 33513792 CCDS13255.1_cds_0_0_chr20_33513607_f 0 + -1.0000000082084661 +chr20 33579500 33579527 CCDS13256.1_cds_0_0_chr20_33579501_r 0 - -1.0000000082246054 +chr20 33593260 33593348 CCDS13257.1_cds_0_0_chr20_33593261_f 0 + -1.0000000082279756 +chr21 32707032 32707192 CCDS13614.1_cds_0_0_chr21_32707033_f 0 + -1.0000000080109124 +chr21 32869641 32870022 CCDS13615.1_cds_0_0_chr21_32869642_r 0 - -1.00000000805074 +chr21 33321040 33322012 CCDS13620.1_cds_0_0_chr21_33321041_f 0 + -1.000000008161301 +chr21 33744994 33745040 CCDS13625.1_cds_0_0_chr21_33744995_r 0 - -1.0000000082651397 +chr22 30120223 30120265 CCDS13897.1_cds_0_0_chr22_30120224_f 0 + -1.000000007377327 +chr22 30160419 30160661 CCDS13898.1_cds_0_0_chr22_30160420_r 0 - -1.0000000073871722 +chr22 30665273 30665360 CCDS13901.1_cds_0_0_chr22_30665274_f 0 + -1.0000000075108257 +chr22 30939054 30939266 CCDS13903.1_cds_0_0_chr22_30939055_r 0 - -1.0000000075778828 +chr5 131424298 131424460 CCDS4149.1_cds_0_0_chr5_131424299_f 0 + -1.0000000321896692 +chr5 131556601 131556672 CCDS4151.1_cds_0_0_chr5_131556602_r 0 - -1.0000000322220741 +chr5 131621326 131621419 CCDS4152.1_cds_0_0_chr5_131621327_f 0 + -1.0000000322379272 +chr5 131847541 131847666 CCDS4155.1_cds_0_0_chr5_131847542_r 0 - -1.0000000322933338 +chr6 108299600 108299744 CCDS5061.1_cds_0_0_chr6_108299601_r 0 - -1.0000000265257516 +chr6 108594662 108594687 CCDS5063.1_cds_0_0_chr6_108594663_f 0 + -1.0000000265980211 +chr6 108640045 108640151 CCDS5064.1_cds_0_0_chr6_108640046_r 0 - -1.0000000266091367 +chr6 108722976 108723115 CCDS5067.1_cds_0_0_chr6_108722977_f 0 + -1.0000000266294489 +chr7 113660517 113660685 CCDS5760.1_cds_0_0_chr7_113660518_f 0 + -1.0000000278387977 +chr7 116512159 116512389 CCDS5771.1_cds_0_0_chr7_116512160_r 0 - -1.0000000285372486 +chr7 116714099 116714152 CCDS5773.1_cds_0_0_chr7_116714100_f 0 + -1.0000000285867094 +chr7 116945541 116945787 CCDS5774.1_cds_0_0_chr7_116945542_r 0 - -1.0000000286433965 +chr8 118881131 118881317 CCDS6324.1_cds_0_0_chr8_118881132_r 0 - -1.0000000291174793 +chr9 128764156 128764189 CCDS6914.1_cds_0_0_chr9_128764157_f 0 + -1.0000000315381223 +chr9 128787519 128789136 CCDS6915.1_cds_0_0_chr9_128787520_r 0 - -1.0000000315438446 +chr9 128882427 128882523 CCDS6917.1_cds_0_0_chr9_128882428_f 0 + -1.0000000315670903 +chr9 128937229 128937445 CCDS6919.1_cds_0_0_chr9_128937230_r 0 - -1.0000000315805129 +chrX 122745047 122745924 CCDS14606.1_cds_0_0_chrX_122745048_f 0 + -1.0000000300638658 +chrX 152648964 152649196 CCDS14733.1_cds_0_0_chrX_152648965_r 0 - -1.000000037388213 +chrX 152691446 152691471 CCDS14735.1_cds_0_0_chrX_152691447_f 0 + -1.0000000373986182 +chrX 152694029 152694263 CCDS14736.1_cds_0_0_chrX_152694030_r 0 - -1.0000000373992508