Shell+Scripts - apache/ctakes GitHub Wiki

Note

  • Shell scripts are included in the bin/ directory of a cTAKES installation
  • These scripts can ONLY be run in a cTAKES installation
  • They cannot be used within a source code project

Linux / Mac shell scripts
Windows batch shell scripts


Linux Mac shell scripts

getUmlsDictionary.sh

Starts a simple GUI to fetch the cTAKES umls (snomed, rxnorm) dictionary.
#!/bin/sh


#   Starts a simple GUI to fetch the cTAKES umls (snomed, rxnorm) dictionary.
# Requires Java 17

# Sets up environment for cTAKES
. ${HOME}/setenv.sh

cd $CTAKES_HOME

java -cp "$CLASS_PATH" -Xms512M -Xmx3g $DICT_DOWNLOADER "$@"

runClinicalPipeline.sh

Runs the default clinical pipeline with provided parameters.

Required parameters are:
-i , --inputDir {inputDirectory}
-o , --outputDir {outputDirectory}
--key {umlsKey}
Optional standard parameters are:
-s , --subDir {subDirectory} (for i/o)
--xmiOut {xmiOutputDirectory} (if different from -o)
-l , --lookupXml {dictionaryConfigFile} (fast only)
-? , --help

#!/bin/sh


#   Runs the default clinical pipeline with provided parameters.
#   Required parameters are:
#   -i , --inputDir {inputDirectory}
#   -o , --outputDir {outputDirectory}
#   --key {umlsKey}

#   Optional standard parameters are:
#   -s , --subDir {subDirectory}  (for i/o)
#   --xmiOut {xmiOutputDirectory} (if different from -o)
#   -l , --lookupXml {dictionaryConfigFile} (fast only)
#   -? , --help
# Requires Java 17

# Sets up environment for cTAKES
. ${HOME}/setenv.sh

cd $CTAKES_HOME

java -cp "$CLASS_PATH" -Xms512M -Xmx3g $PIPE_RUNNER -p $FAST_PIPER "$@"

runDictionaryCreator.sh

Starts a GUI that can facilitate creation of a dictionary.

The created dictionary contains SQL that can be used by the
ctakes-dictionary-lookup-fast module.

#!/bin/sh

#
#   Starts a GUI that can facilitate creation of a dictionary.
#   The created dictionary contains SQL that can be used by the
#   [ctakes-dictionary-lookup-fast](ctakes-dictionary-lookup-fast) module.
# Requires Java 17

# Sets up environment for cTAKES
. ${HOME}/setenv.sh

cd $CTAKES_HOME

java -cp "$CLASS_PATH" -Xms512M -Xmx3g org.apache.ctakes.gui.dictionary.DictionaryCreator

runPiperCreator.sh

Starts a GUI that can facilitate creation of a pipeline.
#!/bin/sh


#    Starts a GUI that can facilitate creation of a pipeline.
# Requires Java 17

# Sets up environment for cTAKES
. ${HOME}/setenv.sh

ALL_IMPL=""
if [ "$1" = "-a" ]; then
  ALL_IMPL="-Dctakes.gui.all-impls=XX"
elif [ "$1" = "-h" ]; then
  echo "Adding -h will also add unofficial components"
  exit
fi


cd $CTAKES_HOME

java -cp "$CLASS_PATH" $ALL_IMPL -Xms512M -Xmx3g org.apache.ctakes.gui.pipeline.PiperCreator

runPiperFile.sh

Runs the pipeline in the piper file specified by -p {piperfile} with provided parameters.

Standard parameters are:
-i , --inputDir {inputDirectory}
-o , --outputDir {outputDirectory}
-s , --subDir {subDirectory} (for i/o)
--xmiOut {xmiOutputDirectory} (if different from -o)
-l , --lookupXml {dictionaryConfigFile} (fast only)
--key {umlsKey}
-? , --help
Other parameters may be declared in the piper file using the cli command:
cli {parameterName}={singleCharacter}
For instance, for declaration of ParagraphAnnotator path to regex file optional parameter PARAGRAPH_TYPES_PATH,
in the custom piper file add the line:
cli PARAGRAPH_TYPES_PATH=t
and when executing this script use:
runPiperFile -p path/to/my/custom.piper -t path/to/my/custom.bsv ...

#!/bin/sh


#   Runs the pipeline in the piper file specified by -p {piperfile} with provided parameters.
#   Standard parameters are:
#     -i , --inputDir {inputDirectory}
#     -o , --outputDir {outputDirectory}
#     -s , --subDir {subDirectory}  (for i/o)
#     --xmiOut {xmiOutputDirectory} (if different from -o)
#     -l , --lookupXml {dictionaryConfigFile} (fast only)
#     --key {umlsKey}
#     -? , --help
#
#   Other parameters may be declared in the piper file using the cli command:
#     cli {parameterName}={singleCharacter}
#   For instance, for declaration of ParagraphAnnotator path to regex file optional parameter PARAGRAPH_TYPES_PATH,
#   in the custom piper file add the line:
#     cli PARAGRAPH_TYPES_PATH=t
#   and when executing this script use:
#      runPiperFile -p path/to/my/custom.piper -t path/to/my/custom.bsv  ...
# Requires Java 17

# Sets up environment for cTAKES
. ${HOME}/setenv.sh

cd $CTAKES_HOME

java -cp "$CLASS_PATH" -Xms512M -Xmx3g $PIPE_RUNNER "$@"

runPiperGUI.sh

Starts a GUI that can run a pipeline.
#!/bin/sh


#   Starts a GUI that can run a pipeline.
# Requires Java 17

# Sets up environment for cTAKES
. ${HOME}/setenv.sh

cd $CTAKES_HOME

java -cp "$CLASS_PATH" -Xms512M -Xmx3g $PIPE_RUNNER_GUI "$@"

runPiperSubmitter.sh

Starts a GUI that can run a pipeline.

Deprecated: Identical to the runPiperGUI script.

#!/bin/sh


#   Starts a GUI that can run a pipeline.
#   Deprecated: Identical to the runPiperGUI script.
# Requires Java 17

# Sets up environment for cTAKES
. ${HOME}/setenv.sh

cd $CTAKES_HOME

java -cp "$CLASS_PATH" -Xms512M -Xmx3g $PIPE_RUNNER_GUI "$@"

setenv.sh

Sets up the standard environment for cTAKES.

This script is called by cTAKES run scripts.

#!/bin/sh


#   Sets up the standard environment for cTAKES.
#   This script is called by cTAKES run scripts.
# Requires Java 17

PRG="$0"
while [ -h "$PRG" ]; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done
PRGDIR=`dirname "$PRG"`

# Only set CTAKES_HOME if not already set
[ -z "$CTAKES_HOME" ] && CTAKES_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`

CLASS_PATH=$CTAKES_HOME/desc/:$CTAKES_HOME/resources/:$CTAKES_HOME/config/*:$CTAKES_HOME/lib/*
#LOG4J2_PARM=-Dlog4j.configuration=file:$CTAKES_HOME/config/log4j2.xml
PIPE_RUNNER=org.apache.ctakes.core.pipeline.PiperFileRunner
PIPE_RUNNER_GUI=org.apache.ctakes.gui.pipeline.PiperRunnerGui
DICT_DOWNLOADER=org.apache.ctakes.gui.dictionary.DictionaryDownloader

FAST_PIPER=resources/org/apache/ctakes/clinical/pipeline/DefaultFastPipeline.piper

ytexweb.sh

Script Contents
#! /bin/sh
#
#

# simple script to start jetty with the desc/ctakes-ytex-web web app
# Requires Java 17
#
# Sets up environment for cTAKES
. ${HOME}/setenv.sh

java -cp "${CLASSPATH}" -XX:MaxPermSize=128m -Xmx512m org.eclipse.jetty.runner.Runner ${CTAKES_HOME}/desc/ctakes-ytex-web


Windows batch shell scripts

getUmlsDictionary.bat

Starts a simple GUI to fetch the cTAKES umls (snomed, rxnorm) dictionary.
@ECHO OFF

::   Starts a simple GUI to fetch the cTAKES umls (snomed, rxnorm) dictionary.
:: Requires Java 17

:: The setenv script sets up the environment needed by cTAKES.
@call %~sdp0\setenv.bat

cd %CTAKES_HOME%

java -cp "%CLASS_PATH%" %LOG4J_PARM% -Xms512M -Xmx3g %DICT_DOWNLOADER% %*

cd %CURRENT_DIR%

:end

runClinicalPipeline.bat

Runs the default clinical pipeline with provided parameters.

Required parameters are:
-i , --inputDir {inputDirectory}
-o , --outputDir {outputDirectory}
--key {umlsKey}
Optional standard parameters are:
-s , --subDir {subDirectory} (for i/o)
--xmiOut {xmiOutputDirectory} (if different from -o)
-l , --lookupXml {dictionaryConfigFile} (fast only)
-? , --help

@ECHO OFF

::   Runs the default clinical pipeline with provided parameters.
::   Required parameters are:
::   -i , --inputDir {inputDirectory}
::   -o , --outputDir {outputDirectory}
::   --key {umlsKey}

::   Optional standard parameters are:
::   -s , --subDir {subDirectory}  (for i/o)
::   --xmiOut {xmiOutputDirectory} (if different from -o)
::   -l , --lookupXml {dictionaryConfigFile} (fast only)
::   -? , --help
:: Requires Java 17

:: The setenv script sets up the environment needed by cTAKES.
@call %~sdp0\setenv.bat

cd %CTAKES_HOME%

java -cp "%CLASS_PATH%" -Xms512M -Xmx3g %PIPE_RUNNER% -p %FAST_PIPER% %*

cd %CURRENT_DIR%

:end

runDictionaryCreator.bat

Starts a GUI that can facilitate creation of a dictionary.

The created dictionary contains SQL that can be used by the
ctakes-dictionary-lookup-fast module.

::   Starts a GUI that can facilitate creation of a dictionary.
::   The created dictionary contains SQL that can be used by the
::   [ctakes-dictionary-lookup-fast](ctakes-dictionary-lookup-fast) module.
:: Requires Java 17

:: The setenv script sets up the environment needed by cTAKES.
@call %~sdp0\setenv.bat

cd %CTAKES_HOME%

java  -cp "%CLASS_PATH%"  -Xms512M -Xmx3g  org.apache.ctakes.gui.dictionary.DictionaryCreator
  
cd %CURRENT_DIR%
:end

runPiperCreator.bat

Starts a GUI that can facilitate creation of a pipeline.
::    Starts a GUI that can facilitate creation of a pipeline.
:: Requires Java 17

:: The setenv script sets up the environment needed by cTAKES.
@call %~sdp0\setenv.bat

cd %CTAKES_HOME%

java  -cp "%CLASS_PATH%"  %ALL_IMPL% -Xms512M -Xmx3g  org.apache.ctakes.gui.pipeline.PiperCreator
  
cd %CURRENT_DIR%
:end

runPiperFile.bat

Runs the pipeline in the piper file specified by -p {piperfile} with provided parameters.

Standard parameters are:
-i , --inputDir {inputDirectory}
-o , --outputDir {outputDirectory}
-s , --subDir {subDirectory} (for i/o)
--xmiOut {xmiOutputDirectory} (if different from -o)
-l , --lookupXml {dictionaryConfigFile} (fast only)
--key {umlsKey}
-? , --help
Other parameters may be declared in the piper file using the cli command:
cli {parameterName}={singleCharacter}
For instance, for declaration of ParagraphAnnotator path to regex file optional parameter PARAGRAPH_TYPES_PATH,
in the custom piper file add the line:
cli PARAGRAPH_TYPES_PATH=t
and when executing this script use:
runPiperFile -p path/to/my/custom.piper -t path/to/my/custom.bsv ...

@ECHO OFF

::   Runs the pipeline in the piper file specified by -p {piperfile} with provided parameters.
::   Standard parameters are:
::   -i , --inputDir {inputDirectory}
::   -o , --outputDir {outputDirectory}
::   -s , --subDir {subDirectory}  (for i/o)
::   --xmiOut {xmiOutputDirectory} (if different from -o)
::   -l , --lookupXml {dictionaryConfigFile} (fast only)
::   --key {umlsKey}
::   -? , --help

::   Other parameters may be declared in the piper file using the cli command:
::     cli {parameterName}={singleCharacter}
::   For instance, for declaration of ParagraphAnnotator path to regex file optional parameter PARAGRAPH_TYPES_PATH,
::   in the custom piper file add the line:
::     cli PARAGRAPH_TYPES_PATH=t
::   and when executing this script use:
::      runPiperFile -p path/to/my/custom.piper -t path/to/my/custom.bsv  ...
:: Requires Java 17

:: The setenv script sets up the environment needed by cTAKES.
@call %~sdp0\setenv.bat

cd %CTAKES_HOME%

java -cp "%CLASS_PATH%" -Xms512M -Xmx3g %PIPE_RUNNER% %*

cd %CURRENT_DIR%

:end

runPiperGUI.bat

Starts a GUI that can run a pipeline.
@ECHO OFF

::   Starts a GUI that can run a pipeline.
:: Requires Java 17

:: The setenv script sets up the environment needed by cTAKES.
@call %~sdp0\setenv.bat

cd %CTAKES_HOME%

java -cp "%CLASS_PATH%" -Xms512M -Xmx3g %PIPE_RUNNER_GUI% %*

cd %CURRENT_DIR%

:end

runPiperSubmitter.bat

Starts a GUI that can run a pipeline.

Deprecated: Identical to the runPiperGUI script.

@ECHO OFF

::   Starts a GUI that can run a pipeline.
::   Deprecated: Identical to the runPiperGUI script.
:: Requires Java 17

:: The setenv script sets up the environment needed by cTAKES.
@call %~sdp0\setenv.bat

cd %CTAKES_HOME%

java -cp "%CLASS_PATH%" -Xms512M -Xmx3g %PIPE_RUNNER_GUI% %*

cd %CURRENT_DIR%

:end

setenv.bat

Sets up the standard environment for cTAKES.

This script is called by cTAKES run scripts.

@ECHO OFF

::   Sets up the standard environment for cTAKES.
::   This script is called by cTAKES run scripts.
:: Requires Java 17

:: Guess CTAKES_HOME if not defined
set CURRENT_DIR=%cd%
if not "%CTAKES_HOME%" == "" goto gotHome
set CTAKES_HOME=%CURRENT_DIR%
if exist "%CTAKES_HOME%\bin\runClinicalPipeline.bat" goto okHome
cd ..
set CTAKES_HOME=%cd%

:gotHome
if exist "%CTAKES_HOME%\bin\runClinicalPipeline.bat" goto okHome
echo The CTAKES_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end

:okHome
@set PATH=%PATH%;%CTAKES_HOME%\lib\auth\x64
@REM use JAVA_HOME if set
if exist "%JAVA_HOME%\bin\java.exe" set PATH=%JAVA_HOME%\bin;%PATH%

set CLASS_PATH=%CTAKES_HOME%\desc\;%CTAKES_HOME%\resources\;%CTAKES_HOME%\config\*;%CTAKES_HOME%\lib\*
REM set LOG4J_PARM=-Dlog4j.configuration="file:\%CTAKES_HOME%\config\log4j.xml"
set PIPE_RUNNER=org.apache.ctakes.core.pipeline.PiperFileRunner
set PIPE_RUNNER_GUI=org.apache.ctakes.gui.pipeline.PiperRunnerGui
set DICT_DOWNLOADER=org.apache.ctakes.gui.dictionary.DictionaryDownloader

set FAST_PIPER=resources\org\apache\ctakes\clinical\pipeline\DefaultFastPipeline.piper

ytexweb.bat

Script Contents
@REM
@REM

@rem simple script to start jetty with the desc\ctakes-ytex-web web app
@rem YOU MUST use a Java, not JRE.
@rem typical windows Paths include the JRE, not the JDK
@rem do one of the following:
@rem * change java in this script to the full path of java from the JDK
@rem * or modify setenv.bat to put the JDK bin directory at the beginning of the path
@rem * or modify the PATH system environment variable and put the JDK bin directory at the beginning
@setlocal
@call %~dp0setenv.bat
@REM java -cp "%CLASSPATH%" -Dlog4j.configuration="file:\%CTAKES_HOME%\config\log4j.xml" -XX:MaxPermSize=128m -Xmx512m org.eclipse.jetty.runner.Runner "%CTAKES_HOME%\desc\ctakes-ytex-web"
java -cp "%CLASSPATH%" -XX:MaxPermSize=128m -Xmx512m org.eclipse.jetty.runner.Runner "%CTAKES_HOME%\desc\ctakes-ytex-web"
@endlocal

⚠️ **GitHub.com Fallback** ⚠️