Mercurial > repos > recetox > table_scipy_interpolate
annotate table_pandas_transform.py @ 0:0112f08c95ed draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
| author | recetox | 
|---|---|
| date | Wed, 29 Jan 2025 15:36:02 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 
0
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
1 import argparse | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
2 import logging | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
3 from typing import Callable, List, Tuple | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
4 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
5 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
6 import numpy as np | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
7 import pandas as pd | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
8 from utils import LoadDataAction, SplitColumnIndicesAction, StoreOutputAction | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
9 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
10 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
11 # Define the available transformations | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
12 TRANSFORMATIONS = { | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
13 "log": np.log, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
14 "log10": np.log10, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
15 "ln": np.log, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
16 "sqrt": np.sqrt, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
17 "exp": np.exp, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
18 "abs": np.abs, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
19 "floor": np.floor, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
20 "ceil": np.ceil, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
21 } | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
22 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
23 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
24 def apply_transformation( | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
25 df: pd.DataFrame, columns: List[int], transformation: str | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
26 ) -> pd.DataFrame: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
27 """ | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
28 Apply the specified transformation to the given columns of the dataframe. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
29 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
30 Parameters: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
31 df (pd.DataFrame): The input dataframe. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
32 columns (List[int]): The 0-based indices of the columns to transform. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
33 transformation (str): The transformation to apply. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
34 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
35 Returns: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
36 pd.DataFrame: The dataframe with the transformation applied. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
37 """ | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
38 try: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
39 transform_func = TRANSFORMATIONS[transformation] | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
40 for column_index in columns: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
41 column_name = df.columns[column_index] | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
42 df[column_name] = transform_func(df[column_name]) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
43 return df | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
44 except KeyError as e: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
45 logging.error(f"Invalid transformation: {e}") | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
46 raise | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
47 except IndexError as e: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
48 logging.error(f"Invalid column index: {e}") | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
49 raise | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
50 except Exception as e: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
51 logging.error(f"Error applying transformation: {e}") | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
52 raise | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
53 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
54 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
55 def main( | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
56 input_dataset: pd.DataFrame, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
57 columns: List[int], | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
58 transformation: str, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
59 output_dataset: Tuple[Callable[[pd.DataFrame, str], None], str], | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
60 ) -> None: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
61 """ | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
62 Main function to load the dataset, apply the transformation, and save the result. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
63 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
64 Parameters: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
65 input_dataset (pd.DataFrame): The input dataset. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
66 columns (List[int]): The 0-based indices of the columns to transform. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
67 transformation (str): The transformation to apply. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
68 output_dataset (Tuple[Callable[[pd.DataFrame, str], None], str]): The output dataset and its file extension. | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
69 """ | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
70 try: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
71 df = apply_transformation(input_dataset, columns, transformation) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
72 write_func, file_path = output_dataset | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
73 write_func(df, file_path) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
74 except Exception as e: | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
75 logging.error(f"Error in main function: {e}") | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
76 raise | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
77 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
78 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
79 if __name__ == "__main__": | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
80 logging.basicConfig(level=logging.INFO) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
81 parser = argparse.ArgumentParser( | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
82 description="Apply mathematical transformations to dataframe columns." | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
83 ) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
84 parser.add_argument( | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
85 "--input_dataset", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
86 nargs=2, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
87 action=LoadDataAction, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
88 required=True, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
89 help="Path to the input dataset and its file extension (csv, tsv, parquet)", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
90 ) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
91 parser.add_argument( | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
92 "--columns", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
93 action=SplitColumnIndicesAction, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
94 required=True, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
95 help="Comma-separated list of 1-based indices of the columns to apply the transformation on", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
96 ) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
97 parser.add_argument( | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
98 "--transformation", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
99 type=str, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
100 choices=TRANSFORMATIONS.keys(), | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
101 required=True, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
102 help="Transformation to apply", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
103 ) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
104 parser.add_argument( | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
105 "--output_dataset", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
106 nargs=2, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
107 action=StoreOutputAction, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
108 required=True, | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
109 help="Path to the output dataset and its file extension (csv, tsv, parquet)", | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
110 ) | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
111 | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
112 args = parser.parse_args() | 
| 
 
0112f08c95ed
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
 
recetox 
parents:  
diff
changeset
 | 
113 main(args.input_dataset, args.columns, args.transformation, args.output_dataset) | 
