Search in sources :

Example 1 with Builder

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission.Builder in project irida by phac-nml.

the class AssemblyFileProcessor method process.

/**
 * {@inheritDoc}
 */
@Override
@Transactional
public void process(SequencingObject sequencingObject) {
    logger.debug("Setting up automated assembly for sequence " + sequencingObject.getId());
    // assembly run by admin
    User admin = userRepository.loadUserByUsername("admin");
    // assembled
    if (sequencingObject instanceof SequenceFilePair) {
        IridaWorkflow defaultWorkflowByType;
        // get the workflow
        try {
            defaultWorkflowByType = workflowsService.getDefaultWorkflowByType(AnalysisType.ASSEMBLY_ANNOTATION);
        } catch (IridaWorkflowNotFoundException e) {
            throw new FileProcessorException("Cannot find assembly workflow", e);
        }
        UUID pipelineUUID = defaultWorkflowByType.getWorkflowIdentifier();
        // build an AnalysisSubmission
        Builder builder = new AnalysisSubmission.Builder(pipelineUUID);
        AnalysisSubmission submission = builder.inputFiles(Sets.newHashSet((SequenceFilePair) sequencingObject)).priority(AnalysisSubmission.Priority.LOW).name("Automated Assembly " + sequencingObject.toString()).updateSamples(true).build();
        submission.setSubmitter(admin);
        submission = submissionRepository.save(submission);
        // Associate the submission with the seqobject
        sequencingObject.setAutomatedAssembly(submission);
        objectRepository.save(sequencingObject);
        logger.debug("Automated assembly submission created for sequencing object " + sequencingObject.getId());
    } else {
        logger.warn("Could not assemble sequencing object " + sequencingObject.getId() + " because it's not paired end");
    }
}
Also used : IridaWorkflowNotFoundException(ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowNotFoundException) SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) FileProcessorException(ca.corefacility.bioinformatics.irida.processing.FileProcessorException) User(ca.corefacility.bioinformatics.irida.model.user.User) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) Builder(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission.Builder) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) UUID(java.util.UUID) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with Builder

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission.Builder in project irida by phac-nml.

the class SistrTypingFileProcessor method process.

/**
 * {@inheritDoc}
 */
@Override
public void process(SequencingObject sequencingObject) {
    logger.debug("Setting up SISTR typing for sequence " + sequencingObject.getId());
    User admin = userRepository.loadUserByUsername("admin");
    Project.AutomatedSISTRSetting automatedSISTRSetting = shouldTypeWithSISTR(sequencingObject);
    // assembled/typed.
    if (sequencingObject instanceof SequenceFilePair) {
        IridaWorkflow defaultWorkflowByType;
        // get the workflow
        try {
            defaultWorkflowByType = workflowsService.getDefaultWorkflowByType(AnalysisType.SISTR_TYPING);
        } catch (IridaWorkflowNotFoundException e) {
            throw new FileProcessorException("Cannot find assembly workflow", e);
        }
        UUID pipelineUUID = defaultWorkflowByType.getWorkflowIdentifier();
        // build an AnalysisSubmission
        Builder builder = new AnalysisSubmission.Builder(pipelineUUID);
        if (automatedSISTRSetting.equals(Project.AutomatedSISTRSetting.AUTO_METADATA)) {
            builder.updateSamples(true);
        } else if (automatedSISTRSetting.equals(Project.AutomatedSISTRSetting.AUTO)) {
            builder.updateSamples(false);
        }
        AnalysisSubmission submission = builder.inputFiles(Sets.newHashSet((SequenceFilePair) sequencingObject)).priority(AnalysisSubmission.Priority.LOW).name("Automated SISTR Typing " + sequencingObject.toString()).build();
        submission.setSubmitter(admin);
        submission = submissionRepository.save(submission);
        // Associate the submission with the seqobject
        sequencingObject.setSistrTyping(submission);
        objectRepository.save(sequencingObject);
        logger.debug("Automated SISTR typing submission created for sequencing object " + sequencingObject.getId());
    } else {
        logger.warn("Could not run SISTR typing for sequencing object " + sequencingObject.getId() + " because it's not paired end");
    }
}
Also used : IridaWorkflowNotFoundException(ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowNotFoundException) Project(ca.corefacility.bioinformatics.irida.model.project.Project) SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) FileProcessorException(ca.corefacility.bioinformatics.irida.processing.FileProcessorException) User(ca.corefacility.bioinformatics.irida.model.user.User) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) Builder(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission.Builder) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) UUID(java.util.UUID)

Aggregations

IridaWorkflowNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowNotFoundException)2 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)2 User (ca.corefacility.bioinformatics.irida.model.user.User)2 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)2 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)2 Builder (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission.Builder)2 FileProcessorException (ca.corefacility.bioinformatics.irida.processing.FileProcessorException)2 UUID (java.util.UUID)2 Project (ca.corefacility.bioinformatics.irida.model.project.Project)1 Transactional (org.springframework.transaction.annotation.Transactional)1