use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class RESTAnalysisSubmissionController method getAnalysisOutputFile.
/**
* Get an analysis output file for a given submission
*
* @param submissionId
* The {@link AnalysisSubmission} id
* @param fileType
* The {@link AnalysisOutputFile} type as defined in the
* {@link Analysis} subclass
* @return {@link ModelMap} containing the {@link AnalysisOutputFile}
*/
@RequestMapping("/{submissionId}/analysis/file/{fileType}")
public ModelMap getAnalysisOutputFile(@PathVariable Long submissionId, @PathVariable String fileType) {
ModelMap model = new ModelMap();
AnalysisSubmission read = analysisSubmissionService.read(submissionId);
if (read.getAnalysisState() != AnalysisState.COMPLETED) {
throw new EntityNotFoundException("Analysis is not completed");
}
AnalysisOutputFile analysisOutputFile = read.getAnalysis().getAnalysisOutputFile(fileType);
analysisOutputFile.add(linkTo(methodOn(RESTAnalysisSubmissionController.class).getAnalysisOutputFile(submissionId, fileType)).withSelfRel());
model.addAttribute(RESOURCE_NAME, analysisOutputFile);
return model;
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxy method prepareSubmission.
/**
* {@inheritDoc}
*/
@Override
public Future<AnalysisSubmission> prepareSubmission(final AnalysisSubmission analysisSubmission) throws IridaWorkflowNotFoundException, IOException, ExecutionManagerException {
checkArgument(AnalysisState.NEW.equals(analysisSubmission.getAnalysisState()), "analysis state should be " + AnalysisState.NEW);
analysisSubmission.setAnalysisState(AnalysisState.PREPARING);
AnalysisSubmission preparingAnalysis = analysisSubmissionService.update(analysisSubmission);
return analysisExecutionServiceGalaxyAsync.prepareSubmission(preparingAnalysis);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxy method executeAnalysis.
/**
* {@inheritDoc}
*/
@Override
public Future<AnalysisSubmission> executeAnalysis(AnalysisSubmission analysisSubmission) throws ExecutionManagerException, IridaWorkflowException {
checkArgument(AnalysisState.PREPARED.equals(analysisSubmission.getAnalysisState()), " analysis should be " + AnalysisState.PREPARED);
analysisSubmission.setAnalysisState(AnalysisState.SUBMITTING);
AnalysisSubmission submittingAnalysis = analysisSubmissionService.update(analysisSubmission);
return analysisExecutionServiceGalaxyAsync.executeAnalysis(submittingAnalysis);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyAsync method prepareSubmission.
/**
* Prepares the given {@link AnalysisSubmission} to be executed within an
* execution manager. This will persist the submission within the database.
*
* @param analysisSubmission
* The {@link AnalysisSubmission} to prepare.
* @return A {@link Future} with an {@link AnalysisSubmission} for the
* analysis submitted.
* @throws IridaWorkflowNotFoundException
* If there was an issue getting a workflow.
* @throws IOException
* If there was an issue reading the workflow.
* @throws ExecutionManagerException
* If there was an issue preparing a workspace for the workflow.
*/
@Transactional
public Future<AnalysisSubmission> prepareSubmission(final AnalysisSubmission analysisSubmission) throws IridaWorkflowNotFoundException, IOException, ExecutionManagerException {
checkNotNull(analysisSubmission, "analysisSubmission is null");
checkNotNull(analysisSubmission.getId(), "analysisSubmission id is null");
checkArgument(null == analysisSubmission.getRemoteAnalysisId(), "remote analyis id should be null");
checkArgument(null == analysisSubmission.getRemoteWorkflowId(), "remoteWorkflowId should be null");
IridaWorkflow iridaWorkflow = iridaWorkflowsService.getIridaWorkflow(analysisSubmission.getWorkflowId());
IridaWorkflowStructure workflowStructure = iridaWorkflow.getWorkflowStructure();
logger.debug("Preparing submission for " + analysisSubmission);
String workflowId = galaxyWorkflowService.uploadGalaxyWorkflow(workflowStructure.getWorkflowFile());
analysisSubmission.setRemoteWorkflowId(workflowId);
logger.trace("Uploaded workflow for " + analysisSubmission + " to workflow with id=" + workflowId);
String analysisId = workspaceService.prepareAnalysisWorkspace(analysisSubmission);
logger.trace("Created Galaxy history for analysis " + " id=" + analysisId + ", " + analysisSubmission);
analysisSubmission.setAnalysisState(AnalysisState.PREPARED);
analysisSubmission.setRemoteWorkflowId(workflowId);
analysisSubmission.setRemoteAnalysisId(analysisId);
AnalysisSubmission analysisPrepared = analysisSubmissionService.update(analysisSubmission);
return new AsyncResult<>(analysisPrepared);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission 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");
}
}
Aggregations