view macros.xml @ 0:293a939f28c8 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/seaborn commit 24dc6373560bd5e409fca84154634f5a528001c3
author iuc
date Wed, 14 May 2025 08:39:42 +0000
parents
children
line wrap: on
line source

<macros>
    <token name="@TOOL_VERSION@">0.13.2</token>
    <token name="@VERSION_SUFFIX@">0</token>

    <xml name="edam">
        <edam_topics>
            <edam_topic>topic_0092</edam_topic>
        </edam_topics>
        <edam_operations>
            <edam_operation>operation_0337</edam_operation>
        </edam_operations>
    </xml>

    <xml name="requirements">
        <requirements>
            <requirement type="package" version="@TOOL_VERSION@">seaborn</requirement>
            <yield/>
        </requirements>
    </xml>

    <xml name="inputs">
        <param argument="--input_data" type="data" format="tsv,tabular,csv,parquet" label="Input data table" help="Provide the input data file in one of the supported formats: TSV, TXT, CSV, or Parquet. This file will be used to generate the plot." />
    </xml>

    <xml name="transformation">
        <param name="transformation" type="select" label="Transformation" help="Choose a transformation function to apply to the numerical data in the input file. This can be useful for scaling or normalizing the data before plotting.">
            <option value="lambda x: x" selected="true">no transformation</option>
            <option value="np.log10">log10</option>
            <option value="np.log2">log2</option>
        </param>
    </xml>

    <xml name="columns" tokens="header">
        <param name="xcol" type="data_column" data_ref="input_data" label="x-axis" optional="true" use_header_names="@HEADER@" help="Select the column from the input data to use for the x-axis of the plot."/>
        <param name="ycol" type="data_column" data_ref="input_data" label="y-axis" optional="true" use_header_names="@HEADER@" help="Select the column from the input data to use for the y-axis of the plot."/>
        <section name="advanced_input" title="Advanced">
            <param name="hue" type="data_column" data_ref="input_data" label="hue" optional="true" use_header_names="@HEADER@" help="Select a column to group data by color (hue) in the plot. This is useful for visualizing categorical data."/>
            <param name="col" type="data_column" data_ref="input_data" label="column-facetting" optional="true" use_header_names="@HEADER@" help="Select a column to create facets (subplots) along the columns of the plot grid. This is useful for visualizing how data varies across different categories or groups in the selected column."/>
            <param name="row" type="data_column" data_ref="input_data" label="row-facetting" optional="true" use_header_names="@HEADER@" help="Select a column to create facets (subplots) along the rows of the plot grid. This allows you to compare data across different categories or groups in the selected column."/>
        </section>
    </xml>

    <token name="@INIT@">
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt

file_name = "$input_data"
file_extension = "$input_data.ext"

transformation = $transformation
output_format = "png"
output_file = "${output_file}"

# load and transform data
if file_extension == "csv":
    df = pd.read_csv(file_name, index_col=index_col)
elif file_extension in ["tsv", "tabular"]:
    df = pd.read_csv(file_name, sep="\t", index_col=index_col)
elif file_extension == "parquet":
    df = pd.read_parquet(file_name, index_col=index_col)
else:
    raise ValueError(f"Unsupported file format: {file_extension}")
data = df.apply(lambda x: transformation(x) if np.issubdtype(x.dtype, np.number) else x)
    </token>

    <xml name="creator">
        <creator>
            <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="citation">
        <citations>
            <citation type="doi">10.21105/joss.03021</citation>
        </citations>
    </xml>
</macros>