Command line tools that are installed on the server can be integrated into RAMADDA with the
Service Integration Framework.
There are a number of examples at ramadda.org.
All RAMADDA repositories (running the latest release) have their list of enabled services at
https://ramadda.org/repository/services/list.
To enable an installed service you need to specify one or more properties
in a .properties file in your RAMADDA home directory that specify the
location of the installed software.
|
service.gs=/path/to/bin/gsIf on Amazon AWS you can do:
sudo yum install ghostscriptTo find out where GS is located do:
which gs
service.pdfbox=<path>/pdfbox.sh
ramadda.image.slicer=/path/to/magick-slicer.shIf running on Amazon AWS you can install ImageMagick with:
sudo yum install -y ImageMagick ImageMagick-devel
ramadda.tesseract=/path/to/tesseractSome systems have Tesseract available via package manager. Unfortunately Amazon Linux is not one of those. Here are the instructions on how to build Tessearct. Build leptonica
wget https://github.com/DanBloomberg/leptonica/archive/refs/tags/1.83.1.tar.gz tar -xvzf 1.83.1.tar.gz cd leptonica-1.83.1 ./autobuild ./configure make sudo make installThen call:
export PKG_CONFIG_PATH='/usr/local/lib/pkgconfig'Download tesseract and build Tesseract
wget https://github.com/tesseract-ocr/tesseract/archive/refs/tags/5.3.1.tar.gz tar -xvzf 5.3.1.tar.gz cd tesseract-5.3.1 ./autogen.sh ./configure make sudo make install sudo ldconfigDownload the Tesseract training data
# Navigate to the tessdata directory sudo mkdir -p /usr/local/share/tessdata cd /usr/local/share/tessdata # Download the English language training data, for example sudo wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddataYou can override where Tika looks for Tesseract by copying the extra tika.xml file onto your server. Consult the file for what needs to be set.
ramadda.jupyter.path=/path/to/anaconda/bin/jupyter
service.gdal=/usr/local/bin service.gdal.gdal_translate=/usr/local/bin/gdal_translate service.gdal.gdalinfo=/usr/local/bin/gdalinfo service.gdal.ogrinfo=/usr/local/bin/ogrinfo service.gdal.gdalwarp=/usr/local/bin/gdalwarp service.gdal.gdaldem=/usr/local/bin/gdaldem service.gdal.ogr2ogr=/usr/local/bin/ogr2ogrTo install gdal it might be available on your system's package manager (e.g, yum, brew). Alternatively, you can use pixi to easily install gdal. See https://www.youtube.com/watch?v=2GNmhmoIiJs Install pixi:
curl -fsSL https://pixi.sh/install.sh | bashMake a geo dir and init pixi:
mkdir geo cd geo pixi initAdd gdal:
pixi add gdalpixi will install gdal into:
/home/ec2-user/geo/.pixi/envs/default/binYou can add it to your PATH in the .bashrc
set PATH="$PATH:/home/ec2-user/geo/.pixi/envs/default/bin"Then add the properties to repository.properties
service.gdal=/home/ec2-user/geo/.pixi/envs/default/bin service.gdal.gdal_translate=/home/ec2-user/geo/.pixi/envs/default/bin/gdal_translate service.gdal.gdalinfo=/home/ec2-user/geo/.pixi/envs/default/bin/gdalinfo service.gdal.gdalwarp=/home/ec2-user/geo/.pixi/envs/default/bin/gdalwarp service.gdal.gdaldem=/home/ec2-user/geo/.pixi/envs/default/bin/gdaldem service.gdal.ogr2ogr=/home/ec2-user/geo/.pixi/envs/default/bin/ogr2ogr
service.qttools=/usr/local/bin
service.nco.ncwa=/opt/local/bin/ncwaClimate data operators - CDO
service.cdo=/opt/local/bin/cdoHDF5 tools
service.hdf5.h5ls=/opt/local/bin/h5lsMB System Bathymetry data
service.mb.mbinfo=/usr/local/bin/mbinfo service.mb.mblist=/usr/local/bin/mblist
service.dicom.dcm4che=<path>/dcm4che-2.0.28/binOME Bio-Formats
service.bfconvert = <path>/bftools/bfconvertSRATools -
service.sratools=<path>/sratoolkit.2.3.5-2/binHMMER Tools -
service.hmmertools=<path>/hmmer-3.1b1-macosx-intel/binariesPicard -
service.picard=<path>/picard-tools-1.119/picard.sh
service.test1=/path/to/program service.test2=/path/to/programNote: To install as a plugin remove the "_ex1" so you have an outputhandlers.xml plugin file.
Services can be defined in a separate services.xml file.<outputhandlers class="org.ramadda.repository.output.ServiceOutputHandler"> <!-- You can specify attributes that are inherited by all services, e.g., class="ServiceOutputHandler" This xml can either contain the service xml directly or it can refer to a service that was defined in a separate services.xml file --> <outputhandler category="Test Output"> <!-- Set a property service.test1=/path/to/executable.sh in a .properties file in your RAMADDA home dir --> <service id="test_service1" command="${service.test1}" label="Run example service 1" icon="/icons/pdf.png" > <!-- Specify an entry of a particular type (type_document_pdf) --> <arg value="${entry.file}" type="entry" entryType="type_document_pdf" primary="true" label="Input PDF File" ></arg> <!-- ... There would be other service attributes here. See services.xml ... --> </service> </outputhandler> <!-- Or you can have the output handler reference the service id from a services.xml file --> <outputhandler category="Test Output" serviceId="test_service2"/> </outputhandlers> examples/outputhandlers_ex1.xml
<services> <!-- Set a property service.test2=/path/to/executable.sh in a .properties file in your RAMADDA home dir --> <service id="test_service1" command="${service.test2}" label="Run example service 1" icon="/icons/pdf.png" > <description><! class="wiki-link-external" href="CDATA[Runs" > an example service></description> <!-- Define the command line arguments --> <!-- Each arg tag has the following attributes: type (string, flag, enumeration, value,int, entry, etc) name - the url argument id value - a value to use - may contain ${...} macros label help - shown in the form values - list of comma separated enum values prefix - added to the arg list if the value is defined --> <!-- Always have 'any value' as an arg --> <arg value="any value"/> <!-- specify type='enumeration' for a pull down list. Add the "none" item --> <arg name="fruit1" type="enumeration" values="apple,banana,orange" addNone="true"/> <!-- specify value:label pairs --> <arg name="fruit2" type="enumeration" values="apple:Apple label,banana:Banana label,orange:Orange label"/> <!-- Specify a value attribute where the macro '${value}' is replaced with the selected value --> <arg name="fruit3" type="enumeration" values="apple,banana,orange" value="fruit=${value}"/> <!-- Input field --> <arg name="string1" type="string" size="50" label="Some string" help="Help text goes after the field"/> <!-- If the string is defined then also add the prefix as an argument --> <arg name="string2" type="string" size="50" label="Some string" prefix="-string"/> <!-- use an int type--> <arg name="length" type="int" default="5" label="Length"/> <!-- If checkbox is selected then add the value as an arg--> <arg name="flag1" type="flag" label="Some flag" value="flag1 selected"/> <!-- If checkbox is selected then add the "-someflag" "flag1" --> <arg name="flag2" type="flag" label="Some flag" prefix="-someflag" value="flag1"/> <!-- Args of type entry match up with specific entry types in ramadda --> <arg value="${entry.file}" type="entry" entryType="type_document_pdf" primary="true" label="Input PDF File" ></arg> <!-- This uses the macro ${entry.file.base} to get the base name (minus the suffix) of the selected entry's file So, if we having incoming.pdf the output file is incoming.txt --> <arg value="${file}" file="${entry.file.base}.txt"></arg> <!-- Now define the outputs. Each output has a regexp pattern that matches on any generated file You can specify an entry type for the entries that get created for each file --> <output type="file" pattern=".*\.txt"/> <output type="type_image" pattern=".*\.png"/> <!-- If the service produces text to the stdout then this specifies to write to a file --> <output showResults="true" stdout="true" filename="test.txt"/> </service> </services> examples/services_ex1.xml
//specify 2 date arguments
<arg type="date" name="cdo.fromdate" label="Start Date" include="false" valuesProperty="dateList"/>
<arg type="date" name="cdo.todate" label="End Date" include="false" valuesProperty="dateList"/>
//specify a simple value argument that includes the values of the two date args
<arg value="-seldate,${cdo.fromdate},${cdo.todate}"/>
Here we have an image format enumeration value with include=false. It is used
From org/ramadda/bio/image/services.xml
<arg type="enumeration" name="imageformat" label="Image type" values="png,gif,jpg,tiff" include="false" default="png"/>
//Specify an entry
<arg value="${entry.file}" type="entry" label="Input image file" primary="true" entryType="bio_dicom,bio_ome_tiff"></arg>
//Provide the output image
<arg value="${file}" file="${entry.file.base}${suffix}.${imageformat}"/>