Package: galaxy2janis
Galaxy to Janis TranslationGalaxy2janis is a productivity tool which translates Galaxy tool wrappers and workflows into the Janis language.It accepts either a Galaxy wrapper (.xml) or workflow (.ga) and will produce a Janis definition (.py).This software is part thePortable Pipelines Projectwhich produces technologies to make workflow execution and sharing easier.Galaxy2janis is currently available in pre-release form.Contributing:Please get in touch byraising an issueso we can communicate via email or zoom.Bugs:Please submit any bugs byraising an issueto help improve the software!This program may fail when parsing legacy galaxy tools, or those written in unforseen ways.ContentsQuickstart GuideDescriptionInputsOutputsProducing CWL WDL NextflowMaking RunnableSupported FeaturesQuickstart GuideGalaxy2janis is available as a PyPI package.
It requires python ≥ 3.10.# create & activate environemnt
python3.10 -m venv venv
source venv/bin/activate# install package
pip install galaxy2janis# translate galaxy tool
galaxy2janis tool [PATH]
galaxy2janis tool sample_data/abricate/abricate.xml

# translate galaxy workflow
galaxy2janis workflow [PATH]
galaxy2janis workflow sample_data/assembly.gaThesample_datafolder contains the files above and can be used to test your installation.DescriptionWhat does this program do?This program was created to aid workflow migration. It was designed to be a productivity tool by helping the user port a workflow from one specification to another.Given agalaxy tool wrapperorgalaxy workflow, it will extract as much information as possible, and will create a similar definition inJanis. Once in Janis,janis translatecan be used to output an equivalent CWL/WDL/Nextflow definition.For tool translations, the main software requirement will be identified and translated to Janis. A container will also be identified which can run the output Janis tool.For workflow translations, the workflow itself will be translated to a Janis definition, alongside each tool used in the workflow.What does this program not do?Galaxy2janis is aproductivity tool. It does not providerunnabletranslations.It aims to produce a human readable output, and to match the structure of the ingested workflow. Users are expected to make somemanual editsto finalise the workflow. See theMaking Runnable Sectionfor details.InputsTool translationusage: galaxy2janis tool [OPTIONS] infile.xml

positional arguments:
  infile                path to tool.xml file to parse.

options:
  -h, --help            show this help message and exit
  -o OUTDIR, --outdir OUTDIR
                        output folder to place translationA local copy of the galaxy tool wrapper is needed. To download a tool wrapper:Select the tool in galaxyView its toolshed entry(top-left caret dropdown, 'See in Tool Shed')Download the wrapper as a zip file(repository actions -> 'Download as a zip file')The unzipped file is the wrapper for that galaxy tool.Once the wrapper has been obtained, the path to the specific tool to translate must be specified. For example, if you downloaded the abricate tool you may something similar to this structure:abricate/
├── abricate.xml
├── macros.xml
└── test-data
    ├── Acetobacter.fna
    ├── MRSA0252.fna
    └── output_db-card.txtTo translate abricate.xml:galaxy2janis tool abricate/abricate.xmlWorkflow Translationusage: galaxy2janis workflow [OPTIONS] infile.ga

positional arguments:
  infile                path to workflow.ga file to parse.

options:
  -h, --help            show this help message and exit
  -o OUTDIR, --outdir OUTDIR
                        output folder to place translationA local copy of the galaxy workflow is needed. There are two methods to download a workflow:Download from workflow editorDownload from Galaxy Training Network (GTN)These will download a galaxy workflow file in.gaformat.To translate the workflow:galaxy2janis workflow downloaded_workflow.gaEach tool used in the workflow will be downloaded and translated automatically during the process.OutputsTool translations produce a single Janis tool definition for in the input galaxy wrapper.Workflow translations produce an output folder containing multiple files. Workflows need multiple entities such as tool definitions, the main workflow file, scripts, and a place to provide input values to run the workflow. The current output structure is as follows:[translated_workflow]/
├── inputs.yaml             # input values
├── logs                
├── subworkflows    
├── tools                   # tool definitions
│   ├── scripts             # tool scripts
│   ├── untranslated        # untranslated tool logic (galaxy)
│   └── wrappers            # translated tool wrappers (galaxy)
└── workflow.py             # main workflow fileProducing CWL WDL NextflowJanis TranslateGalaxy -> Janis -> CWL/WDL/NextflowThis program ingests Galaxy definitions to produce Janis definitions.Janis' inbuilttranslatefunctionality can subsequently output to the languages seen above.For example, translating theabriatetool from Galaxy to CWL:# galaxy -> janis
galaxy2janis tool abricate/abricate.xml         (produces abricate.py)

# janis -> CWL
janis translate abricate.py > abricate.cwlMaking RunnableIt is the responsibility of the user to make final edits & bring the workflow to a runnable state.This tool is designed to increase productivity when migrating workflows; as such, the outputs it produces favour readability over completeness.To aid users in this process, some hints are supplied and sources files are retained.HintsSome basic hints are provided to help users check the output. This information helps the user confirm everything looks correct, and make edits when it isn't quite right.quaststep in translated workflow:A galaxy workflow was translated to Janis using galaxy2janis. A step within the workflow uses quast, which we see reflected in our outputworkflow.pyfile.  The actual quast tool being used in the step above is a Janis definition and will appear in thetools/output directory.#UNKNOWN1=w.unicycler.outAssembly,  # (CONNECTION)When a tool input value appears commented out, the program was unable to link it to a software input. This may happen because the galaxy wrapper modifies the galaxy input before it is wired to an actual software input. In these cases, the user would need to either identify which tool input it maps to, or if none exists, open the translatedquasttool and create one.Source FilesThese can be viewed to gain more context on what a source galaxy tool was intended to do. The main software command will have been translated into a Janis tool, but some details may have been left out in the process.tools/untranslatedContains untranslated galaxy tool logic. Galaxy tool wrappers may perform multiple tasks when executed. The main software tool being wrapped will execute, but some preprocessing or postprocessing steps may also be performed. A common structure is as follows:Preprocessing (symlinks / making directories / creating a genome index)Main software requirement (actual tool execution)Postprocessing (index or sort output / create additional output files / summaries)Galaxy2janis translates the main software requirement into a Janis definition. Preprocessing and postprocessing logic are placed into thetools/untranslatedfolder as a reference, so the user can see what has been ignored.tools/wrappersContains galaxy tools which were translated. They are the 'source files' which we used to create Janis tool definitions while the workflow was being parsed.  Can be used as reference when tool translations weren't good quality.Galaxy wrappers have a distinct style, so see thegalaxy tool xml documentationfor details.Supported FeaturesThis project is in active development. Many features are planned, and will be released over time.unsupportedFeatures<command>#def #set #if #forcheetah logic<command>Rscript -e(inline Rscripts)<param>type="color"paramsxml features seen in 1% of toolsWrappersembosssuite of tool wrappers known to fail due to legacy features.