public class QiimeParser extends ParserModuleImpl
Modifier and Type | Field and Description |
---|---|
protected static List<String> |
orderedQiimeIDs
Qiime IDs are listed in the same order in each taxonomy level report.
|
protected static Map<String,String> |
qiimeIdToSampleIdMap
Convenience map, to convert Qiime ID to Sample ID
|
protected static Map<String,String> |
sampleIdToQiimeIdMap
Convenience map, to convert Sample ID to Qiime ID
|
NUM_OTUS
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 |
---|
QiimeParser() |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
By default, no cleanUp code is required.
|
protected int |
getFileNameColumn(String line)
Examines the header line to find the column index for "BioLockJFileName" which holds the
demultiplexed sample file name.
|
List<File> |
getInputFiles()
Get only the lowest level report since it contains taxa info for all higher OTU reports.
|
protected static String |
getOtuTableRowId(String id)
This method is used to get an R-friendly Sample ID value by stripping out the quotes AND by replacing any Qiime
ID found with the original Sample ID.
|
protected static String |
getSampleId(String qiimeId)
Get the Sample ID from
qiimeIdToSampleIdMap . |
protected static String |
getSampleIdFromMappingFile(String qiimeId,
int demuxIndex)
The mapping file used the original sampleId when generating the demultipled files, as recorded in mapping file
column - "BioLockJFileName".
|
protected void |
initializeMaps()
Sample IDs in the original metadata file may contain restricted characters that will be replaced with a "." via
{link biolockj.module.implicit.qiime.BuildQiimeMapping}.
|
void |
parseSamples()
Parse lowest level
QiimeClassifier report in the input directory. |
void |
runModule()
To parse the taxonomy level reports output by
QiimeClassifier :
Call getInputFiles()
Call initializeMaps()
Call setOrderedQiimeIDs(File)
Create ParsedSample for the OtuNodeImpl.getSampleId() if not
yet created. |
protected void |
setOrderedQiimeIDs(File file)
Qiime IDs are read in from the header line, converted to the sampleId, and saved to
orderedQiimeIDs . |
addOtuNode, buildOtuCountFiles, checkDependencies, getDepricatedOtuCountFields, getOtuCountField, getParsedSample, getSummary, isValid, setNumHitsFieldName, validateModuleOrder
buildScript, executeTask, getSource, getWorkerScriptFunctions, isValidInputModule, 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
moduleComplete, moduleFailed
buildScript, buildScriptForPairedReads, getJobParams, getMainScript, getScriptDir, getScriptErrors, getTimeout, getWorkerScriptFunctions
executeTask, getID, getModuleDir, getOutputDir, getPostRequisiteModules, getPreRequisiteModules, getTempDir, init, isValidInputModule
protected static final List<String> orderedQiimeIDs
protected static final Map<String,String> qiimeIdToSampleIdMap
public void cleanUp() throws Exception
BioModuleImpl
cleanUp
in interface BioModule
cleanUp
in class BioModuleImpl
Exception
- thrown if any runtime error occurspublic List<File> getInputFiles() throws Exception
getInputFiles
in interface BioModule
getInputFiles
in class BioModuleImpl
Exception
- if unable to obtain input filespublic void parseSamples() throws Exception
QiimeClassifier
report in the input directory. The
classifier report lists 1 OTU/line with 1 column/sample, each column holds the OTU count for the QIIME ID in the
column header. For each line, build a QiimeNode
for each sample with a positive OTU
count.
QiimeNode
s will be created using QiimeID (not SampleID) in order to match the metadata
file #SampleID
If ParserModuleImpl.isValid(OtuNode)
:
ParsedSample
for the OtuNodeImpl.getSampleId()
if not
yet created.
OtuNodeImpl.getCount()
(1) to ParsedSample
OTU count.
parseSamples
in interface ParserModule
parseSamples
in class ParserModuleImpl
Exception
- if error occurs while parsing classifier reportspublic void runModule() throws Exception
QiimeClassifier
:
getInputFiles()
initializeMaps()
setOrderedQiimeIDs(File)
ParsedSample
for the OtuNodeImpl.getSampleId()
if not
yet created.
OtuNodeImpl.getCount()
(1) to ParsedSample
OTU count.
Sample QIIME report line: (head otu_table_L2.txt):
# Constructed from biom file #OTU ID 3A.1 6A.1 120A.1 7A.1 k__Bacteria;p__Actinobacteria 419.0 26.0 90.0 70.0
runModule
in interface JavaModule
runModule
in class ParserModuleImpl
Exception
- thrown if any runtime error occursprotected int getFileNameColumn(String line) throws Exception
line
- Header line containing column namesException
- If "BioLockJFileName" not found.protected void initializeMaps() throws Exception
Exception
- if unable to initialize the mapsConvenience maps are initialized to simplify lookups:
protected void setOrderedQiimeIDs(File file) throws Exception
orderedQiimeIDs
.file
- Taxonomy level report fileException
- If unable to read the file parameterprotected static String getOtuTableRowId(String id) throws Exception
id
- Sample IDException
- If any QIIME ID does not have a corresponding Sample IDprotected static String getSampleId(String qiimeId) throws Exception
qiimeIdToSampleIdMap
. Qiime removes special characters by output of
BuildQiimeMapping
, to create the qiimeId, which this method accepts as a
parameter to lookup the Sample ID.qiimeId
- Qiime ID that was created from sample ID in a previous scriptException
- if the qiimeId is not found in qiimeIdToSampleIdMap
protected static String getSampleIdFromMappingFile(String qiimeId, int demuxIndex) throws Exception
qiimeId
- Qiime corrected IDdemuxIndex
- Qiime mapping column index for"BioLockJFileName"Exception
- if unable to get sample ID from metadata file column
"BioLockJFileName"