public class Metaphlan2Classifier extends ClassifierModuleImpl implements ApiModule
Modifier and Type | Field and Description |
---|---|
protected static String |
EXE_METAPHLAN
Config exe property used to obtain the metaphlan2 executable |
protected static String |
EXE_METAPHLAN_PARAMS
Config List property used to obtain the metaphlan2 executable params |
protected static String |
METAPHLAN2_DB
Config Directory property containing alternate database: "metaphlan2.db"Must always be paired with "metaphlan2.mpa_pkl" |
protected static String |
METAPHLAN2_MPA_PKL
Config File property containing path to the mpa_pkl file used to reference an alternate DB
"metaphlan2.mpa_pkl"Must always be paired with "metaphlan2.db" |
GZIP_EXT, LOG_EXT, PDF_EXT, RETURN, SH_EXT, TAB_DELIM, TSV_EXT, TXT_EXT
LOG_DIR, MAIN_SCRIPT_PREFIX, NO_VERSION, OUTPUT_DIR, RES_DIR, TEMP_DIR
Constructor and Description |
---|
Metaphlan2Classifier() |
Modifier and Type | Method and Description |
---|---|
List<List<String>> |
buildScript(List<File> files)
Build bash script lines to classify unpaired WGS reads with Metaphlan.
|
List<List<String>> |
buildScriptForPairedReads(List<File> files)
Build bash script lines to classify paired WGS reads with Metaphlan.
|
void |
checkDependencies()
Verify none of the derived command line parameters are included in
Config ."exe.metaphlan2" |
String |
getCitationString()
At a minimum, this should return the name and/or url for the wrapped tool.
|
String |
getClassifierExe()
Metaphlan runs python scripts, so no special command is required
|
List<String> |
getClassifierParams()
Obtain the metaphlan2 runtime params
|
File |
getDB()
Return database directory, if multiple databases are configured, they must share a common parent directory and
the common parent directory is returned by this method.
|
String |
getDescription()
Briefly describe what this module does.
|
String |
getDockerImageName()
Get the docker image to use for this module.
|
String |
getDockerImageOwner()
Get the name of the docker hub user that owns the image to use for this module.
|
String |
getDockerImageTag()
Get the version / tag to use for the docker image.
|
protected String |
getParams()
Metaphlan queries require standard parameters: --input_type, --nproc, -t
Verify no invalid runtime params are passed and add rankSwitch if needed. Set the rankSwitch based on the Config ."report.taxonomyLevels" if
only one taxonomy level is to be reported, otherwise report all levels. |
List<String> |
getWorkerScriptFunctions()
Method returns bash script lines used to build the functions called by the worker scripts.
|
getClassifierType, getDbCache, getPostRequisiteModules, getSummary, setDbCache, validateModuleOrder
getInputFiles, getSeqFiles, isValidInputModule
executeTask, getJobParams, getMainScript, getRuntimeParams, getScriptDir, getScriptErrors, getTimeout, hasScripts, isValidProp
addGeneralProperty, addGeneralProperty, addGeneralProperty, addNewProperty, addNewProperty, cacheInputFiles, cleanUp, compareTo, equals, findModuleInputFiles, getAlias, getDescription, getDetails, getFileCache, getID, getLogDir, getMenuPlacement, getMetadata, getModuleDir, getOutputDir, getPreRequisiteModules, getPropDefault, getPropDescMap, getPropType, getPropTypeMap, getResourceDir, getTempDir, getTitle, hashCode, init, listProps, setAlias, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getDescription, getDetails, getMenuPlacement, getPropType, getTitle, isValidProp, listProps
cleanUp, executeTask, getAlias, getID, getInputFiles, getLogDir, getMetadata, getModuleDir, getOutputDir, getPostRequisiteModules, getPreRequisiteModules, getPropDefault, getResourceDir, getSummary, getTempDir, init, isValidInputModule, setAlias, version
getSeqFiles
getJobParams, getMainScript, getScriptDir, getScriptErrors, getTimeout
protected static final String EXE_METAPHLAN
Config
exe property used to obtain the metaphlan2 executableprotected static final String EXE_METAPHLAN_PARAMS
Config
List property used to obtain the metaphlan2 executable paramsprotected static final String METAPHLAN2_DB
Config
Directory property containing alternate database: "metaphlan2.db"protected static final String METAPHLAN2_MPA_PKL
Config
File property containing path to the mpa_pkl file used to reference an alternate DB
"metaphlan2.mpa_pkl"public List<List<String>> buildScript(List<File> files) throws Exception
Example line:
python /app/metaphlan2.py --nproc 8 -t rel_ab_w_read_stats --input_type fasta ./input/sample42.fasta --bowtie2out
./temp/sample42.bowtie2.bz2 > ./output/sample42_reported.tsv
buildScript
in interface ScriptModule
buildScript
in class ScriptModuleImpl
files
- Files in the input directory that contain only forward readsException
- if unable to generate script linespublic List<List<String>> buildScriptForPairedReads(List<File> files) throws Exception
Example line:
python /app/metaphlan2.py --nproc 8 -t rel_ab_w_read_stats --input_type fasta ./input/sample42_R1.fasta,
./input/sample42_R2.fasta --bowtie2out ./temp/sample42.bowtie2.bz2 > ./output/sample42_reported.tsv
buildScriptForPairedReads
in interface ScriptModule
buildScriptForPairedReads
in class ScriptModuleImpl
files
- Files in the input directory that contain only paired readsException
- if unable to generate the script linespublic void checkDependencies() throws Exception
Config
."exe.metaphlan2"checkDependencies
in interface BioModule
checkDependencies
in class ClassifierModuleImpl
Exception
- thrown if missing or invalid dependencies are foundpublic String getClassifierExe() throws ConfigException
getClassifierExe
in interface ClassifierModule
getClassifierExe
in class ClassifierModuleImpl
ConfigException
- if Configuration errors are thrownpublic List<String> getClassifierParams() throws ConfigException, DockerVolCreationException
getClassifierParams
in interface ClassifierModule
getClassifierParams
in class ClassifierModuleImpl
DockerVolCreationException
ConfigException
- if Configuration errors are thrownpublic File getDB() throws ConfigPathException, ConfigNotFoundException, DockerVolCreationException
DatabaseModule
getDB
in interface DatabaseModule
getDB
in class ClassifierModuleImpl
ConfigPathException
- if path is defined but does not existsConfigNotFoundException
- if DB property is undefined and the default DB is not included in the module
runtime envDockerVolCreationException
public List<String> getWorkerScriptFunctions() throws Exception
ScriptModule
getWorkerScriptFunctions
in interface ScriptModule
getWorkerScriptFunctions
in class ScriptModuleImpl
Exception
- if errors occurprotected String getParams() throws Exception
Config
."report.taxonomyLevels" if
only one taxonomy level is to be reported, otherwise report all levels.Exception
- if errors occurpublic String getDockerImageOwner()
BioModule
getDockerImageOwner
in interface BioModule
getDockerImageOwner
in class BioModuleImpl
public String getDockerImageName()
BioModule
getDockerImageName
in interface BioModule
public String getDockerImageTag()
BioModule
getDockerImageTag
in interface BioModule
getDockerImageTag
in class BioModuleImpl
public String getDescription()
ApiModule
getDetails
.getDescription
in interface ApiModule
public String getCitationString()
ApiModule
getCitationString
in interface ApiModule