public abstract class ParserModuleImpl extends JavaModuleImpl implements ParserModule
BioModule
s read ClassifierModule
output to build
standardized OTU count tables. This class provides the default abstract implementation.Modifier and Type | Field and Description |
---|---|
protected static String |
NUM_OTUS
Metadata column name for column that holds number of OTU hits after any
biolockj.module.implicit.parser
module executes: "OTU_COUNT" |
BLJ_OPTIONS
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 |
---|
ParserModuleImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addOtuNode(OtuNode node)
Each sample with taxonomic assignments from a
ClassifierModule is parsed by
ParserModule.parseSamples() to produce a ParsedSample . |
protected void |
addParsedSample(ParsedSample parsedSample)
Add
ParsedSample to parser cache |
void |
buildOtuCountFiles()
After
ParserModule.parseSamples() completes, this method builds the OTU count files. |
void |
checkDependencies()
Execute
validateModuleOrder() to validate module configuration order. |
static Set<String> |
getDepricatedOtuCountFields()
Getter for depricatedOtuCountFields
|
protected Map<String,String> |
getHitsPerSample()
Simple getter for hitsPerSample map
|
static String |
getOtuCountField()
Getter for otuCountField
|
ParsedSample |
getParsedSample(String sampleId)
After
ParserModule.parseSamples() completes, this method can be called to get a ParsedSample by
its sample ID. |
protected TreeSet<ParsedSample> |
getParsedSamples()
Simple getter for TreeSet of ParsedSamples
|
protected Set<String> |
getSampleIds()
Simple getter for Set of Sample IDs output by the module
|
String |
getSummary()
Produce summary message with min, max, mean, and median number of reads.
|
protected Set<String> |
getUniqueOtus()
Simple getter for Set of unique OTU names output by the module
|
protected boolean |
isValid(OtuNode node)
Some
ClassifierModule s can include taxonomy level identifiers without an OTU
name in the sample report files. |
abstract void |
parseSamples()
Parse
ClassifierModule output to build ParsedSample s. |
void |
runModule()
Parsers execute a task with 3 core functions:
parseSamples() - generates ParsedSample s
buildOtuCountFiles() - builds OTU tree tables from ParsedSample s
|
static void |
setNumHitsFieldName(String name)
When a module modifies the number of hits, the new counts must replace the old count fields.
|
protected void |
validateModuleOrder()
Validate that no
biolockj.module.seq modules run after this parser unless a new classifier branch is
started. |
buildScript, executeTask, getDockerImageName, getDockerImageOwner, getDockerImageTag, getWorkerScriptFunctions, isValidInputModule, markStatus, moduleComplete, moduleFailed, runBioLockJ_CMD
buildScriptForPairedReads, getJobParams, getMainScript, getRuntimeParams, getScriptDir, getScriptErrors, getTimeout, hasScripts, isValidProp
addGeneralProperty, addGeneralProperty, addGeneralProperty, addNewProperty, addNewProperty, cacheInputFiles, cleanUp, compareTo, equals, findModuleInputFiles, getAlias, getDescription, getDetails, getFileCache, getID, getInputFiles, getLogDir, getMenuPlacement, getMetadata, getModuleDir, getOutputDir, getPostRequisiteModules, getPreRequisiteModules, getPropDefault, getPropDescMap, getPropType, getPropTypeMap, getResourceDir, getTempDir, getTitle, hashCode, init, listProps, setAlias, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
moduleComplete, moduleFailed
buildScript, buildScriptForPairedReads, getJobParams, getMainScript, getScriptDir, getScriptErrors, getTimeout, getWorkerScriptFunctions
cleanUp, executeTask, getAlias, getDockerImageName, getDockerImageOwner, getDockerImageTag, getID, getInputFiles, getLogDir, getMetadata, getModuleDir, getOutputDir, getPostRequisiteModules, getPreRequisiteModules, getPropDefault, getResourceDir, getTempDir, init, isValidInputModule, setAlias, version
protected static final String NUM_OTUS
biolockj.module.implicit.parser
module executes: "OTU_COUNT"public void addOtuNode(OtuNode node) throws Exception
ParserModule
ClassifierModule
is parsed by
ParserModule.parseSamples()
to produce a ParsedSample
. As each file is processed, this method
is called to add the OtuNode
to the ParsedSample
with the same sample
ID (if valid).addOtuNode
in interface ParserModule
node
- OtuNodeException
- if unable to add the OTU nodepublic void buildOtuCountFiles() throws Exception
ParserModule
ParserModule.parseSamples()
completes, this method builds the OTU count files.buildOtuCountFiles
in interface ParserModule
Exception
- if error occurs while building OTU tablespublic void checkDependencies() throws Exception
validateModuleOrder()
to validate module configuration order.checkDependencies
in interface BioModule
checkDependencies
in class ScriptModuleImpl
Exception
- thrown if missing or invalid dependencies are foundpublic ParsedSample getParsedSample(String sampleId)
ParserModule
ParserModule.parseSamples()
completes, this method can be called to get a ParsedSample
by
its sample ID.getParsedSample
in interface ParserModule
sampleId
- Sample IDpublic String getSummary() throws Exception
getSummary
in interface BioModule
getSummary
in class ScriptModuleImpl
Exception
- if any error occurspublic abstract void parseSamples() throws Exception
ParserModule
ClassifierModule
output to build ParsedSample
s.parseSamples
in interface ParserModule
Exception
- if error occurs while parsing classifier reportspublic void runModule() throws Exception
parseSamples()
- generates ParsedSample
s
buildOtuCountFiles()
- builds OTU tree tables from ParsedSample
s
runModule
in interface JavaModule
runModule
in class JavaModuleImpl
Exception
- thrown if any runtime error occursprotected void addParsedSample(ParsedSample parsedSample) throws Exception
ParsedSample
to parser cacheparsedSample
- ParsedSampleException
- if method is used to add a duplicate sampleprotected Map<String,String> getHitsPerSample()
protected TreeSet<ParsedSample> getParsedSamples()
protected Set<String> getSampleIds()
protected Set<String> getUniqueOtus()
protected boolean isValid(OtuNode node) throws Exception
ClassifierModule
s can include taxonomy level identifiers without an OTU
name in the sample report files. This method verifies the node exists, has a valid sample ID, and that no empty
String OTU names are reported.node
- OtuNode build from 1 line of a ClassifierModule
output fileOtuNode
is validException
- if errors occur checking if node is validprotected void validateModuleOrder() throws Exception
biolockj.module.seq
modules run after this parser unless a new classifier branch is
started.Exception
- if modules are out of orderpublic static Set<String> getDepricatedOtuCountFields()
public static String getOtuCountField()