public class RarefyOtuCounts extends OtuCountModule
Modifier and Type | Field and Description |
---|---|
protected static String |
LOW_ABUNDANT_CUTOFF
Config Posivite Double property to define minimum percentage of samples that must contain an
OTU. |
protected static String |
NUM_ITERATIONS
Config Positive Integer property "rarefyOtuCounts.iterations" defines the number of iterations to
randomly select the "rarefyOtuCounts.quantile"% of OTUs. |
protected static String |
QUANTILE
Config Positive Double property "rarefyOtuCounts.quantile" defines quantile for rarefication. |
protected static String |
REMOVE_LOW_ABUNDANT_SAMPLES
Config Boolean property "rarefyOtuCounts.rmLowSamples" if TRUE, all samples below the
quantile sample are removed. |
BLJ_OPTIONS
GZIP_EXT, LOG_EXT, PDF_EXT, RETURN, SH_EXT, TAB_DELIM, TSV_EXT, TXT_EXT
SCRIPT_BATCH_SIZE, SCRIPT_DEFAULT_HEADER, SCRIPT_NUM_THREADS, SCRIPT_PERMISSIONS, SCRIPT_TIMEOUT
MAIN_SCRIPT_PREFIX, OUTPUT_DIR, TEMP_DIR
Constructor and Description |
---|
RarefyOtuCounts() |
Modifier and Type | Method and Description |
---|---|
void |
checkDependencies()
|
void |
cleanUp()
Update
ParserModuleImpl OTU_COUNT field name. |
protected static void |
generateOtuput(File file,
TreeMap<String,Long> otuCounts)
Print the output file wit rarefied counts.
|
protected static List<String> |
getData(String sampleId,
TreeMap<String,Long> otuCounts)
Get OTU count data for the given sampleId.
|
protected List<String> |
getLowAbundantSamples()
Return a list of low abundant samples, as defined by "rarefyOtuCounts.lowAbundantCutoff"
|
protected Long |
getNumOtusForQuantile(TreeMap<String,TreeMap<String,Long>> sampleOtuCounts)
Get the quantile number of OTUs.
|
protected static List<String> |
getRandomQuantileOtus(List<String> data,
Long quantileNum)
Select random OTUs based on the quantileNum from the list of OTUs in data.
|
String |
getSummary()
Produce summary message with min, max, mean, and median number of reads.
|
protected TreeMap<String,Long> |
rarefy(String sampleId,
TreeMap<String,Long> otuCounts,
long quantileNum)
Rarefy the data by taking the average value of "rarefyOtuCounts.iterations"
|
void |
runModule()
Apply the quantile Config to the number of OTUs per sample to calculate the maximum OTU count per sample.
|
getInputFiles, isOtuModule, isValidInputModule
buildScript, executeTask, getSource, getWorkerScriptFunctions, markStatus, moduleComplete, moduleFailed
buildScriptForPairedReads, getJobParams, getMainScript, getRuntimeParams, getScriptDir, getScriptErrors, getTimeout, hasScripts
cacheInputFiles, compareTo, equals, findModuleInputFiles, getFileCache, getID, getModuleDir, getOutputDir, getPostRequisiteModules, getPreRequisiteModules, getTempDir, init, toString, validateFileNameUnique
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
buildScriptForPairedReads, getJobParams, getMainScript, getScriptDir, getScriptErrors, getTimeout
getID, getModuleDir, getOutputDir, getPostRequisiteModules, getPreRequisiteModules, getTempDir, init
protected static final String LOW_ABUNDANT_CUTOFF
Config
Posivite Double property to define minimum percentage of samples that must contain an
OTU. Low abundance OTUs will be removed: "rarefyOtuCounts.lowAbundantCutoff"protected static final String NUM_ITERATIONS
Config
Positive Integer property "rarefyOtuCounts.iterations" defines the number of iterations to
randomly select the "rarefyOtuCounts.quantile"% of OTUs.protected static final String QUANTILE
Config
Positive Double property "rarefyOtuCounts.quantile" defines quantile for rarefication. The number
of OTUs/sample are ordered, all samples with more OTUs than the quantile sample are subselected without
replacement until they have the same number of OTUs as the quantile sample value. A quantile of 0.50 returns the
median value.protected static final String REMOVE_LOW_ABUNDANT_SAMPLES
Config
Boolean property "rarefyOtuCounts.rmLowSamples" if TRUE, all samples below the
quantile sample are removed.public void checkDependencies() throws Exception
ScriptModuleImpl
checkDependencies
in interface BioModule
checkDependencies
in class ScriptModuleImpl
Exception
- thrown if missing or invalid dependencies are foundpublic void cleanUp() throws Exception
ParserModuleImpl
OTU_COUNT field name.cleanUp
in interface BioModule
cleanUp
in class BioModuleImpl
Exception
- thrown if any runtime error occurspublic String getSummary() throws Exception
getSummary
in interface BioModule
getSummary
in class ScriptModuleImpl
Exception
- if any error occurspublic void runModule() throws Exception
runModule
in interface JavaModule
runModule
in class JavaModuleImpl
Exception
- thrown if any runtime error occursprotected List<String> getLowAbundantSamples() throws Exception
Exception
- if errors occurprotected Long getNumOtusForQuantile(TreeMap<String,TreeMap<String,Long>> sampleOtuCounts) throws Exception
sampleOtuCounts
- TreeMap(SampleId, TreeMap(OTU, count)) OTU counts for every sampleException
- if errors occurprotected TreeMap<String,Long> rarefy(String sampleId, TreeMap<String,Long> otuCounts, long quantileNum) throws Exception
sampleId
- Sample IDotuCounts
- OTU countsquantileNum
- Maximum numberException
- if errors occurprotected static void generateOtuput(File file, TreeMap<String,Long> otuCounts) throws Exception
file
- Output fileotuCounts
- TreeMap(OTU, count)Exception
- if errors occurprotected static List<String> getData(String sampleId, TreeMap<String,Long> otuCounts) throws Exception
sampleId
- Sample IDotuCounts
- All OTU countsException
- if errors occurprotected static List<String> getRandomQuantileOtus(List<String> data, Long quantileNum)
data
- List( OTUs )quantileNum
- Qunatile (range: 0.0 - 1.0)