view json2yolosegment.xml @ 2:158e6ce48345 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 739bcabf09bdb9c291121a6b1f889dabe1a98ea9
author bgruening
date Fri, 11 Jul 2025 06:49:20 +0000
parents dfda27273ead
children f6990d85161c
line wrap: on
line source

<tool id="json2yolosegment" name="Convert AnyLabeling JSON to YOLO text" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
    <description>with ultralytics</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="creator" />
    <expand macro="edam" />
    <expand macro="requirements" />
    <command detect_errors="aggressive">
    <![CDATA[
      mkdir ./input ./output &&

      #for $filename in $in_json:
          #if $filename.element_identifier.endswith($filename.ext)
              ln -s '$filename' './input/${filename.element_identifier}' &&
	  #else:
	      ln -s '$filename' './input/${filename.element_identifier}.${filename.ext}' &&
          #end if
      #end for

      python '$__tool_directory__/json2yolosegment.py'
	-i ./input/
	-o ./output
	-c '$class_name'
	
    ]]>
    </command>
    <inputs>
	 <param name="in_json" type="data" format="json" multiple="true" label="Input label files" help="The label file is the output of AnyLabeling in JSON format."/>
         <param name="class_name" type="data" format="txt" label="Class file" help="Class names text file, contains the names of classes, one class per row."/>
    </inputs>
    <outputs>
        <collection name="output_yolo" type="list" label="YOLO text files">
		<discover_datasets pattern="(?P&lt;name&gt;.+)\.txt" visible="true" directory="./output" format="txt"/>
        </collection>
    </outputs>
    <tests>
        <test>
            <param name="in_json" value="in_json.json,in_json1.json" />
            <param name="class_name" value="class_names.txt" />
            <output_collection name="output_yolo">
                <element name="in_json">
                    <assert_contents>
                        <has_n_lines n="1" />
			<has_text text="0.8532289628180039" />
		    </assert_contents>
                </element>
	        <element name="in_json1">
                    <assert_contents>
		        <has_n_lines n="1" />
                        <has_text text="0.7710371819960861" />
		    </assert_contents>
                </element>
            </output_collection>
        </test>
        <test>
            <param name="in_json" value="in_json_noext,in_json1_noext" />
            <param name="class_name" value="class_names.txt" />
	    <output_collection name="output_yolo">
                <element name="in_json1_noext">
                    <assert_contents>
                        <has_n_lines n="1" />
                        <has_text text="0.7710371819960861" />
                    </assert_contents>
                </element>
                <element name="in_json_noext">
                    <assert_contents>
                        <has_n_lines n="1" />
                        <has_text text="0.8532289628180039" />
                    </assert_contents>
                </element>
            </output_collection>
        </test>
    </tests>
    <help>
<![CDATA[
        **What it does**
        This tool converts label files generated by AnyLabeling into YOLO supported text files.
]]>
    </help>
    <expand macro="citations" />
</tool>