use of uk.ac.babraham.FastQC.Modules.PerSequenceQualityScores in project irida by phac-nml.
the class FastqcFileProcessor method processSingleFile.
/**
* Process a single {@link SequenceFile}
*
* @param sequenceFile
* file to process
* @throws FileProcessorException
* if an error occurs while processing
*/
private void processSingleFile(SequenceFile sequenceFile) throws FileProcessorException {
Path fileToProcess = sequenceFile.getFile();
AnalysisFastQC.AnalysisFastQCBuilder analysis = AnalysisFastQC.builder().executionManagerAnalysisId(EXECUTION_MANAGER_ANALYSIS_ID).description(messageSource.getMessage("fastqc.file.processor.analysis.description", null, LocaleContextHolder.getLocale()));
try {
uk.ac.babraham.FastQC.Sequence.SequenceFile fastQCSequenceFile = SequenceFactory.getSequenceFile(fileToProcess.toFile());
BasicStats basicStats = new BasicStats();
PerBaseQualityScores pbqs = new PerBaseQualityScores();
PerSequenceQualityScores psqs = new PerSequenceQualityScores();
OverRepresentedSeqs overRep = new OverRepresentedSeqs();
QCModule[] moduleList = new QCModule[] { basicStats, pbqs, psqs, overRep };
logger.debug("Launching FastQC analysis modules on all sequences.");
while (fastQCSequenceFile.hasNext()) {
Sequence sequence = fastQCSequenceFile.next();
for (QCModule module : moduleList) {
module.processSequence(sequence);
}
}
logger.debug("Finished FastQC analysis modules.");
handleBasicStats(basicStats, analysis);
handlePerBaseQualityScores(pbqs, analysis);
handlePerSequenceQualityScores(psqs, analysis);
handleDuplicationLevel(overRep.duplicationLevelModule(), analysis);
Set<OverrepresentedSequence> overrepresentedSequences = handleOverRepresentedSequences(overRep);
logger.trace("Saving FastQC analysis.");
analysis.overrepresentedSequences(overrepresentedSequences);
sequenceFile.setFastQCAnalysis(analysis.build());
sequenceFileRepository.saveMetadata(sequenceFile);
} catch (Exception e) {
logger.error("FastQC failed to process the sequence file. Stack trace follows.", e);
throw new FileProcessorException("FastQC failed to parse the sequence file.", e);
}
}
Aggregations