Repository 'table_pandas_arithmetics'
hg clone https://toolshed.g2.bx.psu.edu/repos/recetox/table_pandas_arithmetics

Changeset 0:e6d5fee8c7a6 (2025-01-29)
Next changeset 1:d4bacc06365e (2025-01-29)
Commit message:
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
added:
macros.xml
table_pandas_arithmetics.py
table_pandas_arithmetics.xml
table_pandas_rename_column.py
table_pandas_rename_columns_regex.py
table_pandas_transform.py
table_scipy_interpolate.py
test-data/arithmetics/query_divide_ri.tabular
test-data/interpolate/query_interpolate_rt.tabular
test-data/query.tabular
test-data/reference.txt
test-data/rename/reference_both_renamed.tabular
test-data/rename/reference_rt_renamed.tabular
test-data/transform/query_log.tabular
utils.py
b
diff -r 000000000000 -r e6d5fee8c7a6 macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,54 @@
+<macros>
+    <token name="@PANDAS_VERSION@">2.2.3</token>
+    <token name="@SCIPY_VERSION@">1.14.1</token>
+
+    <xml name="requirement_pandas_pyarrow">
+        <requirement type="package" version="@PANDAS_VERSION@">pandas</requirement>
+        <requirement type="package" version="18.0.0">pyarrow</requirement>
+    </xml>
+
+    <xml name="creator">
+        <creator>
+            <person
+                givenName="Kristina"
+                familyName="Gomoryova"
+                url="https://github.com/KristinaGomoryova"
+                identifier="0000-0003-4407-3917" />
+            <person
+                givenName="Helge"
+                familyName="Hecht"
+                url="https://github.com/hechth"
+                identifier="0000-0001-6744-996X" />
+            <organization
+                url="https://www.recetox.muni.cz/"
+                email="GalaxyToolsDevelopmentandDeployment@space.muni.cz"
+                name="RECETOX MUNI" />
+        </creator>
+    </xml>
+
+    <xml name="regex_sanitizer">
+        <sanitizer>
+            <valid initial="string.ascii_letters,string.digits">
+                <add value="^"/>
+                <add value="$"/>
+                <add value="("/>
+                <add value=")"/>
+                <add value="|"/>
+                <add value="?"/>
+                <add value="*"/>
+                <add value="+"/>
+                <add value="{"/>
+                <add value="}"/>
+                <add value="\"/>
+                <add value="["/>
+                <add value="]"/>
+                <add value="."/>
+                <add value=","/>
+                <add value="_"/>
+                <add value="-"/>
+            </valid>
+        </sanitizer>
+        <validator type="empty_field" />
+        <validator type="regex" message="Pattern must not end with backslash.">.*[^\\]$</validator>
+    </xml>
+</macros>
\ No newline at end of file
b
diff -r 000000000000 -r e6d5fee8c7a6 table_pandas_arithmetics.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/table_pandas_arithmetics.py Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,106 @@
+import argparse
+import logging
+from typing import List, Tuple
+
+
+import numpy as np
+import pandas as pd
+from utils import LoadDataAction, SplitColumnIndicesAction, StoreOutputAction
+
+
+# Constants for operations
+OPERATIONS = {
+    "mul": np.multiply,
+    "sub": np.subtract,
+    "div": np.divide,
+    "add": np.add,
+    "pow": np.power,
+}
+
+
+def perform_operation(df: pd.DataFrame, column_indices: List[int], operation: str, operand: float):
+    """
+    Perform the specified arithmetic operation on the given columns of the dataframe.
+
+    Parameters:
+    df (pd.DataFrame): The input dataframe.
+    column_indices (list): The 0-based indices of the columns to perform the operation on.
+    operation (str): The arithmetic operation to perform.
+    operand (float): The operand for the arithmetic operation.
+
+    Returns:
+    pd.DataFrame: The dataframe with the operation applied.
+    """
+    for column_index in column_indices:
+        column_name = df.columns[column_index]
+        df[column_name] = OPERATIONS[operation](df[column_name], operand)
+    return df
+
+
+def main(input_dataset: pd.DataFrame, column_indices: List[int], operation: str, operand: float, output_dataset: Tuple[callable, str]):
+    """
+    Main function to load the dataset, perform the operation, and save the result.
+
+    Parameters:
+    input_dataset (tuple): The input dataset and its file extension.
+    column_indices (list): The 0-based indices of the columns to perform the operation on.
+    operation (str): The arithmetic operation to perform.
+    operand (float): The operand for the arithmetic operation.
+    output_dataset (tuple): The output dataset and its file extension.
+    """
+    try:
+        df = perform_operation(input_dataset, column_indices, operation, operand)
+        write_func, file_path = output_dataset
+        write_func(df, file_path)
+    except Exception as e:
+        logging.error(f"Error in main function: {e}")
+        raise
+
+
+if __name__ == "__main__":
+    logging.basicConfig(level=logging.INFO)
+    parser = argparse.ArgumentParser(
+        description="Perform arithmetic operations on dataframe columns."
+    )
+    parser.add_argument(
+        "--input_dataset",
+        nargs=2,
+        action=LoadDataAction,
+        required=True,
+        help="Path to the input dataset and its file extension (csv, tsv, parquet)",
+    )
+    parser.add_argument(
+        "--columns",
+        action=SplitColumnIndicesAction,
+        required=True,
+        help="Comma-separated list of 1-based indices of the columns to perform the operation on",
+    )
+    parser.add_argument(
+        "--operation",
+        type=str,
+        choices=OPERATIONS.keys(),
+        required=True,
+        help="Arithmetic operation to perform",
+    )
+    parser.add_argument(
+        "--operand",
+        type=float,
+        required=True,
+        help="Operand for the arithmetic operation",
+    )
+    parser.add_argument(
+        "--output_dataset",
+        nargs=2,
+        action=StoreOutputAction,
+        required=True,
+        help="Path to the output dataset and its file extension (csv, tsv, parquet)",
+    )
+
+    args = parser.parse_args()
+    main(
+        args.input_dataset,
+        args.columns,
+        args.operation,
+        args.operand,
+        args.output_dataset,
+    )
b
diff -r 000000000000 -r e6d5fee8c7a6 table_pandas_arithmetics.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/table_pandas_arithmetics.xml Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,72 @@
+<tool id="table_pandas_arithmetics" name="table arithmetics" version="@PANDAS_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01" license="MIT">
+    <description>perform arithmetic operations on a dataframe column</description>
+    <macros>
+        <import>macros.xml</import>
+        <token name="@VERSION_SUFFIX@">0</token>
+    </macros>
+    <requirements>
+        <expand macro="requirement_pandas_pyarrow"/>
+    </requirements>
+    <required_files>
+        <include path="table_pandas_arithmetics.py" />
+        <include path="utils.py" />
+    </required_files>
+    <expand macro="creator" />
+    <command detect_errors="exit_code"><![CDATA[
+        python3 '$__tool_directory__/table_pandas_arithmetics.py' 
+            --input_dataset '$input_dataset' '$input_dataset.ext' 
+            --column '$column' 
+            --operation '$operation' 
+            --operand '$operand' 
+            --output_dataset '$output_dataset' '$output_dataset.ext'
+    ]]></command>
+    <inputs>
+        <param name="input_dataset" type="data" format="csv,tsv,tabular,parquet" label="Input Dataset" help="The input dataset in CSV, TSV, tabular, or Parquet format."/>
+        <param name="column" type="data_column" data_ref="input_dataset" use_header_names="true" label="Column" help="The column from the dataset to perform the arithmetic operation on."/>
+        <param name="operation" type="select" label="Arithmetic Operation" help="The arithmetic operation to perform on the selected column. Choose from Multiply, Subtract, Divide, Add, or Power.">
+            <option value="mul">Multiply</option>
+            <option value="sub">Subtract</option>
+            <option value="div">Divide</option>
+            <option value="add">Add</option>
+            <option value="pow">Power</option>
+        </param>
+        <param name="operand" type="float" label="Operand" help="The operand value to use in the arithmetic operation. This value will be applied to each element in the selected column."/>
+    </inputs>
+    <outputs>
+        <data name="output_dataset" format_source="input_dataset" label="${tool.name} on ${on_string}">
+            <change_format>
+                <when input="input_dataset.ext" value="tsv" format="tabular" />
+            </change_format>
+        </data>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input_dataset" value="query.tabular" ftype="tabular"/>
+            <param name="column" value="3"/>
+            <param name="operation" value="div"/>
+            <param name="operand" value="100"/>
+            <output name="output_dataset" file="arithmetics/query_divide_ri.tabular" ftype="tabular"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+This tool performs arithmetic operations on a specified column of a dataframe.
+Supported operations are: multiply, subtract, divide, add, and power.
+
+Inputs
+------
+
+- **Input Dataset**: The input dataset in CSV, TSV, tabular, or Parquet format.
+- **Column**: The column from the dataset to perform the arithmetic operation on. Select the column by its header name.
+- **Arithmetic Operation**: The arithmetic operation to perform on the selected column. Choose from Multiply, Subtract, Divide, Add, or Power.
+- **Operand**: The operand value to use in the arithmetic operation. This value will be applied to each element in the selected column.
+
+Outputs
+-------
+
+- **Output Dataset**: The output dataset with the arithmetic operation applied to the specified column.
+        ]]></help>
+    <citations>
+        <citation type="doi">10.5281/zenodo.3509134</citation>
+        <citation type="doi">10.25080/Majora-92bf1922-00a</citation>
+    </citations>
+</tool>
\ No newline at end of file
b
diff -r 000000000000 -r e6d5fee8c7a6 table_pandas_rename_column.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/table_pandas_rename_column.py Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,76 @@
+import argparse
+import logging
+from typing import Tuple
+
+import pandas as pd
+from utils import KeyValuePairsAction, LoadDataAction, StoreOutputAction
+
+
+def rename_columns(df: pd.DataFrame, rename_dict: dict):
+    """
+    Rename columns in the dataframe based on the provided dictionary.
+
+    Parameters:
+    df (pd.DataFrame): The input dataframe.
+    rename_dict (dict): A dictionary with 1-based column index as key and new column name as value.
+
+    Returns:
+    pd.DataFrame: The dataframe with renamed columns.
+    """
+    try:
+        rename_map = {
+            df.columns[key - 1]: value for key, value in rename_dict.items()
+        }  # Convert 1-based index to column name
+        return df.rename(columns=rename_map)
+    except IndexError as e:
+        logging.error(f"Invalid column index: {e}")
+        raise
+    except Exception as e:
+        logging.error(f"Error renaming columns: {e}")
+        raise
+
+
+def main(input_dataset: pd.DataFrame, rename_dict: dict, output_dataset: Tuple[callable, str]):
+    """
+    Main function to load the dataset, rename columns, and save the result.
+
+    Parameters:
+    input_dataset (pd.DataFrame): The input dataset .
+    rename_dict (dict): A dictionary with 1-based column index as key and new column name as value.
+    output_dataset (tuple): The function to store the output dataset and the path.
+    """
+    try:
+        write_func, file_path = output_dataset
+        write_func(rename_columns(input_dataset, rename_dict), file_path)
+    except Exception as e:
+        logging.error(f"Error in main function: {e}")
+        raise
+
+
+if __name__ == "__main__":
+    logging.basicConfig(level=logging.INFO)
+    parser = argparse.ArgumentParser(description="Rename columns in a dataframe.")
+    parser.add_argument(
+        "--input_dataset",
+        nargs=2,
+        action=LoadDataAction,
+        required=True,
+        help="Path to the input dataset and its file extension (csv, tsv, parquet)",
+    )
+    parser.add_argument(
+        "--rename",
+        nargs="+",
+        action=KeyValuePairsAction,
+        required=True,
+        help="List of key=value pairs with 1-based column index as key and new column name as value",
+    )
+    parser.add_argument(
+        "--output_dataset",
+        nargs=2,
+        action=StoreOutputAction,
+        required=True,
+        help="Path to the output dataset and its file extension (csv, tsv, parquet)",
+    )
+
+    args = parser.parse_args()
+    main(args.input_dataset, args.rename, args.output_dataset)
b
diff -r 000000000000 -r e6d5fee8c7a6 table_pandas_rename_columns_regex.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/table_pandas_rename_columns_regex.py Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,117 @@
+import argparse
+import logging
+import re
+from typing import List, Tuple
+
+
+import pandas as pd
+from utils import LoadDataAction, SplitColumnIndicesAction, StoreOutputAction
+
+
+def rename_columns(
+    df: pd.DataFrame, columns: List[int], regex_check: str, regex_replace: str
+) -> pd.DataFrame:
+    """
+    Rename columns in the dataframe based on regex patterns.
+
+    Parameters:
+    df (pd.DataFrame): The input dataframe.
+    columns (List[int]): The 0-based indices of the columns to rename.
+    regex_check (str): The regex pattern to check for in column names.
+    regex_replace (str): The regex pattern to replace with in column names.
+
+    Returns:
+    pd.DataFrame: The dataframe with renamed columns.
+    """
+    try:
+        # Map column indices to column names
+        column_names = [df.columns[i] for i in columns]
+
+        # Rename the specified columns using the regex patterns
+        for column in column_names:
+            if column in df.columns:
+                new_column_name = re.sub(regex_check, regex_replace, column)
+                df.rename(columns={column: new_column_name}, inplace=True)
+        return df
+    except IndexError as e:
+        logging.error(f"Invalid column index: {e}")
+        raise
+    except re.error as e:
+        logging.error(f"Invalid regex pattern: {e}")
+        raise
+    except Exception as e:
+        logging.error(f"Error renaming columns: {e}")
+        raise
+
+
+def main(
+    input_dataset: pd.DataFrame,
+    columns: List[int],
+    regex_check: str,
+    regex_replace: str,
+    output_dataset: Tuple[callable, str],
+) -> None:
+    """
+    Main function to load the dataset, rename columns, and save the result.
+
+    Parameters:
+    input_dataset (Tuple[pd.DataFrame, str]): The input dataset and its file extension.
+    columns (List[int]): The 0-based indices of the columns to rename.
+    regex_check (str): The regex pattern to check for in column names.
+    regex_replace (str): The regex pattern to replace with in column names.
+    output_dataset (Tuple[callable, str]): The output dataset and its file extension.
+    """
+    try:
+        write_func, file_path = output_dataset
+        write_func(rename_columns(input_dataset, columns, regex_check, regex_replace), file_path)
+    except Exception as e:
+        logging.error(f"Error in main function: {e}")
+        raise
+
+
+if __name__ == "__main__":
+    logging.basicConfig(level=logging.INFO)
+    parser = argparse.ArgumentParser(
+        description="Apply regex-based transformations on multiple dataframe columns."
+    )
+    parser.add_argument(
+        "--input_dataset",
+        nargs=2,
+        action=LoadDataAction,
+        required=True,
+        help="Path to the input dataset and its file extension (csv, tsv, parquet)",
+    )
+    parser.add_argument(
+        "--columns",
+        action=SplitColumnIndicesAction,
+        required=True,
+        help="Comma-separated list of 1-based indices of the columns to apply the transformation on",
+    )
+    parser.add_argument(
+        "--regex_check",
+        type=str,
+        required=True,
+        help="Regex pattern to check for in column names",
+    )
+    parser.add_argument(
+        "--regex_replace",
+        type=str,
+        required=True,
+        help="Regex pattern to replace with in column names",
+    )
+    parser.add_argument(
+        "--output_dataset",
+        nargs=2,
+        action=StoreOutputAction,
+        required=True,
+        help="Path to the output dataset and its file extension (csv, tsv, parquet)",
+    )
+
+    args = parser.parse_args()
+    main(
+        args.input_dataset,
+        args.columns,
+        args.regex_check,
+        args.regex_replace,
+        args.output_dataset,
+    )
b
diff -r 000000000000 -r e6d5fee8c7a6 table_pandas_transform.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/table_pandas_transform.py Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,113 @@
+import argparse
+import logging
+from typing import Callable, List, Tuple
+
+
+import numpy as np
+import pandas as pd
+from utils import LoadDataAction, SplitColumnIndicesAction, StoreOutputAction
+
+
+# Define the available transformations
+TRANSFORMATIONS = {
+    "log": np.log,
+    "log10": np.log10,
+    "ln": np.log,
+    "sqrt": np.sqrt,
+    "exp": np.exp,
+    "abs": np.abs,
+    "floor": np.floor,
+    "ceil": np.ceil,
+}
+
+
+def apply_transformation(
+    df: pd.DataFrame, columns: List[int], transformation: str
+) -> pd.DataFrame:
+    """
+    Apply the specified transformation to the given columns of the dataframe.
+
+    Parameters:
+    df (pd.DataFrame): The input dataframe.
+    columns (List[int]): The 0-based indices of the columns to transform.
+    transformation (str): The transformation to apply.
+
+    Returns:
+    pd.DataFrame: The dataframe with the transformation applied.
+    """
+    try:
+        transform_func = TRANSFORMATIONS[transformation]
+        for column_index in columns:
+            column_name = df.columns[column_index]
+            df[column_name] = transform_func(df[column_name])
+        return df
+    except KeyError as e:
+        logging.error(f"Invalid transformation: {e}")
+        raise
+    except IndexError as e:
+        logging.error(f"Invalid column index: {e}")
+        raise
+    except Exception as e:
+        logging.error(f"Error applying transformation: {e}")
+        raise
+
+
+def main(
+    input_dataset: pd.DataFrame,
+    columns: List[int],
+    transformation: str,
+    output_dataset: Tuple[Callable[[pd.DataFrame, str], None], str],
+) -> None:
+    """
+    Main function to load the dataset, apply the transformation, and save the result.
+
+    Parameters:
+    input_dataset (pd.DataFrame): The input dataset.
+    columns (List[int]): The 0-based indices of the columns to transform.
+    transformation (str): The transformation to apply.
+    output_dataset (Tuple[Callable[[pd.DataFrame, str], None], str]): The output dataset and its file extension.
+    """
+    try:
+        df = apply_transformation(input_dataset, columns, transformation)
+        write_func, file_path = output_dataset
+        write_func(df, file_path)
+    except Exception as e:
+        logging.error(f"Error in main function: {e}")
+        raise
+
+
+if __name__ == "__main__":
+    logging.basicConfig(level=logging.INFO)
+    parser = argparse.ArgumentParser(
+        description="Apply mathematical transformations to dataframe columns."
+    )
+    parser.add_argument(
+        "--input_dataset",
+        nargs=2,
+        action=LoadDataAction,
+        required=True,
+        help="Path to the input dataset and its file extension (csv, tsv, parquet)",
+    )
+    parser.add_argument(
+        "--columns",
+        action=SplitColumnIndicesAction,
+        required=True,
+        help="Comma-separated list of 1-based indices of the columns to apply the transformation on",
+    )
+    parser.add_argument(
+        "--transformation",
+        type=str,
+        choices=TRANSFORMATIONS.keys(),
+        required=True,
+        help="Transformation to apply",
+    )
+    parser.add_argument(
+        "--output_dataset",
+        nargs=2,
+        action=StoreOutputAction,
+        required=True,
+        help="Path to the output dataset and its file extension (csv, tsv, parquet)",
+    )
+
+    args = parser.parse_args()
+    main(args.input_dataset, args.columns, args.transformation, args.output_dataset)
b
diff -r 000000000000 -r e6d5fee8c7a6 table_scipy_interpolate.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/table_scipy_interpolate.py Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,177 @@
+import argparse
+import logging
+from typing import Callable, Tuple
+
+
+import numpy as np
+import pandas as pd
+from scipy.interpolate import Akima1DInterpolator, CubicSpline, PchipInterpolator
+from utils import LoadDataAction, StoreOutputAction
+
+
+class InterpolationModelAction(argparse.Action):
+    def __call__(
+        self,
+        parser: argparse.ArgumentParser,
+        namespace: argparse.Namespace,
+        values: str,
+        option_string: str = None,
+    ) -> None:
+        """
+        Custom argparse action to map interpolation method names to their corresponding functions.
+
+        Parameters:
+        parser (argparse.ArgumentParser): The argument parser instance.
+        namespace (argparse.Namespace): The namespace to hold the parsed values.
+        values (str): The interpolation method name.
+        option_string (str): The option string.
+        """
+        interpolators = {
+            "linear": np.interp,
+            "cubic": CubicSpline,
+            "pchip": PchipInterpolator,
+            "akima": Akima1DInterpolator,
+        }
+        if values not in interpolators:
+            raise ValueError(f"Unknown interpolation method: {values}")
+        setattr(namespace, self.dest, interpolators[values])
+
+
+def interpolate_data(
+    reference: pd.DataFrame,
+    query: pd.DataFrame,
+    x_col: int,
+    y_col: int,
+    xnew_col: int,
+    model: Callable,
+    output_dataset: Tuple[Callable[[pd.DataFrame, str], None], str],
+) -> None:
+    """
+    Interpolate data using the specified model.
+
+    Parameters:
+    reference (pd.DataFrame): The reference dataset.
+    query (pd.DataFrame): The query dataset.
+    x_col (int): The 1-based index of the x column in the reference dataset.
+    y_col (int): The 1-based index of the y column in the reference dataset.
+    xnew_col (int): The 1-based index of the x column in the query dataset.
+    model (Callable): The interpolation model to use.
+    output_dataset (Tuple[Callable[[pd.DataFrame, str], None], str]): The output dataset and its file extension.
+    """
+    try:
+        # Convert 1-based indices to 0-based indices
+        x_col_name = reference.columns[x_col - 1]
+        y_col_name = reference.columns[y_col - 1]
+        xnew_col_name = query.columns[xnew_col - 1]
+
+        # Check if y_col already exists in the query dataset
+        if y_col_name in query.columns:
+            raise ValueError(
+                f"Column '{y_col_name}' already exists in the query dataset."
+            )
+
+        if model == np.interp:
+            query[y_col_name] = model(
+                query[xnew_col_name], reference[x_col_name], reference[y_col_name]
+            )
+        else:
+            model_instance = model(reference[x_col_name], reference[y_col_name])
+            query[y_col_name] = model_instance(query[xnew_col_name]).astype(float)
+
+        write_func, file_path = output_dataset
+        write_func(query, file_path)
+    except Exception as e:
+        logging.error(f"Error in interpolate_data function: {e}")
+        raise
+
+
+def main(
+    reference_dataset: pd.DataFrame,
+    query_dataset: pd.DataFrame,
+    x_col: int,
+    y_col: int,
+    xnew_col: int,
+    model: Callable,
+    output_dataset: Tuple[Callable[[pd.DataFrame, str], None], str],
+) -> None:
+    """
+    Main function to load the datasets, perform interpolation, and save the result.
+
+    Parameters:
+    reference_dataset (Tuple[pd.DataFrame, str]): The reference dataset and its file extension.
+    query_dataset (Tuple[pd.DataFrame, str]): The query dataset and its file extension.
+    x_col (int): The 1-based index of the x column in the reference dataset.
+    y_col (int): The 1-based index of the y column in the reference dataset.
+    xnew_col (int): The 1-based index of the x column in the query dataset.
+    model (Callable): The interpolation model to use.
+    output_dataset (Tuple[Callable[[pd.DataFrame, str], None], str]): The output dataset and its file extension.
+    """
+    try:
+        interpolate_data(reference_dataset, query_dataset, x_col, y_col, xnew_col, model, output_dataset)
+    except Exception as e:
+        logging.error(f"Error in main function: {e}")
+        raise
+
+
+if __name__ == "__main__":
+    logging.basicConfig(level=logging.INFO)
+    parser = argparse.ArgumentParser(
+        description="Interpolate data using various methods."
+    )
+    parser.add_argument(
+        "--reference_dataset",
+        nargs=2,
+        action=LoadDataAction,
+        required=True,
+        help="Path to the reference dataset and its file extension (csv, tsv, parquet)",
+    )
+    parser.add_argument(
+        "--query_dataset",
+        nargs=2,
+        action=LoadDataAction,
+        required=True,
+        help="Path to the query dataset and its file extension (csv, tsv, parquet)",
+    )
+    parser.add_argument(
+        "--x_col",
+        type=int,
+        required=True,
+        help="1-based index of the x column in the reference dataset",
+    )
+    parser.add_argument(
+        "--y_col",
+        type=int,
+        required=True,
+        help="1-based index of the y column in the reference dataset",
+    )
+    parser.add_argument(
+        "--xnew_col",
+        type=int,
+        required=True,
+        help="1-based index of the x column in the query dataset",
+    )
+    parser.add_argument(
+        "--model",
+        type=str,
+        action=InterpolationModelAction,
+        required=True,
+        help="Interpolation model to use (linear, cubic, pchip, akima)",
+    )
+    parser.add_argument(
+        "--output_dataset",
+        nargs=2,
+        action=StoreOutputAction,
+        required=True,
+        help="Path to the output dataset and its file extension (csv, tsv, parquet)",
+    )
+
+    args = parser.parse_args()
+    main(
+        args.reference_dataset,
+        args.query_dataset,
+        args.x_col,
+        args.y_col,
+        args.xnew_col,
+        args.model,
+        args.output_dataset,
+    )
b
diff -r 000000000000 -r e6d5fee8c7a6 test-data/arithmetics/query_divide_ri.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/arithmetics/query_divide_ri.tabular Wed Jan 29 15:35:42 2025 +0000
b
b'@@ -0,0 +1,266 @@\n+precursor_mz\tlicense\tretention_index\tauthors\tcompound_name\n+362.18381\tCC BY-NC\t25.207359999999998\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 2\n+489.1889\tCC BY-NC\t25.66364\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_TMS derivative\n+434.22321\tCC BY-NC\t24.15476\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_3TMS\n+362.18381\tCC BY-NC\t24.75613\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 1\n+136.05856\tCC BY-NC\t14.43328\tPrice et al., RECETOX, Masaryk University (CZ)\tMethylnicotinamide\n+261.06659\tCC BY-NC\t13.76073\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_2TMS\n+201.11786\tCC BY-NC\t12.92953\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_1TMS\n+194.06293\tCC BY-NC\t13.16816\tPrice et al., RECETOX, Masaryk University (CZ)\tNicotinic acid_1TMS\n+362.16293\tCC BY-NC\t16.64769\tPrice et al., RECETOX, Masaryk University (CZ)\tRibose_4TMS\n+342.13101\tCC BY-NC\t18.92004\tPrice et al., RECETOX, Masaryk University (CZ)\tSyringic acid_2TMS\n+367.16711\tCC BY-NC\t21.18982\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_3TMS\n+439.20303\tCC BY-NC\t21.750410000000002\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_4TMS\n+260.14963\tCC BY-NC\t12.829749999999999\tPrice et al., RECETOX, Masaryk University (CZ)\tLeucine_2TMS\n+458.17902\tCC BY-NC\t19.51021\tPrice et al., RECETOX, Masaryk University (CZ)\tGallic acid_4TMS\n+396.16028\tCC BY-NC\t21.313290000000002\tPrice et al., RECETOX, Masaryk University (CZ)\ttrans-Caffeic acid_3TMS\n+396.1604\tCC BY-NC\t19.7529\tPrice et al., RECETOX, Masaryk University (CZ)\tcis-Caffeic acid_3TMS\n+525.24902\tCC BY-NC\t20.717660000000002\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 1\n+579.297\tCC BY-NC\t20.81004\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 2\n+326.1362\tCC BY-NC\t17.61149\tPrice et al., RECETOX, Masaryk University (CZ)\t4-Hydroxy-3methoxyphenylacetic acid_2TMS\n+278.12305\tCC BY-NC\t13.17247\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycine_3TMS\n+270.12137\tCC BY-NC\t14.02643\tPrice et al., RECETOX, Masaryk University (CZ)\tThymine_2TMS\n+348.1713\tCC BY-NC\t16.58764\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_3TMS\n+368.1339\tCC BY-NC\t14.998520000000001\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_2TMS\n+420.21198\tCC BY-NC\t15.98743\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 1\n+420.21072\tCC BY-NC\t16.19979\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 2\n+320.15897\tCC BY-NC\t17.82981\tPrice et al., RECETOX, Masaryk University (CZ)\tAzelaic acid_2TMS\n+319.14154\tCC BY-NC\t19.60418\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_2TMS\n+245.10255\tCC BY-NC\t19.19926\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_1TMS\n+355.1398\tCC BY-NC\t21.19143\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_2TMS\n+426.17551\tCC BY-NC\t20.85942\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_3TMS\n+518.24091\tCC BY-NC\t19.00622\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_5TMS\n+446.20102\tCC BY-NC\t18.77684\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_4TMS\n+374.16168\tCC BY-NC\t20.65527\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_3TMS\n+252.10365\tCC BY-NC\t19.88727\tPrice et al., RECETOX, Masaryk University (CZ)\tTheobromine_1TMS\n+473.1601\tCC BY-NC\t23.10707\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose-6-phosphate_6TMS isomer 1\n+472.16409\tCC BY-NC\t23.324119999999997\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose-6-phosphate_6TMS isomer 2\n+434.21536\tCC BY-NC\t19.36412\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactitol_6TMS\n+422.21552\tCC BY-NC\t17.13998\tPrice et al., RECETOX, Masaryk University (CZ)\tRibitol_5TMS\n+363.17084\tCC BY-NC\t16.11723\tPrice et al., RECETOX, Masaryk University (CZ)\tGlutamic acid_3TMS spectra 2\n+273.12088\tCC BY-NC\t15.19766\tPrice et al., RECETOX, Masary'..b'Dehydrocholesterol_1TMS\n+271.08026\tCC BY-NC\t15.06984\tPrice et al., RECETOX, Masaryk University (CZ)\tSalicylic acid_2TMS\n+557.59625\tCC BY-NC\t26.84795\tPrice et al., RECETOX, Masaryk University (CZ)\tCytidine_5TMS\n+359.2977\tCC BY-NC\t22.35718\tPrice et al., RECETOX, Masaryk University (CZ)\tStearic acid_1TMS\n+279.13321\tCC BY-NC\t18.66714\tPrice et al., RECETOX, Masaryk University (CZ)\tAdenine_2TMS\n+466.22934\tCC BY-NC\t18.845039999999997\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactose_5TMS isomer 1\n+351.17252\tCC BY-NC\t19.25431\tPrice et al., RECETOX, Masaryk University (CZ)\tAdenine_3TMS\n+480.24384\tCC BY-NC\t19.07299\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactose_5TMS isomer 2\n+323.13168\tCC BY-NC\t17.99822\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_2TMS\n+238.07059\tCC BY-NC\t18.42755\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_1TMS\n+458.97305\tCC BY-NC\t17.83803\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Deoxyglucose_4TMS\n+359.11441\tCC BY-NC\t17.34565\tPrice et al., RECETOX, Masaryk University (CZ)\t2,3-Dihydroxybenzoic acid_3TMS\n+468.37845\tCC BY-NC\t30.53203\tPrice et al., RECETOX, Masaryk University (CZ)\tErgocalciferol_TMS\n+270.25577\tCC BY-NC\t19.25397\tPrice et al., RECETOX, Masaryk University (CZ)\tMethyl palmitate\n+259.07892\tCC BY-NC\t15.51845\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 2\n+256.1189\tCC BY-NC\t14.328589999999998\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 1\n+331.14514\tCC BY-NC\t15.26203\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_3TMS\n+466.22998\tCC BY-NC\t18.90842\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 1\n+448.21909\tCC BY-NC\t19.11034\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 2\n+349.15625\tCC BY-NC\t15.103800000000001\tPrice et al., RECETOX, Masaryk University (CZ)\tAspartic acid_3TMS isomer\n+502.42047\tCC BY-NC\t31.471149999999998\tPrice et al., RECETOX, Masaryk University (CZ)\talpha-Tocopherol_1TMS\n+502.332\tCC BY-NC\t22.50516\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_5TMS\n+423.76837\tCC BY-NC\t21.991439999999997\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_4TMS\n+255.11404\tCC BY-NC\t15.17806\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_2TMS\n+327.16107\tCC BY-NC\t16.21093\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_3TMS\n+462.2586\tCC BY-NC\t18.50448\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycylvaline_4TMS\n+280.11725\tCC BY-NC\t18.02407\tPrice et al., RECETOX, Masaryk University (CZ)\tHypoxanthine_2TMS\n+417.30649\tCC BY-NC\t28.51973\tPrice et al., RECETOX, Masaryk University (CZ)\tPregnenolone_1TMS\n+471.2048\tCC BY-NC\t20.88587\tPrice et al., RECETOX, Masaryk University (CZ)\tLevodopa_4TMS\n+224.08672\tCC BY-NC\t14.578409999999998\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Methoxybenzoic acid_1TMS\n+531.23712\tCC BY-NC\t26.733739999999997\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 1\n+557.9187\tCC BY-NC\t27.175990000000002\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 2\n+306.09992\tCC BY-NC\t16.441679999999998\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylaspartic acid_2TMS\n+322.14883\tCC BY-NC\t13.81929\tPrice et al., RECETOX, Masaryk University (CZ)\tThreonine_3TMS spectra 1\n+326.96603\tCC BY-NC\t16.46616\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 2\n+328.98157\tCC BY-NC\t16.21799\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 1\n+517.22162\tCC BY-NC\t26.81155\tPrice et al., RECETOX, Masaryk University (CZ)\tCytidine_4TMS\n+456.37826\tCC BY-NC\t32.60078\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydrocholesterol_1TMS\n+466.36206\tCC BY-NC\t32.89183\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydroergosterol_1TMS\n+454.36246\tCC BY-NC\t32.42543\tPrice et al., RECETOX, Masaryk University (CZ)\tCholestatrienol_1TMS\n+258.09448\tCC BY-NC\t13.040640000000002\tPrice et al., RECETOX, Masaryk University (CZ)\tProline_2TMS\n'
b
diff -r 000000000000 -r e6d5fee8c7a6 test-data/interpolate/query_interpolate_rt.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/interpolate/query_interpolate_rt.tabular Wed Jan 29 15:35:42 2025 +0000
b
b'@@ -0,0 +1,266 @@\n+precursor_mz\tlicense\tretention_index\tauthors\tcompound_name\tRT\n+362.18381\tCC BY-NC\t2520.736\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 2\t7.2481219634266925\n+489.1889\tCC BY-NC\t2566.364\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_TMS derivative\t7.337700496069004\n+434.22321\tCC BY-NC\t2415.476\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_3TMS\t6.949011804243075\n+362.18381\tCC BY-NC\t2475.613\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 1\t7.134617180165526\n+136.05856\tCC BY-NC\t1443.328\tPrice et al., RECETOX, Masaryk University (CZ)\tMethylnicotinamide\t3.3565019233430204\n+261.06659\tCC BY-NC\t1376.073\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_2TMS\t3.1220231604529958\n+201.11786\tCC BY-NC\t1292.953\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_1TMS\t2.8806192451019776\n+194.06293\tCC BY-NC\t1316.816\tPrice et al., RECETOX, Masaryk University (CZ)\tNicotinic acid_1TMS\t2.9467540450363083\n+362.16293\tCC BY-NC\t1664.769\tPrice et al., RECETOX, Masaryk University (CZ)\tRibose_4TMS\t4.366125473784941\n+342.13101\tCC BY-NC\t1892.004\tPrice et al., RECETOX, Masaryk University (CZ)\tSyringic acid_2TMS\t5.267193046945155\n+367.16711\tCC BY-NC\t2118.982\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_3TMS\t6.055099291874508\n+439.20303\tCC BY-NC\t2175.041\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_4TMS\t6.22383436145032\n+260.14963\tCC BY-NC\t1282.975\tPrice et al., RECETOX, Masaryk University (CZ)\tLeucine_2TMS\t2.853317974726836\n+458.17902\tCC BY-NC\t1951.021\tPrice et al., RECETOX, Masaryk University (CZ)\tGallic acid_4TMS\t5.511906403839568\n+396.16028\tCC BY-NC\t2131.329\tPrice et al., RECETOX, Masaryk University (CZ)\ttrans-Caffeic acid_3TMS\t6.091646562259711\n+396.1604\tCC BY-NC\t1975.29\tPrice et al., RECETOX, Masaryk University (CZ)\tcis-Caffeic acid_3TMS\t5.60867209847706\n+525.24902\tCC BY-NC\t2071.766\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 1\t5.920178866623973\n+579.297\tCC BY-NC\t2081.004\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 2\t5.946197806870793\n+326.1362\tCC BY-NC\t1761.149\tPrice et al., RECETOX, Masaryk University (CZ)\t4-Hydroxy-3methoxyphenylacetic acid_2TMS\t4.743092088606552\n+278.12305\tCC BY-NC\t1317.247\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycine_3TMS\t2.9479640752130774\n+270.12137\tCC BY-NC\t1402.643\tPrice et al., RECETOX, Masaryk University (CZ)\tThymine_2TMS\t3.2089452712858346\n+348.1713\tCC BY-NC\t1658.764\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_3TMS\t4.343192519565847\n+368.1339\tCC BY-NC\t1499.852\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_2TMS\t3.599296072071003\n+420.21198\tCC BY-NC\t1598.743\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 1\t4.094203337774629\n+420.21072\tCC BY-NC\t1619.979\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 2\t4.188056056713636\n+320.15897\tCC BY-NC\t1782.981\tPrice et al., RECETOX, Masaryk University (CZ)\tAzelaic acid_2TMS\t4.831474397390476\n+319.14154\tCC BY-NC\t1960.418\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_2TMS\t5.549998336897806\n+245.10255\tCC BY-NC\t1919.926\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_1TMS\t5.382843094675469\n+355.1398\tCC BY-NC\t2119.143\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_2TMS\t6.05557260906063\n+426.17551\tCC BY-NC\t2085.942\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_3TMS\t5.960108811368132\n+518.24091\tCC BY-NC\t1900.622\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_5TMS\t5.3025649872865355\n+446.20102\tCC BY-NC\t1877.684\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_4TMS\t5.209118259754561\n+374.16168\tCC BY-NC\t2065.527\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_3TMS\t5.90253865677221\n+252.10365\tCC BY-NC\t1988.727\tPrice et al., RECETOX, Masaryk University (CZ)\tTheobromine_1TMS\t5.65944936257908\n+473.1601\tCC BY'..b', RECETOX, Masaryk University (CZ)\tAdenine_3TMS\t5.405845315491951\n+480.24384\tCC BY-NC\t1907.299\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactose_5TMS isomer 2\t5.330207679514004\n+323.13168\tCC BY-NC\t1799.822\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_2TMS\t4.899286656426797\n+238.07059\tCC BY-NC\t1842.755\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_1TMS\t5.0698433745607865\n+458.97305\tCC BY-NC\t1783.803\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Deoxyglucose_4TMS\t4.834795956239019\n+359.11441\tCC BY-NC\t1734.565\tPrice et al., RECETOX, Masaryk University (CZ)\t2,3-Dihydroxybenzoic acid_3TMS\t4.63596156580473\n+468.37845\tCC BY-NC\t3053.203\tPrice et al., RECETOX, Masaryk University (CZ)\tErgocalciferol_TMS\t8.398530080914414\n+270.25577\tCC BY-NC\t1925.397\tPrice et al., RECETOX, Masaryk University (CZ)\tMethyl palmitate\t5.4057032730000225\n+259.07892\tCC BY-NC\t1551.845\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 2\t3.8615078611949776\n+256.1189\tCC BY-NC\t1432.859\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 1\t3.316630064434183\n+331.14514\tCC BY-NC\t1526.203\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_3TMS\t3.7295901788399397\n+466.22998\tCC BY-NC\t1890.842\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 1\t5.262449878940552\n+448.21909\tCC BY-NC\t1911.034\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 2\t5.345740866040592\n+349.15625\tCC BY-NC\t1510.38\tPrice et al., RECETOX, Masaryk University (CZ)\tAspartic acid_3TMS isomer\t3.6502666916040383\n+502.42047\tCC BY-NC\t3147.115\tPrice et al., RECETOX, Masaryk University (CZ)\talpha-Tocopherol_1TMS\t8.623829764397167\n+502.332\tCC BY-NC\t2250.516\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_5TMS\t6.452703139283529\n+423.76837\tCC BY-NC\t2199.144\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_4TMS\t6.297392320220081\n+255.11404\tCC BY-NC\t1517.806\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_2TMS\t3.6871602269074017\n+327.16107\tCC BY-NC\t1621.093\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_3TMS\t4.192763411699628\n+462.2586\tCC BY-NC\t1850.448\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycylvaline_4TMS\t5.1003411431856245\n+280.11725\tCC BY-NC\t1802.407\tPrice et al., RECETOX, Masaryk University (CZ)\tHypoxanthine_2TMS\t4.909637836313574\n+417.30649\tCC BY-NC\t2851.973\tPrice et al., RECETOX, Masaryk University (CZ)\tPregnenolone_1TMS\t7.95575589617099\n+471.2048\tCC BY-NC\t2088.587\tPrice et al., RECETOX, Masaryk University (CZ)\tLevodopa_4TMS\t5.967573368115994\n+224.08672\tCC BY-NC\t1457.841\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Methoxybenzoic acid_1TMS\t3.414214276291812\n+531.23712\tCC BY-NC\t2673.374\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 1\t7.548183869472435\n+557.9187\tCC BY-NC\t2717.599\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 2\t7.632038700986074\n+306.09992\tCC BY-NC\t1644.168\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylaspartic acid_2TMS\t4.286561210670023\n+322.14883\tCC BY-NC\t1381.929\tPrice et al., RECETOX, Masaryk University (CZ)\tThreonine_3TMS spectra 1\t3.140635678354363\n+326.96603\tCC BY-NC\t1646.616\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 2\t4.296171360077359\n+328.98157\tCC BY-NC\t1621.799\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 1\t4.19573688603876\n+517.22162\tCC BY-NC\t2681.155\tPrice et al., RECETOX, Masaryk University (CZ)\tCytidine_4TMS\t7.563697113127376\n+456.37826\tCC BY-NC\t3260.078\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydrocholesterol_1TMS\t9.045454406887803\n+466.36206\tCC BY-NC\t3289.183\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydroergosterol_1TMS\t9.160815942950672\n+454.36246\tCC BY-NC\t3242.543\tPrice et al., RECETOX, Masaryk University (CZ)\tCholestatrienol_1TMS\t8.972336003301246\n+258.09448\tCC BY-NC\t1304.064\tPrice et al., RECETOX, Masaryk University (CZ)\tProline_2TMS\t2.911226441931007\n'
b
diff -r 000000000000 -r e6d5fee8c7a6 test-data/query.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/query.tabular Wed Jan 29 15:35:42 2025 +0000
b
b'@@ -0,0 +1,266 @@\n+precursor_mz\tlicense\tretention_index\tauthors\tcompound_name\n+362.18381\tCC BY-NC\t2520.736\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 2\n+489.1889\tCC BY-NC\t2566.364\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_TMS derivative\n+434.22321\tCC BY-NC\t2415.476\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_3TMS\n+362.18381\tCC BY-NC\t2475.613\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 1\n+136.05856\tCC BY-NC\t1443.328\tPrice et al., RECETOX, Masaryk University (CZ)\tMethylnicotinamide\n+261.06659\tCC BY-NC\t1376.073\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_2TMS\n+201.11786\tCC BY-NC\t1292.953\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_1TMS\n+194.06293\tCC BY-NC\t1316.816\tPrice et al., RECETOX, Masaryk University (CZ)\tNicotinic acid_1TMS\n+362.16293\tCC BY-NC\t1664.769\tPrice et al., RECETOX, Masaryk University (CZ)\tRibose_4TMS\n+342.13101\tCC BY-NC\t1892.004\tPrice et al., RECETOX, Masaryk University (CZ)\tSyringic acid_2TMS\n+367.16711\tCC BY-NC\t2118.982\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_3TMS\n+439.20303\tCC BY-NC\t2175.041\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_4TMS\n+260.14963\tCC BY-NC\t1282.975\tPrice et al., RECETOX, Masaryk University (CZ)\tLeucine_2TMS\n+458.17902\tCC BY-NC\t1951.021\tPrice et al., RECETOX, Masaryk University (CZ)\tGallic acid_4TMS\n+396.16028\tCC BY-NC\t2131.329\tPrice et al., RECETOX, Masaryk University (CZ)\ttrans-Caffeic acid_3TMS\n+396.1604\tCC BY-NC\t1975.29\tPrice et al., RECETOX, Masaryk University (CZ)\tcis-Caffeic acid_3TMS\n+525.24902\tCC BY-NC\t2071.766\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 1\n+579.297\tCC BY-NC\t2081.004\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 2\n+326.1362\tCC BY-NC\t1761.149\tPrice et al., RECETOX, Masaryk University (CZ)\t4-Hydroxy-3methoxyphenylacetic acid_2TMS\n+278.12305\tCC BY-NC\t1317.247\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycine_3TMS\n+270.12137\tCC BY-NC\t1402.643\tPrice et al., RECETOX, Masaryk University (CZ)\tThymine_2TMS\n+348.1713\tCC BY-NC\t1658.764\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_3TMS\n+368.1339\tCC BY-NC\t1499.852\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_2TMS\n+420.21198\tCC BY-NC\t1598.743\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 1\n+420.21072\tCC BY-NC\t1619.979\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 2\n+320.15897\tCC BY-NC\t1782.981\tPrice et al., RECETOX, Masaryk University (CZ)\tAzelaic acid_2TMS\n+319.14154\tCC BY-NC\t1960.418\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_2TMS\n+245.10255\tCC BY-NC\t1919.926\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_1TMS\n+355.1398\tCC BY-NC\t2119.143\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_2TMS\n+426.17551\tCC BY-NC\t2085.942\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_3TMS\n+518.24091\tCC BY-NC\t1900.622\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_5TMS\n+446.20102\tCC BY-NC\t1877.684\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_4TMS\n+374.16168\tCC BY-NC\t2065.527\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_3TMS\n+252.10365\tCC BY-NC\t1988.727\tPrice et al., RECETOX, Masaryk University (CZ)\tTheobromine_1TMS\n+473.1601\tCC BY-NC\t2310.707\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose-6-phosphate_6TMS isomer 1\n+472.16409\tCC BY-NC\t2332.412\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose-6-phosphate_6TMS isomer 2\n+434.21536\tCC BY-NC\t1936.412\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactitol_6TMS\n+422.21552\tCC BY-NC\t1713.998\tPrice et al., RECETOX, Masaryk University (CZ)\tRibitol_5TMS\n+363.17084\tCC BY-NC\t1611.723\tPrice et al., RECETOX, Masaryk University (CZ)\tGlutamic acid_3TMS spectra 2\n+273.12088\tCC BY-NC\t1519.766\tPrice et al., RECETOX, Masaryk University (CZ)\tPyroglutamic acid_2TMS\n+285.13287\tCC BY-NC\t1528.459\t'..b'(CZ)\tAcetylserine_2TMS\n+456.37824\tCC BY-NC\t3220.533\tPrice et al., RECETOX, Masaryk University (CZ)\t7-Dehydrocholesterol_1TMS\n+271.08026\tCC BY-NC\t1506.984\tPrice et al., RECETOX, Masaryk University (CZ)\tSalicylic acid_2TMS\n+557.59625\tCC BY-NC\t2684.795\tPrice et al., RECETOX, Masaryk University (CZ)\tCytidine_5TMS\n+359.2977\tCC BY-NC\t2235.718\tPrice et al., RECETOX, Masaryk University (CZ)\tStearic acid_1TMS\n+279.13321\tCC BY-NC\t1866.714\tPrice et al., RECETOX, Masaryk University (CZ)\tAdenine_2TMS\n+466.22934\tCC BY-NC\t1884.504\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactose_5TMS isomer 1\n+351.17252\tCC BY-NC\t1925.431\tPrice et al., RECETOX, Masaryk University (CZ)\tAdenine_3TMS\n+480.24384\tCC BY-NC\t1907.299\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactose_5TMS isomer 2\n+323.13168\tCC BY-NC\t1799.822\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_2TMS\n+238.07059\tCC BY-NC\t1842.755\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_1TMS\n+458.97305\tCC BY-NC\t1783.803\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Deoxyglucose_4TMS\n+359.11441\tCC BY-NC\t1734.565\tPrice et al., RECETOX, Masaryk University (CZ)\t2,3-Dihydroxybenzoic acid_3TMS\n+468.37845\tCC BY-NC\t3053.203\tPrice et al., RECETOX, Masaryk University (CZ)\tErgocalciferol_TMS\n+270.25577\tCC BY-NC\t1925.397\tPrice et al., RECETOX, Masaryk University (CZ)\tMethyl palmitate\n+259.07892\tCC BY-NC\t1551.845\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 2\n+256.1189\tCC BY-NC\t1432.859\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 1\n+331.14514\tCC BY-NC\t1526.203\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_3TMS\n+466.22998\tCC BY-NC\t1890.842\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 1\n+448.21909\tCC BY-NC\t1911.034\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 2\n+349.15625\tCC BY-NC\t1510.38\tPrice et al., RECETOX, Masaryk University (CZ)\tAspartic acid_3TMS isomer\n+502.42047\tCC BY-NC\t3147.115\tPrice et al., RECETOX, Masaryk University (CZ)\talpha-Tocopherol_1TMS\n+502.332\tCC BY-NC\t2250.516\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_5TMS\n+423.76837\tCC BY-NC\t2199.144\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_4TMS\n+255.11404\tCC BY-NC\t1517.806\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_2TMS\n+327.16107\tCC BY-NC\t1621.093\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_3TMS\n+462.2586\tCC BY-NC\t1850.448\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycylvaline_4TMS\n+280.11725\tCC BY-NC\t1802.407\tPrice et al., RECETOX, Masaryk University (CZ)\tHypoxanthine_2TMS\n+417.30649\tCC BY-NC\t2851.973\tPrice et al., RECETOX, Masaryk University (CZ)\tPregnenolone_1TMS\n+471.2048\tCC BY-NC\t2088.587\tPrice et al., RECETOX, Masaryk University (CZ)\tLevodopa_4TMS\n+224.08672\tCC BY-NC\t1457.841\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Methoxybenzoic acid_1TMS\n+531.23712\tCC BY-NC\t2673.374\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 1\n+557.9187\tCC BY-NC\t2717.599\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 2\n+306.09992\tCC BY-NC\t1644.168\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylaspartic acid_2TMS\n+322.14883\tCC BY-NC\t1381.929\tPrice et al., RECETOX, Masaryk University (CZ)\tThreonine_3TMS spectra 1\n+326.96603\tCC BY-NC\t1646.616\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 2\n+328.98157\tCC BY-NC\t1621.799\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 1\n+517.22162\tCC BY-NC\t2681.155\tPrice et al., RECETOX, Masaryk University (CZ)\tCytidine_4TMS\n+456.37826\tCC BY-NC\t3260.078\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydrocholesterol_1TMS\n+466.36206\tCC BY-NC\t3289.183\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydroergosterol_1TMS\n+454.36246\tCC BY-NC\t3242.543\tPrice et al., RECETOX, Masaryk University (CZ)\tCholestatrienol_1TMS\n+258.09448\tCC BY-NC\t1304.064\tPrice et al., RECETOX, Masaryk University (CZ)\tProline_2TMS\n'
b
diff -r 000000000000 -r e6d5fee8c7a6 test-data/reference.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/reference.txt Wed Jan 29 15:35:42 2025 +0000
b
@@ -0,0 +1,29 @@
+RI RT
+1300 2.9
+1400 3.2
+1500 3.6
+1600 4.1
+1700 4.5
+1800 4.9
+1900 5.3
+2000 5.7
+2100 6.0
+2200 6.3
+2300 6.6
+2400 6.9
+2500 7.2
+2600 7.4
+2700 7.6
+2800 7.8
+2900 8.1
+3000 8.3
+3100 8.5
+3200 8.8
+3300 9.2
+3400 9.5
+3500 9.9
+3600 10.4
+3700 11.0
+3800 11.7
+3900 12.0
+4000 12.5
\ No newline at end of file
b
diff -r 000000000000 -r e6d5fee8c7a6 test-data/rename/reference_both_renamed.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/rename/reference_both_renamed.tabular Wed Jan 29 15:35:42 2025 +0000
b
@@ -0,0 +1,29 @@
+retention_index retention_time
+1300 2.9
+1400 3.2
+1500 3.6
+1600 4.1
+1700 4.5
+1800 4.9
+1900 5.3
+2000 5.7
+2100 6.0
+2200 6.3
+2300 6.6
+2400 6.9
+2500 7.2
+2600 7.4
+2700 7.6
+2800 7.8
+2900 8.1
+3000 8.3
+3100 8.5
+3200 8.8
+3300 9.2
+3400 9.5
+3500 9.9
+3600 10.4
+3700 11.0
+3800 11.7
+3900 12.0
+4000 12.5
b
diff -r 000000000000 -r e6d5fee8c7a6 test-data/rename/reference_rt_renamed.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/rename/reference_rt_renamed.tabular Wed Jan 29 15:35:42 2025 +0000
b
@@ -0,0 +1,29 @@
+RI retention_time
+1300 2.9
+1400 3.2
+1500 3.6
+1600 4.1
+1700 4.5
+1800 4.9
+1900 5.3
+2000 5.7
+2100 6.0
+2200 6.3
+2300 6.6
+2400 6.9
+2500 7.2
+2600 7.4
+2700 7.6
+2800 7.8
+2900 8.1
+3000 8.3
+3100 8.5
+3200 8.8
+3300 9.2
+3400 9.5
+3500 9.9
+3600 10.4
+3700 11.0
+3800 11.7
+3900 12.0
+4000 12.5
b
diff -r 000000000000 -r e6d5fee8c7a6 test-data/transform/query_log.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/transform/query_log.tabular Wed Jan 29 15:35:42 2025 +0000
b
b'@@ -0,0 +1,266 @@\n+precursor_mz\tlicense\tretention_index\tauthors\tcompound_name\n+5.892151845388988\tCC BY-NC\t7.832306201355293\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 2\n+6.192748713449297\tCC BY-NC\t7.850245390142389\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_TMS derivative\n+6.073558710644747\tCC BY-NC\t7.78965164811401\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_3TMS\n+5.892151845388988\tCC BY-NC\t7.81424332110364\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylserotonin_2TMS isomer 1\n+4.9130853812948345\tCC BY-NC\t7.274706837171483\tPrice et al., RECETOX, Masaryk University (CZ)\tMethylnicotinamide\n+5.564775508881141\tCC BY-NC\t7.226989069411646\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_2TMS\n+5.303891104371645\tCC BY-NC\t7.164684028536563\tPrice et al., RECETOX, Masaryk University (CZ)\tPipecolinic acid_1TMS\n+5.2681824879063415\tCC BY-NC\t7.182971980517274\tPrice et al., RECETOX, Masaryk University (CZ)\tNicotinic acid_1TMS\n+5.8920941934417845\tCC BY-NC\t7.417441654050696\tPrice et al., RECETOX, Masaryk University (CZ)\tRibose_4TMS\n+5.835193733885396\tCC BY-NC\t7.545391863774493\tPrice et al., RECETOX, Masaryk University (CZ)\tSyringic acid_2TMS\n+5.905817085017953\tCC BY-NC\t7.658691063659308\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_3TMS\n+6.084961789078627\tCC BY-NC\t7.684802793919827\tPrice et al., RECETOX, Masaryk University (CZ)\tGuanine_4TMS\n+5.56125696547891\tCC BY-NC\t7.156936878845119\tPrice et al., RECETOX, Masaryk University (CZ)\tLeucine_2TMS\n+6.127259981105538\tCC BY-NC\t7.5761081042761\tPrice et al., RECETOX, Masaryk University (CZ)\tGallic acid_4TMS\n+5.981818876841064\tCC BY-NC\t7.664501007793526\tPrice et al., RECETOX, Masaryk University (CZ)\ttrans-Caffeic acid_3TMS\n+5.98181917974872\tCC BY-NC\t7.588470501998992\tPrice et al., RECETOX, Masaryk University (CZ)\tcis-Caffeic acid_3TMS\n+6.2638724739451686\tCC BY-NC\t7.636156662638874\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 1\n+6.361815299425264\tCC BY-NC\t7.640605748544599\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylglucosamine_5TMS isomer 2\n+5.7873150855272195\tCC BY-NC\t7.4737217159333635\tPrice et al., RECETOX, Masaryk University (CZ)\t4-Hydroxy-3methoxyphenylacetic acid_2TMS\n+5.6280636416599705\tCC BY-NC\t7.183299231614796\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycine_3TMS\n+5.598871376513712\tCC BY-NC\t7.246113592983518\tPrice et al., RECETOX, Masaryk University (CZ)\tThymine_2TMS\n+5.85269460004274\tCC BY-NC\t7.413828025701229\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_3TMS\n+5.908446730684061\tCC BY-NC\t7.313121715555759\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_2TMS\n+6.040759298237713\tCC BY-NC\t7.376972974462826\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 1\n+6.0407562997465964\tCC BY-NC\t7.390168465179447\tPrice et al., RECETOX, Masaryk University (CZ)\tAsparagine_4TMS isomer 2\n+5.768817653688819\tCC BY-NC\t7.486041961608943\tPrice et al., RECETOX, Masaryk University (CZ)\tAzelaic acid_2TMS\n+5.765634703439085\tCC BY-NC\t7.580912994792873\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_2TMS\n+5.501676694396715\tCC BY-NC\t7.560041922612411\tPrice et al., RECETOX, Masaryk University (CZ)\tIndole-3-acetic acid_1TMS\n+5.872511514772339\tCC BY-NC\t7.658767040653888\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_2TMS\n+6.054851256727773\tCC BY-NC\t7.642975830763813\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetyltyrosine_3TMS\n+6.25044021136467\tCC BY-NC\t7.549936480002235\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_5TMS\n+6.100769567966236\tCC BY-NC\t7.537794381499459\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_4TMS\n+5.924688003465279\tCC BY-NC\t7.633140678646807\tPrice et al., RECETOX, Masaryk University (CZ)\tAllantoin_3TMS\n+5.529840312470658\tCC BY-NC\t7.595250014531695\tPrice et al., RECETOX, Masaryk University (CZ)\tTheobromine_1TMS\n+6.159433809022514\tCC BY-NC\t7.745308817294907\t'..b'.861277612685916\tCC BY-NC\t7.562905117764789\tPrice et al., RECETOX, Masaryk University (CZ)\tAdenine_3TMS\n+6.174293974913619\tCC BY-NC\t7.553443384080875\tPrice et al., RECETOX, Masaryk University (CZ)\tGalactose_5TMS isomer 2\n+5.778059918163128\tCC BY-NC\t7.495443050105538\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_2TMS\n+5.472567226334043\tCC BY-NC\t7.519017013401764\tPrice et al., RECETOX, Masaryk University (CZ)\tHippuric acid_1TMS\n+6.128991493739826\tCC BY-NC\t7.486502881033585\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Deoxyglucose_4TMS\n+5.883641028524949\tCC BY-NC\t7.458511940484235\tPrice et al., RECETOX, Masaryk University (CZ)\t2,3-Dihydroxybenzoic acid_3TMS\n+6.149276622979437\tCC BY-NC\t8.023946482499491\tPrice et al., RECETOX, Masaryk University (CZ)\tErgocalciferol_TMS\n+5.5993688068926915\tCC BY-NC\t7.562887459224859\tPrice et al., RECETOX, Masaryk University (CZ)\tMethyl palmitate\n+5.557132725709455\tCC BY-NC\t7.34719982462169\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 2\n+5.545641789779595\tCC BY-NC\t7.267427028011493\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_2TMS isomer 1\n+5.80255676869465\tCC BY-NC\t7.330538230519962\tPrice et al., RECETOX, Masaryk University (CZ)\tMaleamic acid_3TMS\n+6.144679031698347\tCC BY-NC\t7.5447775114923505\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 1\n+6.10528215305238\tCC BY-NC\t7.555399735814079\tPrice et al., RECETOX, Masaryk University (CZ)\tGlucose_5TMS isomer 2\n+5.855519529747611\tCC BY-NC\t7.320116553778143\tPrice et al., RECETOX, Masaryk University (CZ)\tAspartic acid_3TMS isomer\n+6.219437358750709\tCC BY-NC\t8.054241439135854\tPrice et al., RECETOX, Masaryk University (CZ)\talpha-Tocopherol_1TMS\n+6.219261255674836\tCC BY-NC\t7.71891480223893\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_5TMS\n+6.04918700878748\tCC BY-NC\t7.695823472721807\tPrice et al., RECETOX, Masaryk University (CZ)\tSpermidine_4TMS\n+5.54171066087357\tCC BY-NC\t7.325021150051998\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_2TMS\n+5.7904526184324\tCC BY-NC\t7.3908558920825635\tPrice et al., RECETOX, Masaryk University (CZ)\tCytosine_3TMS\n+6.1361244747453325\tCC BY-NC\t7.523183050918009\tPrice et al., RECETOX, Masaryk University (CZ)\tGlycylvaline_4TMS\n+5.635208265517937\tCC BY-NC\t7.496878272821101\tPrice et al., RECETOX, Masaryk University (CZ)\tHypoxanthine_2TMS\n+6.033820939836982\tCC BY-NC\t7.9557663144487005\tPrice et al., RECETOX, Masaryk University (CZ)\tPregnenolone_1TMS\n+6.155292819042708\tCC BY-NC\t7.64424303976102\tPrice et al., RECETOX, Masaryk University (CZ)\tLevodopa_4TMS\n+5.412033119791722\tCC BY-NC\t7.284711853123896\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Methoxybenzoic acid_1TMS\n+6.275208475238837\tCC BY-NC\t7.891096624046824\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 1\n+6.32421325284146\tCC BY-NC\t7.907504048874567\tPrice et al., RECETOX, Masaryk University (CZ)\t5-Methylcytidine_4TMS isomer 2\n+5.7239115845988335\tCC BY-NC\t7.404989760176127\tPrice et al., RECETOX, Masaryk University (CZ)\tAcetylaspartic acid_2TMS\n+5.7750136437295385\tCC BY-NC\t7.231235628188782\tPrice et al., RECETOX, Masaryk University (CZ)\tThreonine_3TMS spectra 1\n+5.78985628170891\tCC BY-NC\t7.406477551809707\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 2\n+5.79600173095921\tCC BY-NC\t7.391291305911426\tPrice et al., RECETOX, Masaryk University (CZ)\t2-Oxoadipic acid_2TMS isomer 1\n+6.24847144803485\tCC BY-NC\t7.894002950813195\tPrice et al., RECETOX, Masaryk University (CZ)\tCytidine_4TMS\n+6.123321983198713\tCC BY-NC\t8.08950640045489\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydrocholesterol_1TMS\n+6.144962285243773\tCC BY-NC\t8.09839448465337\tPrice et al., RECETOX, Masaryk University (CZ)\tDehydroergosterol_1TMS\n+6.1188952495575615\tCC BY-NC\t8.084113177475066\tPrice et al., RECETOX, Masaryk University (CZ)\tCholestatrienol_1TMS\n+5.553325719436582\tCC BY-NC\t7.173240821036828\tPrice et al., RECETOX, Masaryk University (CZ)\tProline_2TMS\n'
b
diff -r 000000000000 -r e6d5fee8c7a6 utils.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/utils.py Wed Jan 29 15:35:42 2025 +0000
[
@@ -0,0 +1,130 @@
+import argparse
+from typing import Tuple
+
+
+import pandas as pd
+
+
+class KeyValuePairsAction(argparse.Action):
+    def __call__(self, parser, namespace, values, option_string=None):
+        """
+        Parse key=value pairs from the command line arguments.
+
+        Parameters:
+        parser (argparse.ArgumentParser): The argument parser instance.
+        namespace (argparse.Namespace): The namespace to hold the parsed values.
+        values (list): The list of key=value pairs.
+        option_string (str): The option string.
+
+        Sets:
+        namespace.dest (dict): A dictionary with 1-based column index as key and new column name as value.
+        """
+        key_value_pairs = {}
+        for item in values:
+            try:
+                key, value = item.split("=")
+                key_value_pairs[int(key)] = value  # Convert key to integer
+            except ValueError:
+                parser.error(
+                    f"Invalid format for --rename: {item}. Expected format: key=value"
+                )
+        setattr(namespace, self.dest, key_value_pairs)
+
+
+class LoadDataAction(argparse.Action):
+    def __call__(self, parser, namespace, values, option_string=None):
+        file_path, file_extension = values
+        file_extension = file_extension.lower()
+        if file_extension == "csv":
+            df = pd.read_csv(file_path)
+        elif file_extension in ["tsv", "tabular"]:
+            df = pd.read_csv(file_path, sep="\t")
+        elif file_extension == "parquet":
+            df = pd.read_parquet(file_path)
+        else:
+            raise ValueError(f"Unsupported file format: {file_extension}")
+        setattr(namespace, self.dest, df)
+
+
+def write_csv(df: pd.DataFrame, file_path: str) -> None:
+    """
+    Write the dataframe to a CSV file.
+
+    Parameters:
+    df (pd.DataFrame): The dataframe to write.
+    file_path (str): The path to the output CSV file.
+    """
+    df.to_csv(file_path, index=False)
+
+
+def write_tsv(df: pd.DataFrame, file_path: str) -> None:
+    """
+    Write the dataframe to a TSV file.
+
+    Parameters:
+    df (pd.DataFrame): The dataframe to write.
+    file_path (str): The path to the output TSV file.
+    """
+    df.to_csv(file_path, sep="\t", index=False)
+
+
+def write_parquet(df: pd.DataFrame, file_path: str) -> None:
+    """
+    Write the dataframe to a Parquet file.
+
+    Parameters:
+    df (pd.DataFrame): The dataframe to write.
+    file_path (str): The path to the output Parquet file.
+    """
+    df.to_parquet(file_path, index=False)
+
+
+class StoreOutputAction(argparse.Action):
+    def __call__(
+        self,
+        parser: argparse.ArgumentParser,
+        namespace: argparse.Namespace,
+        values: Tuple[str, str],
+        option_string: str = None,
+    ) -> None:
+        """
+        Custom argparse action to store the output function and file path based on file extension.
+
+        Parameters:
+        parser (argparse.ArgumentParser): The argument parser instance.
+        namespace (argparse.Namespace): The namespace to hold the parsed values.
+        values (Tuple[str, str]): The file path and file extension.
+        option_string (str): The option string.
+        """
+        file_path, file_extension = values
+        file_extension = file_extension.lower()
+        if file_extension == "csv":
+            write_func = write_csv
+        elif file_extension in ["tsv", "tabular"]:
+            write_func = write_tsv
+        elif file_extension == "parquet":
+            write_func = write_parquet
+        else:
+            raise ValueError(f"Unsupported file format: {file_extension}")
+        setattr(namespace, self.dest, (write_func, file_path))
+
+
+class SplitColumnIndicesAction(argparse.Action):
+    def __call__(
+        self,
+        parser: argparse.ArgumentParser,
+        namespace: argparse.Namespace,
+        values: str,
+        option_string: str = None,
+    ) -> None:
+        """
+        Custom argparse action to split a comma-separated list of column indices and convert to 0-based indices.
+
+        Parameters:
+        parser (argparse.ArgumentParser): The argument parser instance.
+        namespace (argparse.Namespace): The namespace to hold the parsed values.
+        values (str): The comma-separated list of 1-based column indices.
+        option_string (str): The option string.
+        """
+        indices = [int(x) - 1 for x in values.split(",")]  # Convert to 0-based indices
+        setattr(namespace, self.dest, indices)