Search in sources :

Example 1 with SequenceFileProcessorLauncher

use of ca.corefacility.bioinformatics.irida.service.impl.processor.SequenceFileProcessorLauncher in project irida by phac-nml.

the class SequencingObjectServiceImpl method create.

/**
 * {@inheritDoc}
 */
@Override
@Transactional
@PreAuthorize("hasAnyRole('ROLE_SEQUENCER', 'ROLE_USER')")
public SequencingObject create(SequencingObject object) throws ConstraintViolationException, EntityExistsException {
    SequencingRun sequencingRun = object.getSequencingRun();
    if (sequencingRun != null) {
        if (object instanceof SingleEndSequenceFile && sequencingRun.getLayoutType() != LayoutType.SINGLE_END) {
            throw new IllegalArgumentException("Attempting to add a single end file to a non single end run");
        } else if (object instanceof SequenceFilePair && sequencingRun.getLayoutType() != LayoutType.PAIRED_END) {
            throw new IllegalArgumentException("Attempting to add a paired end file to a non paired end run");
        }
    }
    for (SequenceFile file : object.getFiles()) {
        file = sequenceFileRepository.save(file);
    }
    SequencingObject so = super.create(object);
    fileProcessingChainExecutor.execute(new SequenceFileProcessorLauncher(fileProcessingChain, so.getId(), SecurityContextHolder.getContext()));
    return so;
}
Also used : SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) SequencingRun(ca.corefacility.bioinformatics.irida.model.run.SequencingRun) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) SequenceFileProcessorLauncher(ca.corefacility.bioinformatics.irida.service.impl.processor.SequenceFileProcessorLauncher) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

SequencingRun (ca.corefacility.bioinformatics.irida.model.run.SequencingRun)1 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)1 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)1 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)1 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)1 SequenceFileProcessorLauncher (ca.corefacility.bioinformatics.irida.service.impl.processor.SequenceFileProcessorLauncher)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 Transactional (org.springframework.transaction.annotation.Transactional)1